Issue #3035361 by claudiu.cristea: Remove usages of drupal_static() & drupal_static_reset() from file_test.module
parent
d50ccb594d
commit
a33e47e5af
|
@ -319,24 +319,31 @@ function file_test_validator(File $file, $errors) {
|
||||||
*
|
*
|
||||||
* @param string|null $filepath
|
* @param string|null $filepath
|
||||||
* File path
|
* File path
|
||||||
|
* @param bool $reset
|
||||||
|
* (optional) If to reset the internal memory cache. If TRUE is passed, the
|
||||||
|
* first parameter has no effect. Defaults to FALSE.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* If $filepath is NULL, an array of all previous $filepath parameters
|
* If $filepath is NULL, an array of all previous $filepath parameters
|
||||||
*/
|
*/
|
||||||
function file_test_file_scan_callback($filepath = NULL) {
|
function file_test_file_scan_callback($filepath = NULL, $reset = FALSE) {
|
||||||
$files = &drupal_static(__FUNCTION__, []);
|
static $files = [];
|
||||||
if (isset($filepath)) {
|
|
||||||
|
if ($reset) {
|
||||||
|
$files = [];
|
||||||
|
}
|
||||||
|
elseif ($filepath) {
|
||||||
$files[] = $filepath;
|
$files[] = $filepath;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return $files;
|
return $files;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset static variables used by file_test_file_scan_callback().
|
* Reset static variables used by file_test_file_scan_callback().
|
||||||
*/
|
*/
|
||||||
function file_test_file_scan_callback_reset() {
|
function file_test_file_scan_callback_reset() {
|
||||||
drupal_static_reset('file_test_file_scan_callback');
|
file_test_file_scan_callback(NULL, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue