Applied adapted Drupal core patch #572516 for sites with mixed public and private files

This commit is contained in:
Manuel Cillero 2017-08-20 17:26:27 +02:00
parent 75c72c4cbb
commit 5c5aaddc78
6 changed files with 35 additions and 27 deletions

View file

@ -1926,8 +1926,8 @@ function drupal_get_css($css = NULL) {
$no_theme_preprocess = '';
$preprocess_css = (variable_get('preprocess_css', FALSE) && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update'));
$directory = file_directory_path();
$is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC);
$directory = file_directory_path(TRUE);
$is_writable = is_dir($directory) && is_writable($directory);
// A dummy query-string is added to filenames, to gain control over
// browser-caching. The string changes on every update or full cache
@ -2002,7 +2002,7 @@ function drupal_build_css_cache($types, $filename) {
$data = '';
// Create the css/ within the files folder.
$csspath = file_create_path('css');
$csspath = file_create_path('css', TRUE);
file_check_directory($csspath, FILE_CREATE_DIRECTORY);
if (!file_exists($csspath .'/'. $filename)) {
@ -2028,7 +2028,7 @@ function drupal_build_css_cache($types, $filename) {
$data = implode('', $matches[0]) . $data;
// Create the CSS file.
file_save_data($data, $csspath .'/'. $filename, FILE_EXISTS_REPLACE);
file_save_data($data, $csspath .'/'. $filename, FILE_EXISTS_REPLACE, TRUE);
}
return $csspath .'/'. $filename;
}
@ -2182,7 +2182,7 @@ function _drupal_load_stylesheet($matches) {
* Delete all cached CSS files.
*/
function drupal_clear_css_cache() {
file_scan_directory(file_create_path('css'), '.*', array('.', '..', 'CVS'), 'file_delete', TRUE);
file_scan_directory(file_create_path('css', TRUE), '.*', array('.', '..', 'CVS'), 'file_delete', TRUE);
}
/**
@ -2333,8 +2333,8 @@ function drupal_get_js($scope = 'header', $javascript = NULL) {
$no_preprocess = array('core' => '', 'module' => '', 'theme' => '');
$files = array();
$preprocess_js = (variable_get('preprocess_js', FALSE) && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update'));
$directory = file_directory_path();
$is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC);
$directory = file_directory_path(TRUE);
$is_writable = is_dir($directory) && is_writable($directory);
// A dummy query-string is added to filenames, to gain control over
// browser-caching. The string changes on every update or full cache
@ -2535,7 +2535,7 @@ function drupal_build_js_cache($files, $filename) {
$contents = '';
// Create the js/ within the files folder.
$jspath = file_create_path('js');
$jspath = file_create_path('js', TRUE);
file_check_directory($jspath, FILE_CREATE_DIRECTORY);
if (!file_exists($jspath .'/'. $filename)) {
@ -2548,7 +2548,7 @@ function drupal_build_js_cache($files, $filename) {
}
// Create the JS file.
file_save_data($contents, $jspath .'/'. $filename, FILE_EXISTS_REPLACE);
file_save_data($contents, $jspath .'/'. $filename, FILE_EXISTS_REPLACE, TRUE);
}
return $jspath .'/'. $filename;
@ -2558,7 +2558,7 @@ function drupal_build_js_cache($files, $filename) {
* Delete all cached JS files.
*/
function drupal_clear_js_cache() {
file_scan_directory(file_create_path('js'), '.*', array('.', '..', 'CVS'), 'file_delete', TRUE);
file_scan_directory(file_create_path('js', TRUE), '.*', array('.', '..', 'CVS'), 'file_delete', TRUE);
variable_set('javascript_parsed', array());
}