Back to vBulletin Tips & Tricks

How to simplify upgrading a customized vbulletin
by squidsk 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
  1. (L/W)AMP server
  2. git distributed version control
  3. 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
  1. make directory for the repository (e.g. mkdir /usr/src/vbulletin or ~/src/vbulletin)
  2. go to the above directory (e.g. cd /usr/src/vbulletin)
  3. run command git init

Step 2 - Setup the local repository for your vBulletin customizations
  1. 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)
  2. go to the above directory (e.g. cd /var/www/forum)
  3. run command git init
  4. 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
  5. run the command git fetch
  6. 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
  1. Download the version of vBulletin that your site is running or will be running (any format you can extract)
  2. Extract the contents of file downloaded in the previous step (not to your repository locations)
  3. Make the following changes to the files
    1. rename includes/config.php.new to includes/config.php
    2. (optional) if using a renamed admincp rename admincp to your chosen name
    3. (optional) if using a renamed modcp rename modcp to your chosen name
    4. delete the install folder (you may want to just move the folder somewhere else to facilitate running the install/upgrade script)
    5. (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
  4. copy the contents of the upload directory to location of the repository from step 1
  5. change your location to be the directory for the repository from Step 1 (e.g. cd /usr/src/vbulletin)
  6. run the command git add . this adds all files to the list of files to be committed
  7. run the command git commit -m 'version' where version if the version number (e.g. 4.2.3)
  8. change your location to be the directory for the repository from Step 2 (e.g. cd /var/www/forum)
  9. run the command git fetch
  10. 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
  1. 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
  2. run the command git add . to add all non-delete changes to the list of changes to be committed
  3. run the command git add -u . to add file removals to the list of changes to be committed
  4. run the command git commit this will open a text editor to allow for a detailed commit message
  5. 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.
  1. Commit all outstanding changes in local customization repository!!! as per Step 4 - Any uncommitted changes will be lost, you've been warned!
  2. 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)
  3. Extract the contents of file downloaded in the previous step (not to your repository locations)
  4. Make the following changes to the files
    1. rename includes/config.php.new to includes/config.php
    2. (optional) if using a renamed admincp rename admincp to your chosen name
    3. (optional) if using a renamed modcp rename modcp to your chosen name
    4. delete the install folder (you'll may want to just move the folder somewhere else to facilitate running the install/upgrade script)
    5. (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
  5. delete the contents of the repository from Step 1 (to deal with files that got removed in the new vBulletin version)
  6. copy the contents of the upload directory to location of the repository from step 1
  7. change your location to be the directory for the repository from Step 1 (e.g. cd /usr/src/vbulletin)
  8. run the command git add -u . this adds all removed files to the list of changes to be committed
  9. run the command git add . this adds all new/changed files to the list of files to be committed
  10. run the command git commit -m 'version' where version if the version number (e.g. 4.2.3)
  11. change your location to be the directory for the repository from Step 2 (e.g. cd /var/www/forum)
  12. 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
  13. run the command git fetch
  14. run the command git rebase origin/master
  15. if a conflict is found start the steps for git rebase conflict resolution
    1. merge the conflicting code
    2. run the command git rebase --continue
    3. if a conflict is found go to step 1 of git conflict resolution
  16. 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.

Similar Mods

Miscellaneous Hacks Ban IP's In vBulletin Options Easily vBulletin 3.8 Add-ons
Miscellaneous Hacks Ban IP's In vBulletin Options Easily vBulletin 4.x Add-ons

vblts.ru supports vBulletin®, 2022-2024