diff options
Diffstat (limited to 'modules/update')
-rw-r--r-- | modules/update/tests/aaa_update_test.info | 1 | ||||
-rw-r--r-- | modules/update/tests/aaa_update_test.module | 1 | ||||
-rw-r--r-- | modules/update/tests/bbb_update_test.info | 1 | ||||
-rw-r--r-- | modules/update/tests/bbb_update_test.module | 1 | ||||
-rw-r--r-- | modules/update/tests/ccc_update_test.info | 1 | ||||
-rw-r--r-- | modules/update/tests/ccc_update_test.module | 1 | ||||
-rw-r--r-- | modules/update/tests/update_test.info | 1 | ||||
-rw-r--r-- | modules/update/tests/update_test.module | 1 | ||||
-rw-r--r-- | modules/update/update-rtl.css | 1 | ||||
-rw-r--r-- | modules/update/update.api.php | 1 | ||||
-rw-r--r-- | modules/update/update.authorize.inc | 3 | ||||
-rw-r--r-- | modules/update/update.compare.inc | 1 | ||||
-rw-r--r-- | modules/update/update.css | 1 | ||||
-rw-r--r-- | modules/update/update.fetch.inc | 1 | ||||
-rw-r--r-- | modules/update/update.info | 1 | ||||
-rw-r--r-- | modules/update/update.install | 1 | ||||
-rw-r--r-- | modules/update/update.manager.inc | 44 | ||||
-rw-r--r-- | modules/update/update.module | 64 | ||||
-rw-r--r-- | modules/update/update.report.inc | 9 | ||||
-rw-r--r-- | modules/update/update.settings.inc | 1 | ||||
-rw-r--r-- | modules/update/update.test | 3 |
21 files changed, 80 insertions, 59 deletions
diff --git a/modules/update/tests/aaa_update_test.info b/modules/update/tests/aaa_update_test.info index 23d7f71f1..a283720d0 100644 --- a/modules/update/tests/aaa_update_test.info +++ b/modules/update/tests/aaa_update_test.info @@ -1,4 +1,3 @@ -; $Id$ name = AAA Update test description = Support module for update module testing. package = Testing diff --git a/modules/update/tests/aaa_update_test.module b/modules/update/tests/aaa_update_test.module index da4699c05..4d67b8e40 100644 --- a/modules/update/tests/aaa_update_test.module +++ b/modules/update/tests/aaa_update_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/update/tests/bbb_update_test.info b/modules/update/tests/bbb_update_test.info index 0d77d1ee3..75084ae61 100644 --- a/modules/update/tests/bbb_update_test.info +++ b/modules/update/tests/bbb_update_test.info @@ -1,4 +1,3 @@ -; $Id$ name = BBB Update test description = Support module for update module testing. package = Testing diff --git a/modules/update/tests/bbb_update_test.module b/modules/update/tests/bbb_update_test.module index da4699c05..4d67b8e40 100644 --- a/modules/update/tests/bbb_update_test.module +++ b/modules/update/tests/bbb_update_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/update/tests/ccc_update_test.info b/modules/update/tests/ccc_update_test.info index 890f843b5..0bd4cde13 100644 --- a/modules/update/tests/ccc_update_test.info +++ b/modules/update/tests/ccc_update_test.info @@ -1,4 +1,3 @@ -; $Id$ name = CCC Update test description = Support module for update module testing. package = Testing diff --git a/modules/update/tests/ccc_update_test.module b/modules/update/tests/ccc_update_test.module index da4699c05..4d67b8e40 100644 --- a/modules/update/tests/ccc_update_test.module +++ b/modules/update/tests/ccc_update_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/update/tests/update_test.info b/modules/update/tests/update_test.info index cd02c4bb4..f68dc9da2 100644 --- a/modules/update/tests/update_test.info +++ b/modules/update/tests/update_test.info @@ -1,4 +1,3 @@ -; $Id$ name = Update test description = Support module for update module testing. package = Testing diff --git a/modules/update/tests/update_test.module b/modules/update/tests/update_test.module index fb7d3abfb..4e32d336a 100644 --- a/modules/update/tests/update_test.module +++ b/modules/update/tests/update_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Implements hook_menu(). diff --git a/modules/update/update-rtl.css b/modules/update/update-rtl.css index a19c85f4e..5fc83d1a6 100644 --- a/modules/update/update-rtl.css +++ b/modules/update/update-rtl.css @@ -1,4 +1,3 @@ -/* $Id$ */ .update .project { padding-right: .25em; diff --git a/modules/update/update.api.php b/modules/update/update.api.php index ef78cbf42..87f95cac5 100644 --- a/modules/update/update.api.php +++ b/modules/update/update.api.php @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/update/update.authorize.inc b/modules/update/update.authorize.inc index 978fee4a4..c9b76dd30 100644 --- a/modules/update/update.authorize.inc +++ b/modules/update/update.authorize.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -102,7 +101,7 @@ function update_authorize_run_install($filetransfer, $project, $updater_name, $l * already been downloaded and extracted into. * @param FileTransfer $filetransfer * The FileTransfer object to use for performing this operation. - * @param array &$context + * @param array $context * Reference to an array used for BatchAPI storage. */ function update_authorize_batch_copy_project($project, $updater_name, $local_url, $filetransfer, &$context) { diff --git a/modules/update/update.compare.inc b/modules/update/update.compare.inc index a4dc6ceec..2ccd97c0e 100644 --- a/modules/update/update.compare.inc +++ b/modules/update/update.compare.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/update/update.css b/modules/update/update.css index b3900508c..d30dfb6e5 100644 --- a/modules/update/update.css +++ b/modules/update/update.css @@ -1,4 +1,3 @@ -/* $Id$ */ .update .project { font-weight: bold; diff --git a/modules/update/update.fetch.inc b/modules/update/update.fetch.inc index b3041cbc5..ff69cbb11 100644 --- a/modules/update/update.fetch.inc +++ b/modules/update/update.fetch.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/update/update.info b/modules/update/update.info index 85944e527..250cae193 100644 --- a/modules/update/update.info +++ b/modules/update/update.info @@ -1,4 +1,3 @@ -; $Id$ name = Update manager description = Checks for available updates, and can securely install or update modules and themes via a web interface. version = VERSION diff --git a/modules/update/update.install b/modules/update/update.install index 95688e938..70fb6c328 100644 --- a/modules/update/update.install +++ b/modules/update/update.install @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/update/update.manager.inc b/modules/update/update.manager.inc index 4f55b1b5b..35b292905 100644 --- a/modules/update/update.manager.inc +++ b/modules/update/update.manager.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -644,8 +643,11 @@ function update_manager_install_form_submit($form, &$form_state) { form_set_error($field, t('Provided archive contains no files.')); return; } - // Unfortunately, we can only use the directory name for this. :( - $project = drupal_substr($files[0], 0, -1); + + // Unfortunately, we can only use the directory name to determine the project + // name. Some archivers list the first file as the directory (i.e., MODULE/) + // and others list an actual file (i.e., MODULE/README.TXT). + $project = strtok($files[0], '/\\'); $archive_errors = update_manager_archive_verify($project, $local_cache, $directory); if (!empty($archive_errors)) { @@ -729,26 +731,6 @@ function update_manager_install_form_submit($form, &$form_state) { */ /** - * Return the directory where update archive files should be extracted. - * - * If the directory does not already exist, attempt to create it. - * - * @return - * The full path to the temporary directory where update file archives - * should be extracted. - */ -function _update_manager_extract_directory() { - $directory = &drupal_static(__FUNCTION__, ''); - if (empty($directory)) { - $directory = 'temporary://update-extraction'; - if (!file_exists($directory)) { - mkdir($directory); - } - } - return $directory; -} - -/** * Unpack a downloaded archive file. * * @param string $project @@ -771,8 +753,12 @@ function update_manager_archive_extract($file, $directory) { // old files mixed with the new files (e.g. in cases where files were removed // from a later release). $files = $archiver->listContents(); - // Unfortunately, we can only use the directory name for this. :( - $project = drupal_substr($files[0], 0, -1); + + // Unfortunately, we can only use the directory name to determine the project + // name. Some archivers list the first file as the directory (i.e., MODULE/) + // and others list an actual file (i.e., MODULE/README.TXT). + $project = strtok($files[0], '/\\'); + $extract_location = $directory . '/' . $project; if (file_exists($extract_location)) { file_unmanaged_delete_recursive($extract_location); @@ -823,13 +809,9 @@ function update_manager_file_get($url) { } // Check the cache and download the file if needed. - $cache_directory = 'temporary://update-cache'; + $cache_directory = _update_manager_cache_directory(); $local = $cache_directory . '/' . basename($parsed_url['path']); - if (!file_exists($cache_directory)) { - mkdir($cache_directory); - } - if (!file_exists($local) || update_delete_file_if_stale($local)) { return system_retrieve_file($url, $local, FALSE, FILE_EXISTS_REPLACE); } @@ -849,7 +831,7 @@ function update_manager_file_get($url) { * The short name of the project to download. * @param string $url * The URL to download a specific project release archive file. - * @param array &$context + * @param array $context * Reference to an array used for BatchAPI storage. * * @see update_manager_download_page() diff --git a/modules/update/update.module b/modules/update/update.module index c5551e230..a66cfa512 100644 --- a/modules/update/update.module +++ b/modules/update/update.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -858,13 +857,70 @@ function update_flush_caches() { */ /** + * Return a short unique identifier for this Drupal installation. + * + * @return + * An eight character string uniquely identifying this Drupal installation. + */ +function _update_manager_unique_identifier() { + $id = &drupal_static(__FUNCTION__, ''); + if (empty($id)) { + $id = substr(hash('sha256', drupal_get_hash_salt()), 0, 8); + } + return $id; +} + +/** + * Return the directory where update archive files should be extracted. + * + * @param $create + * If TRUE, attempt to create the directory if it does not already exist. + * + * @return + * The full path to the temporary directory where update file archives + * should be extracted. + */ +function _update_manager_extract_directory($create = TRUE) { + $directory = &drupal_static(__FUNCTION__, ''); + if (empty($directory)) { + $directory = 'temporary://update-extraction-' . _update_manager_unique_identifier(); + if ($create && !file_exists($directory)) { + mkdir($directory); + } + } + return $directory; +} + +/** + * Return the directory where update archive files should be cached. + * + * @param $create + * If TRUE, attempt to create the directory if it does not already exist. + * + * @return + * The full path to the temporary directory where update file archives + * should be cached. + */ +function _update_manager_cache_directory($create = TRUE) { + $directory = &drupal_static(__FUNCTION__, ''); + if (empty($directory)) { + $directory = 'temporary://update-cache-' . _update_manager_unique_identifier(); + if ($create && !file_exists($directory)) { + mkdir($directory); + } + } + return $directory; +} + +/** * Clear the temporary files and directories based on file age from disk. */ function update_clear_update_disk_cache() { - // List of update module cache directories. + // List of update module cache directories. Do not create the directories if + // they do not exist. $directories = array( - 'temporary://update-cache', - 'temporary://update-extraction', + _update_manager_cache_directory(FALSE), + _update_manager_extract_directory(FALSE), ); // Search for files and directories in base folder only without recursion. diff --git a/modules/update/update.report.inc b/modules/update/update.report.inc index ca33cf14c..3f5933acb 100644 --- a/modules/update/update.report.inc +++ b/modules/update/update.report.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -58,25 +57,25 @@ function theme_update_report($variables) { switch ($project['status']) { case UPDATE_CURRENT: $class = 'ok'; - $icon = theme('image', array('path' => 'misc/watchdog-ok.png', 'alt' => t('ok'), 'title' => t('ok'))); + $icon = theme('image', array('path' => 'misc/watchdog-ok.png', 'width' => 18, 'height' => 18, 'alt' => t('ok'), 'title' => t('ok'))); break; case UPDATE_UNKNOWN: case UPDATE_FETCH_PENDING: case UPDATE_NOT_FETCHED: $class = 'unknown'; - $icon = theme('image', array('path' => 'misc/watchdog-warning.png', 'alt' => t('warning'), 'title' => t('warning'))); + $icon = theme('image', array('path' => 'misc/watchdog-warning.png', 'width' => 18, 'height' => 18, 'alt' => t('warning'), 'title' => t('warning'))); break; case UPDATE_NOT_SECURE: case UPDATE_REVOKED: case UPDATE_NOT_SUPPORTED: $class = 'error'; - $icon = theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('error'), 'title' => t('error'))); + $icon = theme('image', array('path' => 'misc/watchdog-error.png', 'width' => 18, 'height' => 18, 'alt' => t('error'), 'title' => t('error'))); break; case UPDATE_NOT_CHECKED: case UPDATE_NOT_CURRENT: default: $class = 'warning'; - $icon = theme('image', array('path' => 'misc/watchdog-warning.png', 'alt' => t('warning'), 'title' => t('warning'))); + $icon = theme('image', array('path' => 'misc/watchdog-warning.png', 'width' => 18, 'height' => 18, 'alt' => t('warning'), 'title' => t('warning'))); break; } diff --git a/modules/update/update.settings.inc b/modules/update/update.settings.inc index 0c32345ac..60ac3ca8e 100644 --- a/modules/update/update.settings.inc +++ b/modules/update/update.settings.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/update/update.test b/modules/update/update.test index a1252dcde..6f9ef08ed 100644 --- a/modules/update/update.test +++ b/modules/update/update.test @@ -1,8 +1,9 @@ <?php -// $Id$ /** * @file + * Tests for update.module. + * * This file contains tests for the update module. The overarching methodology * of these tests is we need to compare a given state of installed modules and * themes (e.g. version, project grouping, timestamps, etc) vs. a current |