- 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.

8.0.x
Dries Buytaert 2011-05-13 22:06:54 -04:00
parent b9bcbf8c63
commit 7ed2dbe959
2 changed files with 61 additions and 28 deletions

View File

@ -730,26 +730,6 @@ function update_manager_install_form_submit($form, &$form_state) {
* and verify archive files. * and verify archive files.
*/ */
/**
* 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. * Unpack a downloaded archive file.
* *
@ -829,13 +809,9 @@ function update_manager_file_get($url) {
} }
// Check the cache and download the file if needed. // 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']); $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)) { if (!file_exists($local) || update_delete_file_if_stale($local)) {
return system_retrieve_file($url, $local, FALSE, FILE_EXISTS_REPLACE); return system_retrieve_file($url, $local, FALSE, FILE_EXISTS_REPLACE);
} }

View File

@ -856,14 +856,71 @@ function update_flush_caches() {
* @} End of "defgroup update_status_cache". * @} End of "defgroup update_status_cache".
*/ */
/**
* 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. * Clear the temporary files and directories based on file age from disk.
*/ */
function update_clear_update_disk_cache() { 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( $directories = array(
'temporary://update-cache', _update_manager_cache_directory(FALSE),
'temporary://update-extraction', _update_manager_extract_directory(FALSE),
); );
// Search for files and directories in base folder only without recursion. // Search for files and directories in base folder only without recursion.