Installing new plugins

The basic switch to install the latest version of a new plugin is –install with –latest.

e.g.

wordshell mysite contact-form-7 --install --latest

By default, WordShell will not activate the plugin. This is because there may be setup options you need to add; so you may need to visit the administration console. However, some plugins do not need any setup (or the default setup is fine). To activate the plugin at the same time as installing it, add –activate:

wordshell mysite contact-form-7 --install --activate --latest

The order of the parameter switches does not matter; “–install –activate –latest” means just the same as “–latest –install –activate” and all other combinations.

You can also install and activate in two separate steps if you prefer:

wordshell mysite contact-form-7 --install --latest
wordshell mysite contact-form-7 --activate

Always with WordShell, you specify the plugin’s “slug”. That means things like: akismet, nextgen-gallery, contact-form-7. If you are viewing the WordPress plugin directory at http://wordpress.org/extend/plugins, and if you find a plugin at a URL like http://wordpress.org/extend/plugins/example-plugin, then the corresponding “slug” is example-plugin (i.e. the last bit of the URL).

Entering/leaving maintenance mode

WordShell wil automatically enter maintenance mode when you install a plugin, and leave it when the installation completes. You do not need to enter or exit maintenance mode manually.

Specifying a plugin version

If you wish to install a particular plugin version (i.e. not the latest version), then you can specify the particular version with –new=<version>, like so:

wordshell mysite contact-form-7 --install --new=3.2.1

The version that you specify will need to be either:

  1. Available for Download in the WordPress plugins directory (often old versions get deleted), or
  2. One that you previously installed when it was the latest version (such versions are stored in a local cache for re-use).

Alternatively, if you do not specify any version (no –new or –latest) then WordShell will show you a menu of versions that it already knows about (ones that you have previously installed).

Working with third party plugins

The above examples are for plugins that can be found in the http://wordpress.org/extend/plugins. If you have a third-party plugin (i.e. one you obtained from elsewhere), then you should tell WordShell where to find the zip file like so:

wordshell mysite myplugin --install --new=path/to/myplugin-0.3.1.zip

Note that in this case, the plugin name (slug) that you supply (“myplugin” in the above example) will need to exactly equal the plugin slug of the plugin in the indicated zip file.

You can specify a URL to fetch the plugin from directly e.g.:

wordshell mysite myplugin --install --new=http://example.com/somewhere/myplugin-0.3.1.zip

When you install a third party plugin for the first time, WordShell copies it into its local cache for later use (and when checking for alterations).

Note that you can also import a plugin using this method to over-ride plugins available in the WordPress plugin directory. Any and all plugins imported using the –new=(filename) method will over-ride all lower and equal versions found in the WordPress plugin directory.

Possible errors

–install can be used only when the indicated website does not already have the plugin. If the plugin exists already and you wish to re-install or update, then you should see the manual for the update, rollback and restore options. If the plugin already exists then you will get an error:
wordshell mysite contact-form-7 --install
ABORT: Installation cancelled: plugin contact-form-7 already exists on this site (--install is only for new plugins)

 

More advanced usage

  • You can add –changelog or –description to first view the plugin’s changelog or general description before installing, e.g.
    wordshell mysite contact-form-7 --install --latest --changelog
  • You can add –confirm to throw in an extra “Are you sure you want to continue installing?” question. This is useful with –changelog or –description; if you read the changelog or description and don’t like what you see, then this will give you an opportunity to abort. e.g.
    wordshell mysite contact-form-7 --install --latest --confirm --changelog
  • –dryrun : This switch will not perform any changes upon the filesystem; it will only take you through any other steps and inform you what would have happened in a normal run.
    e.g.
    wordshell mysite contact-form-7 --install --dryrun --latest
  • Miscellaneous information: --new=latest is a synonym for --latest.

Next page: Finding available updates for plugins

Leave a Reply