Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Clear/Purge/Wipe #351

Merged
merged 38 commits into from
Oct 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
79566c9
Merge branch 'feature/279' into 000000-dev
Sep 30, 2014
04bbd96
Adding `clear_files_from_host_cache_dir` and `purge_files_from_host_c…
Sep 30, 2014
fb34e99
Merge branch '000000-dev' into feature/288
Oct 8, 2014
1ca5842
Completed work on `str_replace_once()`, `str_ireplace_once()`, `clear…
Oct 8, 2014
c392130
Refactor `auto_purge_user_cache()`. See: websharks/quick-cache#288
Oct 8, 2014
4e1bd95
For integers in `$counters` used for translation utilities. See: webs…
Oct 8, 2014
4e024a2
Refactor `auto_purge_post_terms_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
60c1eb8
Refactor `auto_purge_post_terms_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
d299d95
Refactor `auto_purge_author_page_cache()`. See: websharks/quick-cache…
Oct 9, 2014
5616efa
Refactor `auto_purge_author_page_cache()`. See: websharks/quick-cache…
Oct 9, 2014
6223e76
Refactor `auto_purge_custom_post_type_archive_cache()`. See: webshark…
Oct 9, 2014
da18636
Refactor `auto_purge_posts_page_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
7632af6
Refactor `auto_purge_home_page_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
cbb8772
Refactor `delete_files_from_host_cache_dir()`. See: websharks/quick-c…
Oct 9, 2014
9912d44
Refactor `auto_purge_xml_sitemaps_cache()`. See: websharks/quick-cach…
Oct 9, 2014
be2ce59
Refactor `build_host_cache_path_regex()`. See: websharks/quick-cache#288
Oct 9, 2014
1232b5e
Refactor `auto_purge_user_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
79f1d1e
Refactor i18n `files_`, `dirs_` utilities. See: websharks/quick-cache…
Oct 9, 2014
7d67aae
Refactor i18n `files_`, `dirs_` utilities. See: websharks/quick-cache…
Oct 9, 2014
549f9a0
Refactor `auto_purge_post_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
a3738e1
Refactor `auto_clear_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
cd40c75
Refactor `auto_wipe_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
6c965ea
Refactor `clear_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
327e42a
Refactor `purge_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
62044ac
Refactor `wipe_htmlc_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
7bb3525
Refactor `wipe_cache()`. See: websharks/quick-cache#288
Oct 9, 2014
27fc0c9
Enhance security in `delete_all_files_dirs_in()`. See: websharks/quic…
Oct 9, 2014
cf7e6a2
Begin refactoring `auto_purge_xml_feeds_cache()`. See: websharks/quic…
Oct 9, 2014
642da35
Continue refactoring `auto_purge_xml_feeds_cache()`. See: websharks/q…
Oct 9, 2014
a28ed55
Continue refactoring `auto_purge_xml_feeds_cache()`. See: websharks/q…
Oct 9, 2014
556ce7d
Refactor cache path utilities. See: websharks/quick-cache#288
Oct 9, 2014
a9c8c18
Refactor cache clear/purge/delete utilities. See: websharks/quick-cac…
Oct 9, 2014
bdc28ed
Rename `cache_purge_*` to `cache_clear_*`. See: websharks/quick-cache…
Oct 9, 2014
0ec59cd
Update UI, `purge` = `clear` now. See: websharks/quick-cache#288
Oct 10, 2014
a69bea2
Update UI, `purge` = `clear` now. See: websharks/quick-cache#288
Oct 10, 2014
41d8331
Adding `name` and `short_name` properties. See: websharks/quick-cache…
Oct 10, 2014
caebf6d
Final tweaks to cache/purge refactoring. See: websharks/quick-cache#288
Oct 10, 2014
d8675f8
For clarity, "clearing" ALL files should delete directories too. This…
Oct 10, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions quick-cache/includes/actions.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
// @TODO Add docBlocks to this class.

namespace quick_cache // Root namespace.
{
if(!defined('WPINC')) // MUST have WordPress.
Expand Down
11 changes: 5 additions & 6 deletions quick-cache/includes/advanced-cache.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -675,13 +675,13 @@ public function maybe_start_output_buffering()
if(!QUICK_CACHE_FEEDS_ENABLE && $this->is_feed())
return $this->maybe_set_debug_info($this::NC_DEBUG_FEED_REQUEST);

if(preg_match('/\/(?:wp\-[^\/]+|xmlrpc)\.php(?:[?]|$)/', $_SERVER['REQUEST_URI']))
if(preg_match('/\/(?:wp\-[^\/]+|xmlrpc)\.php(?:[?]|$)/i', $_SERVER['REQUEST_URI']))
return $this->maybe_set_debug_info($this::NC_DEBUG_WP_SYSTEMATICS);

if(is_admin() || preg_match('/\/wp-admin(?:[\/?]|$)/', $_SERVER['REQUEST_URI']))
if(is_admin() || preg_match('/\/wp-admin(?:[\/?]|$)/i', $_SERVER['REQUEST_URI']))
return $this->maybe_set_debug_info($this::NC_DEBUG_WP_ADMIN);

if(is_multisite() && preg_match('/\/files(?:[\/?]|$)/', $_SERVER['REQUEST_URI']))
if(is_multisite() && preg_match('/\/files(?:[\/?]|$)/i', $_SERVER['REQUEST_URI']))
return $this->maybe_set_debug_info($this::NC_DEBUG_MS_FILES);

if($this->is_like_user_logged_in()) // Commenters, password-protected access, or actually logged-in.
Expand Down Expand Up @@ -879,7 +879,7 @@ public function output_buffer_callback_handler($buffer, $phase)
if($this->is_404 && !QUICK_CACHE_CACHE_404_REQUESTS) // Not caching 404 errors.
return (boolean)$this->maybe_set_debug_info($this::NC_DEBUG_404_REQUEST);

if(strpos($cache, '<body id="error-page">') !== FALSE) // A WordPress-generated {@link \wp_die()} error?
if(stripos($cache, '<body id="error-page">') !== FALSE) // A WordPress-generated error?
return (boolean)$this->maybe_set_debug_info($this::NC_DEBUG_WP_ERROR_PAGE);

if(!$this->function_is_possible('http_response_code')) // Unable to reliably detect HTTP status code?
Expand Down Expand Up @@ -910,7 +910,7 @@ public function output_buffer_callback_handler($buffer, $phase)

# This is where a new 404 request might be detected for the first time; and where the 404 error file already exists in this case.

$cache_file_tmp = $this->cache_file.'.'.uniqid('', TRUE).'.tmp'; // Cache/symlink creation is atomic; e.g. tmp file w/ rename.
$cache_file_tmp = $this->add_tmp_suffix($this->cache_file); // Cache/symlink creation is atomic; e.g. tmp file w/ rename.

if($this->is_404 && is_file($this->cache_file_404))
if(!(symlink($this->cache_file_404, $cache_file_tmp) && rename($cache_file_tmp, $this->cache_file)))
Expand All @@ -927,7 +927,6 @@ public function output_buffer_callback_handler($buffer, $phase)
($this->is_404) ? '404 [error document]' : $this->salt_location, $total_time, date('M jS, Y @ g:i a T'))).' -->';
$cache .= "\n".'<!-- '.htmlspecialchars(sprintf(__('This Quick Cache file will auto-expire (and be rebuilt) on: %1$s (based on your configured expiration time).', $this->text_domain), date('M jS, Y @ g:i a T', strtotime('+'.QUICK_CACHE_MAX_AGE)))).' -->';
}

/*
* This is NOT a 404, or it is 404 and the 404 cache file doesn't yet exist (so we need to create it).
*/
Expand Down
83 changes: 42 additions & 41 deletions quick-cache/includes/menu-pages.php

Large diffs are not rendered by default.

Loading