Remove most calls to get_all_supercache_filenames() #176

Merged
merged 11 commits into from Feb 9, 2017

Projects

None yet

1 participant

@donnchawp
Contributor

get_all_supercache_filenames() is used to get a list of index.html type
files for deleting. There are a number of duplicate foreach() loops in
wp-cache-phase2.php that should be rolled into one function.
This patch adds wpsc_delete_files() which takes a directory and deletes
any files in that directory. This goes beyond what the foreach() loops
did but also checks that the directory is in the cache directory so
should be safe to use.
It should make it easier to cache different types of pages and maintain
them using this function.

donnchawp added some commits Feb 1, 2017
@donnchawp donnchawp Remove most calls to get_all_supercache_filenames()
get_all_supercache_filenames() is used to get a list of index.html type
files for deleting. There are a number of duplicate foreach() loops in
wp-cache-phase2.php that should be rolled into one function.
This patch adds wpsc_delete_files() which takes a directory and deletes
any files in that directory. This goes beyond what the foreach() loops
did but also checks that the directory is in the cache directory so
should be safe to use.
It should make it easier to cache different types of pages and maintain
them using this function.
7fbb358
@donnchawp donnchawp Protect more directories and don't delete .htaccess files e842ba5
@donnchawp donnchawp Remove all the files in the supercache directory when deleted.
This removes all files in a particular supercache directory when deleted
from the settings page, rather than just the index.html types files.
11dbc4a
@donnchawp donnchawp Apply realpath() to all paths because of Windows paths
Windows changes / to \ when paths go through realpath() so we need to
apply realpath to all paths when there's a comparison.
9ed100f
@donnchawp donnchawp Fix conflicting line of code. aa837fa
@donnchawp donnchawp Replace another foreach loop with the delete files function 797b1d9
@donnchawp donnchawp Make sure we rebuild files inside the cache directory 22d5e28
@donnchawp donnchawp Added simple comment describing the delete function 21776fe
@donnchawp donnchawp Added function wpsc_rebuild_files()
This function will respect the rebuild setting in the function.

The delete function will now also remove the directory after deleting
all the files in the directory.
a740bfe
@donnchawp donnchawp Minor edit: fixed missing ";" b1efa0d
@donnchawp donnchawp Merge branch 'master' into wpsc_delete_files 67e87cc
@donnchawp donnchawp merged commit 41d582b into master Feb 9, 2017
@donnchawp donnchawp deleted the wpsc_delete_files branch Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment