How to simplify upgrading a customized vbulletin
by
30 Mar 2015
Note: this article's suggestions work best when doing upgrades between vBulletin releases with the same major version (i.e. 4.x.a to 4.y.b) though it can be used with more work on upgrades between major versions.
Requirements- (L/W)AMP server
- git distributed version control
- ability to open .tar.gz or .zip files
Overview of how this works
This system works by having two git repositories setup on your computer, one to simulate the upstream changes made to vBulletin and the second to be the local, downstream, repository where you record the changes you've made to your vBulletin install. When a new version of vBulletin is released that you are upgrading to you grab the new version of vBulletin, upload it to your server and let the marvels of git rebase save you hours if not days of your life.
Step 1 - Setup the vBulletin repository- make directory for the repository (e.g. mkdir /usr/src/vbulletin or ~/src/vbulletin)
- go to the above directory (e.g. cd /usr/src/vbulletin)
- run command git init
Step 2 - Setup the local repository for your vBulletin customizations- make directory for the repository (e.g. mkdir /var/www/forum or ~/public_html/forum)
- If you've already got vBulletin running create this repository in a temporary location (i.e. /tmp/forum)
- go to the above directory (e.g. cd /var/www/forum)
- run command git init
- edit the git config to point to the upstream repository, add the following code
Code:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "origin"]
url = /usr/src/vbulletin/.git
fetch = +refs/heads/*:refs/remotes/origin/*
Where the url in the remote "origin" section is the location you created the git repository in step 1
- run the command git fetch
- run the command git checkout -b master origin/master
Notes:- You should now have two empty repositories with no files in them, you can verify this by running the command git log in both directories and you should see nothing.
- If you've already customized your vbulletin site create a new location for the repository we will move the repository later to its final location.
- Ideally this directory will be where your "live" code resides once you've completed Step 4.
Step 3 - Install base vBulletin- Download the version of vBulletin that your site is running or will be running (any format you can extract)
- Extract the contents of file downloaded in the previous step (not to your repository locations)
- Make the following changes to the files
- rename includes/config.php.new to includes/config.php
- (optional) if using a renamed admincp rename admincp to your chosen name
- (optional) if using a renamed modcp rename modcp to your chosen name
- delete the install folder (you may want to just move the folder somewhere else to facilitate running the install/upgrade script)
- (optional) on linux change the end of line characters of all files use the command:
Code:
fromdos `find * -exec file {} + | grep -w text | awk '{print $1}' | sed s/:$//`
Note: those are backticks not single quotes surrounding the argument to the fromdos command
- copy the contents of the upload directory to location of the repository from step 1
- change your location to be the directory for the repository from Step 1 (e.g. cd /usr/src/vbulletin)
- run the command git add . this adds all files to the list of files to be committed
- run the command git commit -m 'version' where version if the version number (e.g. 4.2.3)
- change your location to be the directory for the repository from Step 2 (e.g. cd /var/www/forum)
- run the command git fetch
- run the command git checkout -b master origin/master
Note: - At this point in both repositories if you run an ls (dir on a windows server) you should see all the files from the upload directory of the vbulletin version you downloaded. If so you're now ready to start customizing your vbulletin install.
- Another check is to the command git log in both repositories, you should see a single entry for the version of vbulletin you just installed.
- The repository from step 1 should now only be used when you are upgrading your version of vbulletin. If you are customizing your vbulletin version (i.e. changing core files or installing plugins or custom code) then you should be working in local repository location.
Step 4 - Add your vBulletin customizations- make changes in the vBulletin customization repository
- copy files into the directory, including your previously customized vBulletin
- directly edit files within the directory
- delete files within the directory
- run the command git add . to add all non-delete changes to the list of changes to be committed
- run the command git add -u . to add file removals to the list of changes to be committed
- run the command git commit this will open a text editor to allow for a detailed commit message
- Repeat these steps as necessary for further customization
Note: During the initial setup if you had a pre-existing vbulletin install after you have added all customizations you should replace your "live" folder with the folder that has the customized vBulletin repository. This way you don't need to maintain files is multiple places.
Step 5 - Upgrading your vBulletin version
To upgrade your version of vBulletin you follow mostly the same process as in Step 3 above with a few critical differences, noted in red and blue text.- Commit all outstanding changes in local customization repository!!! as per Step 4 - Any uncommitted changes will be lost, you've been warned!
- Download the version of vbulletin that you will be upgrading to, the full version recommended to keep the headers consistent (any format you can extract)
- Extract the contents of file downloaded in the previous step (not to your repository locations)
- Make the following changes to the files
- rename includes/config.php.new to includes/config.php
- (optional) if using a renamed admincp rename admincp to your chosen name
- (optional) if using a renamed modcp rename modcp to your chosen name
- delete the install folder (you'll may want to just move the folder somewhere else to facilitate running the install/upgrade script)
- (optional) on linux change the end of line characters of all files use the command:
Code:
fromdos `find * -exec file {} + | grep -w text | awk '{print $1}' | sed s/:$//`
Note: those are backticks not single quotes surrounding the argument to the fromdos command
- delete the contents of the repository from Step 1 (to deal with files that got removed in the new vBulletin version)
- copy the contents of the upload directory to location of the repository from step 1
- change your location to be the directory for the repository from Step 1 (e.g. cd /usr/src/vbulletin)
- run the command git add -u . this adds all removed files to the list of changes to be committed
- run the command git add . this adds all new/changed files to the list of files to be committed
- run the command git commit -m 'version' where version if the version number (e.g. 4.2.3)
- change your location to be the directory for the repository from Step 2 (e.g. cd /var/www/forum)
- run the command git reset --hard HEAD this commands reset the custumized vBulletin to its last commit, and is required to upgrade your vBulletin install
- run the command git fetch
- run the command git rebase origin/master
- if a conflict is found start the steps for git rebase conflict resolution
- merge the conflicting code
- run the command git rebase --continue
- if a conflict is found go to step 1 of git conflict resolution
- after completing the git rebase you'll need to run the upgrade script for the forum if you aren't applying a patch
You can repeat steps 4 & 5 as often as necessary, mostly you'll be doing step 4 as you install plugins, custom code, or alter the core code for vBulletin.
|