WPMU Command Line Installer/Updater

Hey folks,

I’m working on a project for personal use that I think would be useful to others. The basic idea is a CLI interface for installing WPMU and custom plugins, and then upgrading WPMU. Since so many plugins on this site live outside of the wp-content directory, I started to worry that upgrades would be a real pain, so I’m writing a little script that copies/symlinks everything each time you install a new version. Here’s an example:

$ php ip.php

Action [help]: install

Customizations Directory [/home/wpmusite/src/custom]:

WPMU Version Number [2.7.1]:

WPMU Source Directory [/home/wpmusite/src/wpmu-2.7.1]:

Install Directory [/home/wpmusite/live-2.7.1]:

Document Root [/home/wpmusite/public_html]: /home/wpmusite/www

Install? [no]: yes

Creating install directory... done.

Moving source files... done.

Symlinking custom files...

/home/wpmusite/src/custom/.htaccess... done.

/home/wpmusite/src/custom/wp-config.php... done.

/home/wpmusite/src/custom/wp-content/mu-plugins/myplugin.php... done.

Ready to make live? [no]: yes

Unlinking old document root... done.

Symlinking /home/wpmusite/www to /home/wpmusite/live-2.7.1... done.

Install complete!

Above is the current output of my version. My directory structure is something like:

/home/wpmusite/www (symlink to current install)

/home/wpmusite/live-2.7.1 (current install)

/home/wpmusite/src/custom/ (all my customizations — mirrors wpmu root directory, so for example /home/wpmusite/src/custom/wp-config.php will get symlinked to /home/wpmusite/www/wp-config.php)

/home/wpmusite/src/wpmu-2.7.1 (wpmu source)

Any comments/suggestions are welcome. When it’s working I’ll post the source here. Also, I haven’t started working on the upgrade side, so any thoughts would be helpful.

Cheers,

Chris

  • Chris M.
    • Site Builder, Child of Zeus

    Oh, the above can be automated with:

    php ip.php --action=install --customdir=/home/wpmusite/src/custom --sourcedir=/home/wpmusite/src/wpmu-2.7.1 --destdir=/home/wpmusite/live-2.7.1 --docroot=/home/wpmusite/www --force

    I’ve also added an environment option so that you can have /home/wpmusite/src/custom/development and /home/wpmusite/src/custom/production etc.

  • drmike
    • DEV MAN’s Mascot

    We just use a private SVN server and a script that goes around to the client directories and runs a ‘svn up’ from where ever their files are installed from. We have to run the script from each box but it’s a lot quicker than manual installs and this makes sure everybody is on the most up to date version that we can offer them. We’ve added in additional security measures and features for many of the platforms we offer folks.

  • Chris M.
    • Site Builder, Child of Zeus

    Even if you only have one repository, it seems like since custom files aren’t all neatly inside the wp-content directory upgrades will be a pain. This way your upgrade will just involve grabbing the new WPMU source and then relinking all the custom files (via the script).

  • Barry
    • DEV MAN’s Mascot

    Yeah, I just tend to svn up or svn sw /newtagpath . It doesn’t touch the wp-config.php because that isn’t in the repository anyway, and doesn’t touch any of my plugin, theme or custom files, but then I don’t want them upgraded at the same time any way.

    Seems like a lot of work for little gain, unless I’m missing something.