Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fancy_file_delete
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
fancy_file_delete
Commits
57d271aa
Commit
57d271aa
authored
Dec 18, 2015
by
John Ouellet
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2637028
Redo some chosen directories for performance + add an update
parent
fb8313cf
Branches
Branches containing commit
Tags
7.x-1.0-beta9
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
fancy_file_delete.install
+11
-0
11 additions, 0 deletions
fancy_file_delete.install
fancy_file_delete.module
+7
-3
7 additions, 3 deletions
fancy_file_delete.module
with
18 additions
and
3 deletions
fancy_file_delete.install
+
11
−
0
View file @
57d271aa
...
...
@@ -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
();
}
This diff is collapsed.
Click to expand it.
fancy_file_delete.module
+
7
−
3
View file @
57d271aa
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment