[wp-hackers] Accessing wp classes/functions from command line for upgrades

Josh Eaton jage32 at gmail.com
Fri Jul 8 12:58:56 UTC 2011

Thanks Dion. I'll take a look.

On Fri, Jul 8, 2011 at 12:49 AM, Dion Hulse (dd32) <wordpress at dd32.id.au> wrote:
> You might be interested in this SSH Update layer:
> http://phpseclib.sourceforge.net/wordpress.htm
> WordPress has built-in support for the PHP SSH extension, but it requires it
> to becompiled manually, that library & plugin will allow it to be done in
> pure PHP.
> I havn't tested the plugin, and have a few suggestions for the code as it
> currently is, but it's a option for you
> On 8 July 2011 09:25, Josh Eaton <jage32 at gmail.com> wrote:
>> My host has file permission limitations that make plugin
>> installs/upgrades and core upgrades very difficult. I have to do it
>> all from ssh. I upgrade core using SVN, which works great for me, but
>> since I maintain 6-7 sites at this same host, plugin upgrades become
>> quite time-consuming. I end up having to do this:
>> cd /home/public/blog/wp-content/plugins
>> wget
>> http://downloads.wordpress.org/plugin/google-analytics-for-wordpress.4.0.13.zip
>> rm -rf google-analytics-for-wordpress
>> unzip google-analytics-for-wordpress.4.0.13.zip
>> For each plugin I have installed, and then repeat 6-7 times for each
>> site. I planned to write a bash script to accomplish this via ssh, or
>> a php script to run from the command line, but before I went through
>> the effort, I briefly browsed through core to see if I could re-use
>> any of the upgrade components  (e.g. WP_Upgrader class).
>> As a quick test, I dropped the following script into my blog root, and
>> ran it from ssh using 'php script.php'
>> define('WP_USE_THEMES', false);
>> require('./wp-blog-header.php');
>> include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
>> $upgrader = new Plugin_Upgrader();
>> $upgrader->upgrade('core-control');
>> I get the following error: "Fatal error: Call to undefined function
>> screen_icon() in
>> /home/public/blog/wp-admin/includes/class-wp-upgrader.php on line
>> 960". I am assuming that since I'm not using themes from the command
>> line, that all of the UI code in this class may not work correctly.
>> So my questions:
>> 1. Is there an easy way for me to call this class or other core code
>> to accomplish this? (maybe subclass the Plugin_Upgrader class and
>> remove the UI code?)
>> 2. Am I setting up the script correctly to run from the command line?
>> 3. Is this a stupid idea, and I should just write my own php/ssh
>> script to handle it?
>> Thanks!
>> Josh Eaton
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list