#64967 follow-up by drewish: Replace ereg with preg in file_scan_directory().
parent
67f93fcb16
commit
89b4c55989
|
@ -1952,7 +1952,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'), '/.*/', array('.', '..', 'CVS'), 'file_delete', TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2325,7 +2325,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'), '/.*/', array('.', '..', 'CVS'), 'file_delete', TRUE);
|
||||
variable_set('javascript_parsed', array());
|
||||
}
|
||||
|
||||
|
@ -2651,7 +2651,7 @@ function drupal_cron_cleanup() {
|
|||
* version will be included.
|
||||
*
|
||||
* @param $mask
|
||||
* The regular expression of the files to find.
|
||||
* The preg_match() regular expression of the files to find.
|
||||
* @param $directory
|
||||
* The subdirectory name in which the files are found. For example,
|
||||
* 'modules' will search in both modules/ and
|
||||
|
|
|
@ -962,7 +962,7 @@ function file_download() {
|
|||
* @param $dir
|
||||
* The base directory for the scan, without trailing slash.
|
||||
* @param $mask
|
||||
* The regular expression of the files to find.
|
||||
* The preg_match() regular expression of the files to find.
|
||||
* @param $nomask
|
||||
* An array of files/directories to ignore.
|
||||
* @param $callback
|
||||
|
@ -997,7 +997,7 @@ function file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $ca
|
|||
// Give priority to files in this folder by merging them in after any subdirectory files.
|
||||
$files = array_merge(file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1), $files);
|
||||
}
|
||||
elseif ($depth >= $min_depth && ereg($mask, $file)) {
|
||||
elseif ($depth >= $min_depth && preg_match($mask, $file)) {
|
||||
// Always use this match over anything already set in $files with the
|
||||
// same $$key.
|
||||
$filename = "$dir/$file";
|
||||
|
|
|
@ -409,7 +409,7 @@ function drupal_rewrite_settings($settings = array(), $prefix = '') {
|
|||
function drupal_get_install_files($module_list = array()) {
|
||||
$installs = array();
|
||||
foreach ($module_list as $module) {
|
||||
$installs = array_merge($installs, drupal_system_listing($module . '.install$', 'modules'));
|
||||
$installs = array_merge($installs, drupal_system_listing('/'. $module . '.install$/', 'modules'));
|
||||
}
|
||||
return $installs;
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ function drupal_verify_profile($profile, $locale) {
|
|||
|
||||
// Get a list of modules that exist in Drupal's assorted subdirectories.
|
||||
$present_modules = array();
|
||||
foreach (drupal_system_listing('\.module$', 'modules', 'name', 0) as $present_module) {
|
||||
foreach (drupal_system_listing('/\.module$/', 'modules', 'name', 0) as $present_module) {
|
||||
$present_modules[] = $present_module->name;
|
||||
}
|
||||
|
||||
|
|
|
@ -2479,7 +2479,7 @@ function locale_batch_by_language($langcode, $finished = NULL, $skip = array())
|
|||
// with names ending with $langcode.po. This allows for filenames
|
||||
// like node-module.de.po to let translators use small files and
|
||||
// be able to import in smaller chunks.
|
||||
$files = array_merge($files, file_scan_directory(dirname($component->filename) . '/translations', '(^|\.)' . $langcode . '\.po$', array('.', '..', 'CVS'), 0, FALSE));
|
||||
$files = array_merge($files, file_scan_directory(dirname($component->filename) . '/translations', '/(^|\.)' . $langcode . '\.po$/', array('.', '..', 'CVS'), 0, FALSE));
|
||||
$components[] = $component->name;
|
||||
}
|
||||
|
||||
|
@ -2511,7 +2511,7 @@ function locale_batch_by_component($components, $finished = '_locale_batch_syste
|
|||
// as $langcode.po or with names ending with $langcode.po. This allows
|
||||
// for filenames like node-module.de.po to let translators use small
|
||||
// files and be able to import in smaller chunks.
|
||||
$files = array_merge($files, file_scan_directory(dirname($component->filename) . '/translations', '(^|\.)(' . $language_list . ')\.po$', array('.', '..', 'CVS'), 0, FALSE));
|
||||
$files = array_merge($files, file_scan_directory(dirname($component->filename) . '/translations', '/(^|\.)(' . $language_list . ')\.po$/', array('.', '..', 'CVS'), 0, FALSE));
|
||||
}
|
||||
}
|
||||
return _locale_batch_build($files, $finished);
|
||||
|
|
|
@ -80,7 +80,7 @@ function module_list($refresh = FALSE, $bootstrap = TRUE, $sort = FALSE, $fixed_
|
|||
*/
|
||||
function module_rebuild_cache() {
|
||||
// Get current list of modules
|
||||
$files = drupal_system_listing('\.module$', 'modules', 'name', 0);
|
||||
$files = drupal_system_listing('/\.module$/', 'modules', 'name', 0);
|
||||
|
||||
// Extract current files from database.
|
||||
system_get_files_database($files, 'module');
|
||||
|
|
|
@ -49,7 +49,7 @@ function _registry_rebuild() {
|
|||
}
|
||||
}
|
||||
}
|
||||
foreach (file_scan_directory('includes', '\.inc$') as $filename => $file) {
|
||||
foreach (file_scan_directory('includes', '/\.inc$/') as $filename => $file) {
|
||||
$files["./$filename"] = array();
|
||||
}
|
||||
|
||||
|
|
|
@ -790,7 +790,7 @@ function drupal_find_theme_templates($cache, $extension, $path) {
|
|||
$subtheme_paths = isset($theme_paths[$theme]) ? $theme_paths[$theme] : array();
|
||||
|
||||
// Escape the periods in the extension.
|
||||
$regex = str_replace('.', '\.', $extension) . '$';
|
||||
$regex = '/'. str_replace('.', '\.', $extension) . '$/';
|
||||
// Because drupal_system_listing works the way it does, we check for real
|
||||
// templates separately from checking for patterns.
|
||||
$files = drupal_system_listing($regex, $path, 'name', 0);
|
||||
|
|
|
@ -401,7 +401,7 @@ function install_settings_form_submit($form, &$form_state) {
|
|||
* Find all .profile files.
|
||||
*/
|
||||
function install_find_profiles() {
|
||||
return file_scan_directory('./profiles', '\.profile$', array('.', '..', 'CVS'), 0, TRUE, 'name', 0);
|
||||
return file_scan_directory('./profiles', '/\.profile$/', array('.', '..', 'CVS'), 0, TRUE, 'name', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -487,7 +487,7 @@ function install_select_profile_form(&$form_state, $profile_files) {
|
|||
* Find all .po files for the current profile.
|
||||
*/
|
||||
function install_find_locales($profilename) {
|
||||
$locales = file_scan_directory('./profiles/' . $profilename . '/translations', '\.po$', array('.', '..', 'CVS'), 0, FALSE);
|
||||
$locales = file_scan_directory('./profiles/' . $profilename . '/translations', '/\.po$/', array('.', '..', 'CVS'), 0, FALSE);
|
||||
array_unshift($locales, (object) array('name' => 'en'));
|
||||
return $locales;
|
||||
}
|
||||
|
|
|
@ -467,7 +467,7 @@ class DrupalWebTestCase {
|
|||
if (in_array($type, array('binary', 'html', 'image', 'javascript', 'php', 'sql', 'text'))) {
|
||||
// Use original file directory instead of one created during setUp().
|
||||
$path = $this->original_file_directory . '/simpletest';
|
||||
$files = file_scan_directory($path, $type . '\-.*');
|
||||
$files = file_scan_directory($path, '/' . $type . '\-.*/');
|
||||
|
||||
// If size is set then remove any files that are not of that size.
|
||||
if ($size !== NULL) {
|
||||
|
|
|
@ -28,10 +28,10 @@ function simpletest_install() {
|
|||
}
|
||||
|
||||
// Copy other test files for consistency.
|
||||
$files = file_scan_directory($path, '(html|image|javascript|php|sql)-.*');
|
||||
$files = file_scan_directory($path, '/(html|image|javascript|php|sql)-.*/');
|
||||
if (count($files) == 0) {
|
||||
$original = drupal_get_path('module', 'simpletest') . '/files';
|
||||
$files = file_scan_directory($original, '(html|image|javascript|php|sql)-.*');
|
||||
$files = file_scan_directory($original, '/(html|image|javascript|php|sql)-.*/');
|
||||
foreach ($files as $file) {
|
||||
file_copy($file->filename, $path . '/' . $file->basename);
|
||||
}
|
||||
|
|
|
@ -435,7 +435,7 @@ function simpletest_get_all_tests() {
|
|||
|
||||
$tests_directory = $module_path . '/tests';
|
||||
if (is_dir($tests_directory)) {
|
||||
foreach (file_scan_directory($tests_directory, '\.test$') as $file) {
|
||||
foreach (file_scan_directory($tests_directory, '/\.test$/') as $file) {
|
||||
$files[] = $file->filename;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1003,9 +1003,9 @@ function _system_theme_data() {
|
|||
|
||||
if (empty($themes_info)) {
|
||||
// Find themes
|
||||
$themes = drupal_system_listing('\.info$', 'themes');
|
||||
$themes = drupal_system_listing('/\.info$/', 'themes');
|
||||
// Find theme engines
|
||||
$engines = drupal_system_listing('\.engine$', 'themes/engines');
|
||||
$engines = drupal_system_listing('/\.engine$/', 'themes/engines');
|
||||
|
||||
$defaults = system_theme_default();
|
||||
|
||||
|
|
Loading…
Reference in New Issue