Tools to maintain a drupal install managed by git
Suppose this repo is checked out in ~/drupal_git_tools ... Suppose top level site folder is ~/public_html ...
-
backup drupal database (e.g. via web using 'Backup and Migrate' module).
-
mkdir ~/drupal-core-updates ; cd ~/drupal-core-updates
-
wget ... ; tar xzf *.tar.gz -- leaves drupal-x.nn folder
-
cd ~/public_html
-
git checkout -b core-updates
-
cd ~/drupal_git_tools
-
./update-core ~/drupal-core-updates/drupal-x.nn ~/public_html
-
edit ~/public_html/sites/default, settings.php, set $update_free_access to TRUE.
-
cd ~/public_html
-
git status -- sanity check
-
git commit -a -m 'updated core to x.nn'
-
git checkout master
-
git merge core-updates
-
git push
- note that if your post-receive hook does a checkout, that may mess up your permissions.
-
git branch -d core-updates
-
chmod -R 755 ~/public_html
-
backup drupal database (e.g. via web using 'Backup and Migrate' module).
-
mkdir ~/drupal-module-updates ; cd ~/drupal-module-updates
-
wget ... ; tar xzf *.tar.gz
-
cd ~/public_html
-
git checkout -b module-updates
-
cd ~/drupal_git_tools
-
./update-module ~/drupal-module-updates/module-name ~/public_html
-
edit ~/public_html/sites/default, settings.php, set $update_free_access to TRUE.
-
cd ~/public_html
-
git status -- sanity check
-
git commit -a -m 'updated module'
-
git checkout master
-
git merge module-updates
-
git push
- note that if your post-receive hook does a checkout, that may mess up your permissions.
-
git branch -d module-updates
-
chmod -R 755 ~/public_html
For a drupal site, it might be that files are uploaded via the drupal file manager. Sometimes you want to collect all the untracked files and add/stage them.
- cd ~/public_html
- ~/drupal_git_tools/gen-adds > ../adds.out
- remove lines from adds.out for files you do not want to add
- . ../adds.out
- git commit -m 'added new files'
- git pull ; git push ; etc.
There's no script for this - just some notes:
- get backup .sql.gz file using backup-and-migrate module
- cp -rp public_html staging
- in cpanel, create new empty sql database, 'staging'
- add user for main db to new 'staging' db
- with all privileges
- add user for main db to new 'staging' db
- in cpanel, start phpmyadmin tool
- go to new staging db, click Import
- upload .sql.gz file from backup
- do it
- in staging/sites/default/settings.php, change db name to 'staging'