WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: WP Super Cache] Cannot delete cache folder after uninstall (25 posts)

  1. Dr C
    Member
    Posted 6 years ago #

    I installed WP-Super-Cache but couldn't get it to work. I had the same problem with the Mod Rewrite as here. Anyway, I figure WP-Cache will be enough for my needs. So I set about uninstalling. All went fine but I cannot remove the cache folder. I chmod it to 777 but permission is denied - the owner/group is httpd and this might be the problem. I had the same problem with the advanced-cache.php (folder-looking file) but moving it into another folder and then deleting that folder (of which I was the owner/group) worked. This approach does not work with the cache folder since I do not have permission to move it. I even backed up my wp-content folder, without the rogue cache folder, and tried to delete the wp-content folder on the server. Of course everything else deleted except the cache folder!

    Any help on how I can remove this dang folder is much appreciated!

  2. simulationelson
    Member
    Posted 6 years ago #

    You said it! This is starting to bug me badly. Can we hear any reply from the author?

  3. Joshua Knowles
    Member
    Posted 6 years ago #

    BUMP

    I followed the directions for uninstalling, however, I can not delete the /wp-content/cache folder. What do I do?

  4. passegua
    Member
    Posted 6 years ago #

    Same problem: cannot delete or open advanced-cache.php

    please tell us how to uninstall wp-cache!

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Ask your host to restore the permissions on it for you. This sort of thing only happens on certain hosts.

  6. passegua
    Member
    Posted 6 years ago #

    the advanced-cache.php has 777 chmod, what should I ask for?
    If I try to delete or change permission:

    550 Could not change perms on advanced-cache.php: No such file or directory

    Moreover, what if it stuck again?

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    what should I ask for?

    Err... ask them to fix it? Seems obvious to me.

    Moreover, what if it stuck again?

    Then you ask them to fix it again.

  8. passegua
    Member
    Posted 6 years ago #

    Well I mean: couldn't I ask them to avoid this problem in the future so I shall be able to fix it by myself?

    I don't understand how is it possible I cannot delete a folder and "they" can.

    thanks

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Well I mean: couldn't I ask them to avoid this problem in the future so I shall be able to fix it by myself?

    You can try, sure. I doubt you'll have much success with that though. It's a matter of their main webserver configuration, it seems unlikely they're going to go to the large amount of trouble to fix what is really a rather minor issue if they have not done it already.

    I don't understand how is it possible I cannot delete a folder and "they" can.

    They know the root password. You do not. A root user can do anything.

  10. passegua
    Member
    Posted 6 years ago #

    all right, that's more than enough! many thanks, I am waiting them to fix that.
    I am not sure to try again installing a plugin with such an issue, at least in my own host provider case.

  11. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    It's not an issue with the plugin, it's an issue with the server itself. You don't own the files created by the webserver user, nor do you have permissions to modify them. The security is too strict, basically. There's ways around this issue, but they have to be explicitly set up in advance.

    Check some of your uploaded images that you've put there via the WordPress uploader. Bet you a nickel that you can't manually delete some of them either. :)

  12. passegua
    Member
    Posted 6 years ago #

    I tried some, I can delete them, anyhow you are right, the problem is on the server side :-(
    so I am afraid to install it again in order to avoid further headache.

  13. Dr C
    Member
    Posted 6 years ago #

    Thanks for the solution Otto. I had hoped that going through the host's tech support could be avoided but ah well...

    I agree with passegua on the issue being with WP Super Cache in a more global sense, since it is what created the problem folder in the first place. It's not that I don't completely and utterly respect Donncha O Caoimh's excellent work, but there surely must be a way that this folder can be created without having to revert to the host everytime it needs to be uninstalled?

  14. Donncha O Caoimh
    Member
    Posted 6 years ago #

    Dr C - you could clear the cache, and then write a short bit of code in a php file like this:
    rmdir( 'cache/supercache/' );
    rmdir( 'cache' );

    Put that file in the wp-content directory and call it directly. That'll remove the cache folder.

    I'll see if I can add that to the plugin.

  15. Dr C
    Member
    Posted 6 years ago #

    Thanks for replying Donncha. When I went back to apply your fix the permissions had been changed and I was able to delete it directly - I was not previously able to do this. Perhaps the host has changed something in the meanwhile?

    Anyway, thanks for you help. I presume that between Otta's and your fix this topic is now resolved?

  16. gofree
    Member
    Posted 6 years ago #

    I tried this

    rmdir( 'cache/supercache/' );
    rmdir( 'cache' );

    but when I open it, it just turn back the text
    rmdir( 'cache/supercache/' );
    rmdir( 'cache' );

    Any solution?

  17. Donncha O Caoimh
    Member
    Posted 6 years ago #

    Put opening and closing PHP tags at the top and bottom of that file. <?php and ?>

  18. Anonymous
    Unregistered
    Posted 5 years ago #

    put the code at which file and also location?
    I am cracking my head and i cant find the way to do it
    i would like to do a fresh installation....
    Please help!!!

  19. Donncha O Caoimh
    Member
    Posted 5 years ago #

    Put it into wp-content/t.php and then call http://yourhostname.tld/wp-content/t.php

    If you see an error, you may need to add this line at above the rmdir() commands:

    unlink( cache/.htaccess );

  20. arminbw
    Member
    Posted 5 years ago #

    It's not as simple as that. The supercache directory is full of subdirectories. In my case I had to use a recursive function:

    <?php
    function removeDir($dirname)
    {
        if (!file_exists($dirname)) {
            return false;
        }
        if (is_file($dirname)) {
     	echo ("deleting: " . $dirname . '<br />');
            return unlink($dirname);
        }
        $dir = dir($dirname);
        while (false !== $entry = $dir->read()) {
            if ($entry == '.' || $entry == '..') {
                continue;
            }
            echo ("deleting: " . $dirname . DIRECTORY_SEPARATOR . $entry . '<br />');
            removeDir($dirname . DIRECTORY_SEPARATOR . $entry);
        }
        $dir->close();
        return rmdir($dirname);
    }
    
    unlink("cache/.htaccess");
    removeDir("cache/meta");
    removeDir("cache/supercache");
    removeDir("cache");
    ?>

    Use at your own risk.

  21. Donncha O Caoimh
    Member
    Posted 5 years ago #

    arminbw - did you have to use that with the latest version of the plugin? The deactivate hook calls a function that clears the cache directory and does what your function above does.

  22. arminbw
    Member
    Posted 5 years ago #

    Yes, I used the latest version. But generally the plugin didn't work for me very well. Edited posts didn't get updated and the supercache folder only contained empty subdirectories.

    I will try to install the plugin on another server, where I have root access, so I can investigate this a bit..

  23. Senky
    Member
    Posted 5 years ago #

    arminbw's PHP code is realy function, I used it and it deleted all this directories and files.

    (arminbw - Thanks :-) )

  24. csschris
    Member
    Posted 5 years ago #

    I was able to delete advanced-cache.php by creating a new directory, moving the advanced-cache.php into it and deleting it.

  25. psionmark
    Member
    Posted 5 years ago #

    I had a similar problem removing the files. Moving the entire directory to another directory allowed me to then delete it.

    Mark

Topic Closed

This topic has been closed to new replies.

About this Topic