diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-09-16 07:17:56 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-09-16 07:17:56 +0000 |
commit | 5c7983c4deae55ad41b85ca99db54d3fce283fd9 (patch) | |
tree | 59801cd96a36c390586752c58d6cf5ba50c230ce /modules/upload/upload.module | |
parent | 6f0fd3aa55659f8bd6b023e8e82e990326c1b788 (diff) | |
download | brdo-5c7983c4deae55ad41b85ca99db54d3fce283fd9.tar.gz brdo-5c7983c4deae55ad41b85ca99db54d3fce283fd9.tar.bz2 |
- Patch #8179 by JonBob: reintroduced menu caching.
Diffstat (limited to 'modules/upload/upload.module')
-rw-r--r-- | modules/upload/upload.module | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/modules/upload/upload.module b/modules/upload/upload.module index e9cd1e8c9..0d1092ba6 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -21,27 +21,31 @@ function upload_perm() { return array('upload files'); } -function upload_menu() { - // Add handlers for previewing new uploads. - if ($_SESSION['file_uploads']) { - $items = array(); - foreach ($_SESSION['file_uploads'] as $key => $file) { - $filename = file_create_filename($file->filename, file_create_path()); - $items[] = array( - 'path' => $filename, 'title' => t('file download'), - 'callback' => 'upload_download', - 'access' => true, - 'type' => MENU_DYNAMIC_ITEM & MENU_HIDDEN - ); - $_SESSION['file_uploads'][$key]->_filename = $filename; +function upload_menu($may_cache) { + $items = array(); + + if ($may_cache) { + // Add handlers for previewing new uploads. + if ($_SESSION['file_uploads']) { + foreach ($_SESSION['file_uploads'] as $key => $file) { + $filename = file_create_filename($file->filename, file_create_path()); + $items[] = array( + 'path' => $filename, 'title' => t('file download'), + 'callback' => 'upload_download', + 'access' => true, + 'type' => MENU_DYNAMIC_ITEM & MENU_HIDDEN + ); + $_SESSION['file_uploads'][$key]->_filename = $filename; + } } + $items[] = array( + 'path' => 'admin/upload', 'title' => t('uploads'), + 'callback' => 'upload_admin', + 'access' => user_access('access administration pages'), + 'type' => MENU_NORMAL_ITEM + ); } - $items[] = array( - 'path' => 'admin/upload', 'title' => t('uploads'), - 'callback' => 'upload_admin', - 'access' => user_access('access administration pages'), - 'type' => MENU_NORMAL_ITEM - ); + return $items; } |