Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • I kept track of Apache’s status using an apache-status page and noted the following:

    With 1 save, wp-cron.php is spawned twice, with two http requests that are persistent for over 30 seconds.

    With 2 saves, wp-cron.php is spawned eight times, but the requests are equally persistent as with 1 save.

    I am not sure, but I think this is due to the fact, that the WordPress installations call do_pings on every post save. This is a “core” feature, not a plugin-based one.

    Hey, I got a solution that worked for me. In order to do that you have to modify a couple of files.

    First, open your config file (wp-config.php), and a line like this;

    define ('DISABLE_CACHE', '1');

    It has to be before the require_once call!

    Generally, this would turn the cache off. However, there are two small bugs that prevent this feature for working. In order to fix them, open your wp-includes/cache.php file. Find the wp_cache_replace and the wp_cache_set functions. Those are the ones that cause the trouble, and that’s because of the serialize|unserialize calls. We have disabled the caching, but nevertheless those functions are not aware of it, because the serialize|unserialize calls are executed before it. So, here’s the patch: add the following line:

    function wp_cache_set($key, $data, $flag = '', $expire = 0) {
    
    	if (defined('DISABLE_CACHE'))
    		return;
    
    	if ( ! defined('ENABLE_CACHE') )
    		return;
    
    	global $wp_object_cache;
    
    	$data = unserialize(serialize($data));
    
    	return $wp_object_cache->set($key, $data, $flag, $expire);
    }

    That’s it. Remember to do this to both functions wp_cache_replace and the wp_cache_set

    Thread Starter ktsvetkov

    (@mrasnika)

    I took a look at the source code. IMHO it’s a crappy one – it is good that the plugin authors strive to do OO PHP code , but I think this is too much – this is a lot of overkill. The plugin itself is 139KB! This means I have to load this fat pig every time a page load is required. Why are all the images stuffed inside the PHP code as inlines ? Can you just put them in the same folder as the plugin – this will make the php code a lot lighter, the PHP engine will take less time to parse it, and everything will be quicker! The OO code is just ridiculous – I see a lot of useless stuff there. And the whole approach is wrong IMHO — why do you accumulate the sitemap to a string in the memory ? Isn’t it better to write it directly to a file leaving the memory free ??? The only issue here is file-locking/file-sharing, but there is a workaround for this using temporary files – look how Smarty creates its compiled version of the plugins — does it stuff all the code in the memory: NO, it writes them to a temporary file, and upon completing the job, it renames them to the required filename.

    I hope you will recognize all my ideas on optimizing this plugin, and you will try to implement them in the next release. Otherwise I will have to do my own plugin ??

Viewing 3 replies - 1 through 3 (of 3 total)