Archive

Posts Tagged ‘php’

BackUpWordPress plugin produces tarballs containing duplicates

July 18th, 2010 RaftaMan No comments

I’m using BackUpWordPress to do regular database and file tree backups of this blog. Unfortunately, there is a nasty bug in this plugin which may cause the tarball to contain every backuped file multiple times (to be precise, every file except the first one will go into the tarball exactly three times).

The problem is that the . and .. directories may appear in a somewhat random order and not necessarily as the first entries in a directory. This is probably host specific (I encountered this error for the first time after I relocated this blog to another server).

To fix BackUpWordPress v0.4.5, locate line 103 in Directory.php (resides in wp-content/plugins/backupwordpress/Archive/Reader/) and change the while-loop inside the next() function

...
        while ($this->source === null ||
              ($error = $this->source->next()) !== true) {
...

like this

...
        $file = null;
        while ($this->source === null ||
              $file == '.' || $file == '..' ||
              ($error = $this->source->next()) !== true) {
...

Alternatively, you can use the following patch:

--- Directory.php.orig	2010-07-17 15:02:56.093238736 +0200
+++ Directory.php	2010-07-17 15:04:10.367237641 +0200
@@ -103,0 +104 @@
+        $file = null; 

@@ -104,0 +106 @@
+              $file == '.' || $file == '..' || 

Resources:
http://pear.php.net/bugs/bug.php?id=6546

Categories: Uncategorized Tags: ,

WordPress myStat plugin breaks rss feed

May 11th, 2010 RaftaMan No comments

I recently installed myStat to keep track of this blog’s rapidly increasing number of readers. Unfortunately, the plugin break the rss feed. The problem is the plugin’s myStat_footer() function, which does not check if the page is a feed before deciding to insert the myStat footer image into the page code.

To fix myStat v2.6, locate line 475 in mystat.php and change the myStat_footer() function

function myStat_footer() {
    global $cmn;
    if($cmn->getParam("myStat_debug")==1){$cmn->setDebug('FOOTER LOAD');};
    echo "<img style=(...);
}

like this

function myStat_footer() {
    global $cmn;
    if($cmn->getParam("myStat_debug")==1){$cmn->setDebug('FOOTER LOAD');};
    if (!is_feed()) {
        echo "<img style=(...);
    }
}

Resources:
http://wordpress.org/support/topic/325426

Categories: Uncategorized Tags: ,