Open hirasso opened 2 years ago
I found the problem! I am testing wp-super-cache on a local (MAMP) install, with SSL enabled. I went through the source code in wp-cache.php
and temporarily added inline debugging to this line:
$response = wp_remote_get( $url, array('timeout' => 60, 'blocking' => true ) );
var_dump($response);
Turns out that on my local machine, wp_remote_get
returned a WP_Error
:
object(WP_Error)#797 (3) {
["errors"]=>
array(1) {
["http_request_failed"]=>
array(1) {
[0]=>
string(78) "cURL error 60: SSL certificate problem: unable to get local issuer certificate"
}
}
["error_data"]=>
array(0) {
}
["additional_data":protected]=>
array(0) {
}
}
...so it never finished the request and thus never could create a cache file, either. I think a failing like this isn't being reflected in the wpsc debug log right now, right? I'm sure it would had helped me a lot. I could imagine something like this:
$response = wp_remote_get( $url, array('timeout' => 60, 'blocking' => true ) );
if( !is_wp_error($response) ) {
wp_cache_debug( "wp_cron_preload_cache: fetched $url", 5 );
} else {
wp_cache_debug( "wp_cron_preload_cache: error fetching $url", 5 );
}
Glad you debugged that. Good idea on checking wp_remote_get!
I have activated 'Preload Mode' on one of my sites. Using the plugin WP Control, I started the cron job immediately and looked at my file system. Looking at my
wp-content
folder, I am seeing two files being created:preload_permalink.txt
andpreload_mutex.tmp
. Insidepreload_permalink.txt
, I see the plugin counting up a number, followed by the related permalink that is being preloaded.But if I look at my
supercache
folder, I don't see any pages being created. Am I understanding preloading wrong? My config:As a note: If I navigate to one of my pages in the frontend, supercache files are bing created just fine.