wordpress_upgrade This simple and dirty utility helps automate the task of upgrading Wordpress sites when new versions of Wordpress are released. Specific usage instructions are found by passing --help when calling the program. The program backs up your database, downloads and installs clean Wordpress source, brings in all your plugins, themes, your config file, and any additions you have made in the top level or in wp-content. It backs up your old Wordpress source as well. REQUIREMENTS: ============= 1. Perl (standard getopt::long module) 2. rsync 3. shell access 4. mysqldump if you want to back up your database 5. wget for downloading the latest Wordpress automatically GENERAL USAGE NOTES: ==================== When a new version of Wordpress is released, just run the script. The only required option is the destination directory (your running wordpress directory). If you do not specify a Wordpress source file directory, the latest Wordpress source will be downloaded from the Wordpress website for you. The program by default will try to read your Wordpress config file and back up your database to your --root directory in a compressed format. The program will create a new directory with all the new source code, and then bring into it all your custom plugins, themes, config file and any other custom directories you might have made. You specify any custom directories with the --custom option, which can be specified multiple times, or given a comma-separated list of custom directories to bring in. These paths are relative to the --root. If you don't explicity specify any custom directories, the program will ask you about any custom ones and let you decide at run-time if you'd like to bring them in. After the new directory has been populated successfully, your old directory will be moved out of the way and your newly created installation set moved over into its place. This has the advantage, particularly on Wordpress installations with a large number of files, of keeping your site's downtime to a minimum. It is then up to you to run the web-based, Wordpress-provided upgrade script to finish updating any database modifications they may have implemented. SPECIAL NOTES: ============== The program will perform good sanity checks before it does anything, and should clean up after itself well in the event of failure or interruption. If the program is run as root, any access or ownership changes you have made to files or directories will be preserved. It can be dangerous trusing the user data contained in wp-config.php when running as root, but the program is fairly paranoid and will abort if it becomes suspicious of strange characters. By default, database backups are written to the --root directory specified or the current working directory. You can change the location for backups with the --db-backup-dir option. Data backups are compressed by default and have their file umask set at 0077 to prevent it being readable by anyone else on multi-user systems. See --help for details on other capabilities, such as skipping plugin, theme or config file installation, skipping database backups, alternate file locations, and alternate database authentication information. You should probably check ahead of time to make sure there have been no major structural changes in the wp-config.php file between versions. If there have been, you should integrate them into your existing wp-config.php file before you run this program, else remember to afterward. This rarely happens. Any directories or files you have added to the top level will be noticed by the program, and you will be prompted about retaining them. These can be specified explicity with the --custom option to avoid prompting, or --no-custom-check will completely avoid checking for any of custom modifications in the top level. --auto-custom will bring in all your top-level customizations without prompting. See --help. If the program believes it was run non-interactively, it will not prompt for anything. The program assumes the following: * Customizations are in 'wp-content'. * Themes are in 'wp-content/themes'. * Plugins are in 'wp-content/plugins'. * Config file is 'wp-config.php'. * You do not want to use any old Wordpress source laying about. The program will ignore any changes you made to the following, using the newest Wordpress files instead: * The themes 'classic' and 'default'. * The plugin 'akismet'. * Any modification you made in Wordpress code that was not done within a theme or plugin directory or 'wp-content', except for new files or directories you might have added in the top level. ** SPECIAL NOTE TO ADMINS OF MULTIPLE SITES ** *********** It is suggested that you download the newest Wordpress source and extract it into a directory, then call wordpress_upgrade with the --source option telling it where. When run non-interactively, wordpress_upgrade will re-download source and extract it again upon each new iteration, never trusting any already-downloaded Wordpress source files or directories. This behaviour does not happen when you explicitly specify a local source directory. When run interactively, you will be prompted for what to do on every iteration (unless it's told otherwise). ** SECURITY CONSIDERATIONS ** ************ 1. We have no way of knowing the goodness of the new source, whether it is coming from Wordpress.org or a local hierarchy. 2. It is assumed that this script, on a multi-user site, will be run FOR the users by a trustable system administrator. Paths supplied to the program are not checked for evil. However, the user's Wordpress config file (which they can edit) IS checked for potential evil. If you are allowing users to run the script themselves, it is a good idea to wrap it in your own script that will enforce your local sane paths before calling it. 3. We never suggest this script should be run as the webserver user -- instead run it as the individual user. Files owned or writeable by the web server user on a system is a bad idea, even though oftentimes convenient. Please see the accompanying LICENSE.txt file to learn what you're agreeing to by running this program. This program is released to the world because it has helped me, and may help you as well. I hope that it does. However, it may bring pain and ruin upon you as well. I've done all that I can to make sure it does not. This program comes with ABSOLUTELY NO WARRANTY; for details see the GPLv3 which is in the LICENSE.txt file included. This is free software, and you are welcome to redistribute it under certain conditions; see the GPLv3 for details. Please help, in all that you can. Mark Rushing http://orbum.net/mark