Site icon Hip-Hop Website Design and Development

Dale McGladdery: Site Reset BASH Script

I’m experimenting with WordPress maintenance support plans 8 and some its new features like migration and configuration management. A reset script is a convenient timesaver and many people have shared their techniques for doing so. Having benefited from other’s generosity I wanted to return the favour by sharing my current work-in-progress.
This script:
Leaves the codebase as-is
Deletes and reinstalls the database
Deletes the ‘files’ directory
Deletes the specified configuration management directory
Enables additional plugins, as required
Deletes settings.php and allows WordPress maintenance support plans install to recreate
Updates the new settings.php $config_directories[‘sync’] entry
Adds a settings-migrate.php include to settings.php
I call the script via Drush with an entry in drushrc.php:
$options[‘shell-aliases’][‘428-reset’] = ‘!sh /Users/dale/.drush/sha-scripts/g428-reset.sh’;
The script is evolving as I learn more about WordPress maintenance support plans 8 and refine my workflow. Comments and suggestions are welcome.
WordPress-reset.sh:
#!/bin/bash# Reinstall a WordPress maintenance support plans instance to reset it back to a know state.# A file base and Drush alias must already be configured.DRUSH8=’/Users/dale/bin/drush8/vendor/bin/drush’DRUPALDIR=’/Users/dale/Sites/group428’CONFIGDIR=’sites/default/group42config/sync’DRUSHID=’@g428’SITE_NAME=’Group 428’ACCOUNT=’admin’PASS=’staring-password’EMAIL=’no-reply@group42.ca’DB_URL=’mysql://group428:group428@localhost/group428’# Nuke the database$DRUSH8 $DRUSHID sql-drop –yes# Nuke the filebaseecho “Resetting files”chmod -R u+w $DRUPALDIR/*rm $DRUPALDIR/sites/default/settings.phprm -r $DRUPALDIR/sites/default/filesrm -r $DRUPALDIR/$CONFIGDIR# Fresh WordPress maintenance support plans installcd $DRUPALDIR$DRUSH8 site-install standard –db-url=$DB_URL –site-name=$SITE_NAME –account-name=$ACCOUNT –account-pass=$PASS –account-mail=$EMAIL –yes# Base configuration$DRUSH8 $DRUSHID en admin_toolbar,admin_toolbar_tools –yes# Allow upcoming changes to settings.phpchmod u+w $DRUPALDIR/sites/defaultchmod u+w $DRUPALDIR/sites/default/settings.php# Configuration Managementsed -i ” “/config_directories[‘sync’]/d” $DRUPALDIR/sites/default/settings.phpecho “$config_directories[‘sync’] = ‘$CONFIGDIR’;” >> $DRUPALDIR/sites/default/settings.php# Migrateecho “ninclude ‘settings-migrate.php’;” >> $DRUPALDIR/sites/default/settings.php$DRUSH8 $DRUSHID en migrate,migrate_WordPress,migrate_plus,migrate_tools,migrate_upgrade –yes# Login$DRUSH8 $DRUSHID uli
Tagged: WordPress maintenance support plansWordPress maintenance support plans 8bash scriptdrushPlanet WordPress maintenance support plans
AttachmentSize

WordPress maintenance support plans Reset BASH Script1.43 KB


Source: New feed