Skip to content
Snippets Groups Projects
Commit 57d271aa authored by John Ouellet's avatar John Ouellet
Browse files

Issue#2637028 Redo some chosen directories for performance + add an update

parent fb8313cf
Branches
Tags 7.x-1.0-beta9
No related merge requests found
......@@ -81,3 +81,14 @@ function fancy_file_delete_update_7101() {
db_create_table('unmanaged_files', $schema['unmanaged_files']);
}
}
/**
* Clear Chosen Dir variable for new performance tweaks.
*/
function fancy_file_delete_update_7102() {
// Remove this thang.
variable_del('fancy_file_delete_unmanaged_chosen_dirs');
// Run this again so the views get updated to small tweaks made.
drupal_flush_all_caches();
}
......@@ -170,7 +170,8 @@ function fancy_file_delete_unmanaged_update_view() {
// Go through and add this to the batch.
if (count($files) > 0) {
// I changed this to use array chunk & db_query for performance, see issue: https://www.drupal.org/node/2637028
// I changed this to use array chunk & db_query for performance
// see issue: https://www.drupal.org/node/2637028
$files_chunk = array_chunk($files, (count($files) / 4), TRUE);
foreach ($files_chunk as $filez) {
$query = "SELECT 'path' FROM {unmanaged_files} WHERE 'path' IN (:files)";
......@@ -211,7 +212,9 @@ function fancy_file_delete_unmanaged_get_chosen_dirs() {
$all_dirs = fancy_file_delete_unmanaged_get_directories();
$chosen_dirs = variable_get('fancy_file_delete_unmanaged_chosen_dirs', FALSE);
if ($chosen_dirs === FALSE) {
return $all_dirs;
// Return only public on first pass for performance.
// see issue: https://www.drupal.org/node/2637028
return array('public://');
}
else {
// Only include directories that currently exist.
......@@ -267,7 +270,8 @@ function fancy_file_delete_unmanaged_get_files(array $paths) {
$db_check = array();
// All the files in the file_managed table
// I changed this to use db_query for performance, see issue: https://www.drupal.org/node/2637028
// I changed this to use db_query for performance.
// see issue: https://www.drupal.org/node/2637028
$query = db_query('SELECT uri FROM {file_managed}');
// Set this to a numeric keyed array so we can check this easier.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment