Control Live Changes

Prevents certain upgrade and installation actions on non-local environments.

Author:Steve Taylor (profile at wordpress.org)
WordPress version required:3.0
WordPress version tested:3.4.1
Plugin version:0.2.2
Added to WordPress repository:30-04-2012
Last updated:19-08-2012
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:0
Rated by:0
Plugin URI:http://sltaylor.co.uk/
Total downloads:1 141
plugin download
Click to start download

This plugin has arisen from the requirements of a client who manage many of their WordPress sites via Git repositories on Beanstalk. Core WP files are not in the repo, to keep its size down, but plugins and themes are. WP upgrades are of course tested on local development and remote staging servers before being run on the production server. But since plugins and themes are in the repo, ideally they should be upgraded locally for testing, then pushed to Beanstalk. Beanstalk in turn deploys the changes to the staging server, and then the production server.

To help maintain this workflow, this plugin tests if the environment is local or not (checking for WP_LOCAL_DEV or searching for "localhost" in $_SERVER['HTTP_HOST']). If the environment isn't local, plugin and theme installation, editing and upgrades are disabled.

The following constants can be defined in wp-config.php to override the defaults:

  • SLT_CLC_LOCAL_STRING - The string to search for in $_SERVER['HTTP_HOST'] that will indicate a local development environment. Default: "localhost"
  • SLT_CLC_DISABLE_REMOTE_CORE_UPGRADES - Default: false
  • SLT_CLC_DISABLE_REMOTE_PLUGIN_THEME_UPGRADES - This will also disable editing plugin and theme files via the admin interface. Default: true
  • SLT_CLC_OUTPUT_NOTICES - Whether to output explanatory notices on the upgrades, themes, and plugins admin pages. Default: true
  • SLT_CLC_CORE_NOTICE - Default: "Core upgrades are currently disabled on this server by the Control Live Changes plugin."
  • SLT_CLC_PLUGIN_THEME_NOTICE - Default: "Plugin and theme upgrades are currently disabled on this server by the Control Live Changes plugin."

An alternative to the SLT_CLC_LOCAL_STRING check for a local environment is the WP_LOCAL_DEV constant. This is used by Mark Jaquith in his technique for defining local database connection details in a separate file (http://markjaquith.wordpress.com/2011/06/24/wordpress-local-dev-tips/). If WP_LOCAL_DEV is set to true, the SLT_CLC_LOCAL_STRING check is made irrelevant.

Development code hosted at GitHub.


ChangeLog