Automatic plugin/theme installation and updating without access to Dashboard …

This is really a general question.

I am managing a number of WP installations – separate installations not multisites under different users, different databases, different prefixes etc. on a Ubuntu 10.04 platfrom. Each has a different set of (mainly WPMUDEV) plugins and themes. I have full shell access (ie as root, www-data or whatever is necessary) to all trees.

Clearly if I copy a new plugin or theme into the plugins or themes directory under wp-content and correct the ownership/group access, that plugin or theme immediately becomes visible as a deactivated item.

I have two questions:

1) How to install the plugin/theme and automatically activate it. Is there a way of using the WP installation from a shell?

2) How to update the plugin/theme in a similar way?

  • DavidM
    • DEV MAN’s Mascot

    Hi Loggy,

    I’ve never heard of a way to achieve precisely that myself. It really is clever and it would be great to be able to update like that.

    I’ll ask a few of the knowledgeable folks around here if they’ve got any ideas.

    Cheers,

    David

  • Loggy
    • Design Lord, Child of Thor

    David

    Thanks for this your response. Both these activities must be initialised by WordPress itself so it is a small(!) matter of working out how and where and writing a routine to call this with the appropriate arguments.

    I’m surprised how many CMS’s assume everything is done from a web page on a one-by-one basis in fact – I couldn’t see how to do it in Drupal or Joomla either although I am not as familiar with them as with WP. Handling things this way, checking which plugins/themes are installed (the user may of course install their own, remove them, update or download their own) would make maintenance so much easier.

    I realise that MU does half the job – they would still need activating – but I don’t want to use MU unless it is necessary and appropriate. I prefer the sites to be independent as that is less of a risk should something go wrong.

    Of course there is also updating WP itself to add…

  • Philip John
    • DEV MAN’s Apprentice

    Hiya,

    I believe this would be possible but you’d need a PHP script that loads wp-blog-header.php (I think) that you would then pass an argument to on the command line which would tell it the plugin to activate and that would trigger WP’s normal activation script.

    Can’t promise anything though!

    Phil

  • Loggy
    • Design Lord, Child of Thor

    Phil

    Thanks for the clue. It’s a bit deeper than that I think as wp-blog-header.php only has a couple of require’s in it. There is a file update.php which contains some interesting stuff about how often checks are made. Some grepping later highlights various files and functions that could be of use. I will carry on investigating but all clues gratefully received!