WordPress.org

Ready to get started?Download WordPress

Forums

Transient Cleaner
[resolved] Trigger Action & Network Usage (16 posts)

  1. G
    Member
    Posted 1 year ago #

    hi dartiss, good on you mate, for making this plugin - excessive transients in database have always bothered me.

    i have 2 questions before trying it.

    1. is there a way to trigger the action of the plugin immediately, to see its effect?
    then if a problem occurs, i may restore the db.

    2. on a wp network, i assume it will work if installed on each blog seperately?

    thankyou, G.

    http://wordpress.org/extend/plugins/artiss-transient-cleaner/

  2. dartiss
    Member
    Posted 1 year ago #

    Hi,

    1.Yes. The plugin hooks into the daily housekeeping which can be activated using do_action( 'wp_scheduled_delete' ).

    2. Yes.

    David.

  3. G
    Member
    Posted 1 year ago #

    Hi dartiss, I installed and tried to activate function by inserting php code you gave into a file and running it - no joy, all transients still appear in db.

  4. dartiss
    Member
    Posted 1 year ago #

    I'm assuming you added it to WordPress theme file?

    I've not tried that code myself, but was suggested by a WP developer. If it doesn't work I'll try and work out a way to force just my plugin to run.

    David.

  5. G
    Member
    Posted 1 year ago #

    I put the code (with php tag) in a file called trans.php
    then ran it from a browser, tried from:
    /wp-content/plugins/trans.php
    and
    /trans.php

    nothing changed.

    You said: "I'll try and work out a way to force just my plugin to run."

    I think that would be a good idea, to make it run immediately upon activation.
    This would allow admin to see the effects of the plugin's action, and if there is a problem, can reverse any damage right away.

  6. dartiss
    Member
    Posted 1 year ago #

    No, it needs to be in one of your theme files, otherwise it won't recognise the WordPress components.

    Good idea about the immediate run upon activation - I'll add that in for the next release (should be in the next week or so).

    David.

  7. dartiss
    Member
    Posted 1 year ago #

    The new version has been released (1.1) and will automatically trigger a "clean" when activated.

    David.

  8. G
    Member
    Posted 1 year ago #

    It didn't do anything on mine (all transients remain), activated or network-activated.

  9. dartiss
    Member
    Posted 1 year ago #

    Sorry about that. Having looked at multi-site installations further I can see there may be issues, but I'm going to need to look at it at a lot further (e.g. I don't know if the triggered overnight housekeeping job is run per blog or per installation).

    I'm going to set up a multi-site test blog for myself and have a play further.

    David.

  10. G
    Member
    Posted 1 year ago #

    Thanks for your efforts. Looking forward to it.

  11. dartiss
    Member
    Posted 1 year ago #

    Hi G,

    Okay, I've built myself an MU version of WordPress and have both tested my plugin and looked at some of the WP core code to see how it handles MU in these circumstances.

    My conclusion is that I believe it DOES work happily with MU set-ups.

    There are 2 things to consider here...

    1. It doesn't clear down all transients unless a database update has occurred - the daily run (and the run it does upon activation) only clears down expired transients, and only those left behind (many expired transients are cleared). Therefore it's possible you didn't see any activity because there was nothing to delete.
    2. In an MU set-up each blog has its own options table - each one is cleared when it activated the daily housekeeping (or when the plugin is activated). This is not done at a site level, but per-blog. When my plugin runs, WordPress simply tells if which options table to clear (depending on which blog its running under).

    I hope this makes sense to you. As I say, I can't see an issue but am open to being convinced otherwise!

    David.

  12. G
    Member
    Posted 1 year ago #

    Thankyou David.

    The problem is in my mind at the moment, as I always exercise due caution when installing plugins - this one is difficult as I can't see it working. When installing plugins, I follow this approach to keep safe:

    1. Download plugin and look at code, to make sure it looks ok and no hidden gremlins.
    2. Backup database (files too, if plugin modifies files)
    3. Install plugin
    4. Do Settings for plugin (if avail)
    5. Check its working, and test all functions and output are good.
    6. Check error_log to make sure its not throwing errors behind the scenes (some plugins look to work fine, but throw errors and may cause unknown problems)
    7. If all is well, I keep the plugin and enjoy, if no, I delete it and restore the database

    So you see from the above, why its difficult for me to install and forget - because I may wake up later to find my sites have disappeared or something. I am not happy leaving a plugin active whose actions are not seen and untested.

    You say: "It doesn't clear down all transients unless a database update has occurred..."

    Can you tell me how to get this "database update" to occur, so I can SEE the immediate results?

  13. dartiss
    Member
    Posted 1 year ago #

    Transients are used for good reasons, hence why deleting them all ad-hoc is not a good idea.

    A database upgrade sometimes occurs after a WordPress update - if the format of the WordPress database has changed. It therefore makes sense to clear down the transients in case they cause any issues as a result. However, just to check out the plugins functionality, I wouldn't recommend it.

    I run the plugin on my live site - artiss.co.uk - and am happy to do so. Sometimes you're just not going to be able to test all the functionality of the plugin up-front and this is one such case. If as a result you can't trust it, then please uninstall it.

    David.

  14. Clifford Paulick
    Member
    Posted 1 year ago #

    Came looking for multisite compatibility. Skimming through here it seems running this per blog (i.e. activating per blog) makes it work per blog. Does this include network activation? If I network activate it, does it still run for all sub-sites at that single activation action?

    Do I also have to add do_action( 'wp_scheduled_delete' ); to all themes' functions.php to be used on the network?

    Thank you.

  15. dartiss
    Member
    Posted 1 year ago #

    No, you don't need to add anything - the housekeeping job that this plugin uses runs individually for each blog.

    David.

  16. Clifford Paulick
    Member
    Posted 1 year ago #

    :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.