diff options
author | Dries Buytaert <dries@buytaert.net> | 2011-05-13 22:06:30 -0400 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2011-05-13 22:06:30 -0400 |
commit | 02dd3c52cd66cdc48aeab5834a163ff0321cefca (patch) | |
tree | c2d402336b11b59a119363093727b594b8a348f3 /modules/update | |
parent | ff5cdeeec73441e300eab8db65da8c4da4631e38 (diff) | |
download | brdo-02dd3c52cd66cdc48aeab5834a163ff0321cefca.tar.gz brdo-02dd3c52cd66cdc48aeab5834a163ff0321cefca.tar.bz2 |
- Patch #843162 by pwolanin, Scott Falconer, Berdir, jhodgdon, a.mikheychik, mtift: creating vocabularies with machine-names 'List' or 'Add' breaks links in taxonomy overview admin area.
Diffstat (limited to 'modules/update')
-rw-r--r-- | modules/update/update.manager.inc | 26 | ||||
-rw-r--r-- | modules/update/update.module | 63 |
2 files changed, 61 insertions, 28 deletions
diff --git a/modules/update/update.manager.inc b/modules/update/update.manager.inc index ad8aefdd8..35b292905 100644 --- a/modules/update/update.manager.inc +++ b/modules/update/update.manager.inc @@ -731,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 @@ -829,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); } diff --git a/modules/update/update.module b/modules/update/update.module index 10089649d..a66cfa512 100644 --- a/modules/update/update.module +++ b/modules/update/update.module @@ -857,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. |