Maybe a bug when using $protocol
-
Hi, donncha,
When using https at admin panel but http at front, the related post page supercache file could not be refreshed properly. I ran some tests and found the problem.
After replying or approving a comment, the related post page should be re-supercached. But it’s not. And here is the related log with highlighted text:
09:23:21 /wp-admin/admin-ajax.php Post 1932 changed. Update cache. 09:23:21 /wp-admin/admin-ajax.php get_current_url_supercache_dir: warning! site_url (<strong>https://cnzhx.net</strong>) not found in permalink (<strong>https://cnzhx.net</strong>/blog/upgrade-to-wp30-multisite-subdirectory/). 09:23:21 /wp-admin/admin-ajax.php get_current_url_supercache_dir: <strong>Removing SERVER_NAME (cnzhx.net) and https:// from permalink (https://cnzhx.net/blog/upgrade-to-wp30-multisite-subdirectory/). Is the url right?</strong> 09:23:21 /wp-admin/admin-ajax.php <strong>supercache dir: /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.nethttps://blog/upgrade-to-wp30-multisite-subdirectory/</strong> 09:23:21 /wp-admin/admin-ajax.php wp_cache_post_id_gc post_id: 1932 https://cnzhx.net/blog/upgrade-to-wp30-multisite-subdirectory/ clearing cache in /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.nethttps://blog/upgrade-to-wp30-multisite-subdirectory/. 09:23:21 /wp-admin/admin-ajax.php wp_cache_post_id_gc clearing cache in /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.nethttps://blog/upgrade-to-wp30-multisite-subdirectory//page/. 09:23:21 /wp-admin/admin-ajax.php wp_cache_post_id_gc clearing cache in /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.net//page/. 09:23:21 /wp-admin/admin-ajax.php Post change: deleting cache files in /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.net/ 09:23:21 /wp-admin/admin-ajax.php prune_super_cache: wp_cache_rebuild_or_delete( /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.net/index.html ) 09:23:21 /wp-admin/admin-ajax.php rebuild_or_gc: rename to /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.net/index.html.needs-rebuild 09:23:21 /wp-admin/admin-ajax.php prune_super_cache: wp_cache_rebuild_or_delete( /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.net/index.html.gz ) 09:23:21 /wp-admin/admin-ajax.php rebuild_or_gc: rename to /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.net/index.html.gz.needs-rebuild 09:23:21 /wp-admin/admin-ajax.php wp_cache_post_edit: Clearing cache for post 1932 on post edit. 09:23:21 /wp-admin/admin-ajax.php wp_cache_post_change: Already processed post 1932. 09:23:21 /wp-admin/admin-ajax.php wp_cache_post_change: Already processed post 1932.
I looked into the source file
wp-cache-phase1.php
and changed line 524
$uri = str_replace( $WPSC_HTTP_HOST, '', $permalink );
to$uri = str_replace( 'https://', '', $uri ); $uri = str_replace( 'https://', '', $uri );
then tested it. Here is the new log:
11:35:48 /wp-admin/admin-ajax.php Post 6658 changed. Update cache. 11:35:48 /wp-admin/admin-ajax.php get_current_url_supercache_dir: warning! site_url (https://cnzhx.net) not found in permalink (https://cnzhx.net/blog/restrict-baidu-index-with-robots_txt/). 11:35:48 /wp-admin/admin-ajax.php get_current_url_supercache_dir: Removing SERVER_NAME (cnzhx.net) and https:// from permalink (https://cnzhx.net/blog/restrict-baidu-index-with-robots_txt/). Is the url right? 11:35:48 /wp-admin/admin-ajax.php supercache dir: /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.net/blog/restrict-baidu-index-with-robots_txt/ 11:35:48 /wp-admin/admin-ajax.php wp_cache_post_id_gc post_id: 6658 https://cnzhx.net/blog/restrict-baidu-index-with-robots_txt/ clearing cache in /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.net/blog/restrict-baidu-index-with-robots_txt/. 11:35:48 /wp-admin/admin-ajax.php prune_super_cache: wp_cache_rebuild_or_delete( /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.net/blog/restrict-baidu-index-with-robots_txt/index.html )
Because the snippet is order to retrieve the supercache dir, I think it’s ugly but not wrong to do it this way.
BTW, you maybe notice that the sub-page url of home page is not right, such as
prune_super_cache: deleted /srv/www/cnzhx.net/public_html/wp-content/cache/supercache/cnzhx.net//page/3/index.html
. I’m using muiltisite mode and the proper url iscnzhx.net/blog/page/3/index.html
.Please look into it and make an update for this. Thank you!
- The topic ‘Maybe a bug when using $protocol’ is closed to new replies.