Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
How to simplify upgrading a customized vbulletin
squidsk
Join Date: Nov 2010
Posts: 962

by squidsk squidsk is offline 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

    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

    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:

      Block Disabled:      (Update License Status)  
      Suspended or Unlicensed Members Cannot View Code.

      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:

      Block Disabled:      (Update License Status)  
      Suspended or Unlicensed Members Cannot View Code.

      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.

Last edited by squidsk; 22 Jan 2016 at 22:38..
Views: 2686
Reply With Quote
Comments
  #2  
Old 22 Jan 2016, 21:59
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
 
Join Date: Sep 2008
Real name: Michael Miller Jr
Article approved! Nice one too squid, thanks for taking the time to outline this for everyone .
__________________
Daddy Does Dios and Figs!
https://www.linkedin.com/in/thelastsuperman - Custom vBulletin Modifications, Styles, and Services.
Need a Host? I recommend URLJet.

Search - Use the search feature to find similar issues/answers.
Information - Include screenshots, copy/pasted error codes, url etc.
Fixed - Please return to your thread/post and let us know how it was fixed!
Thanks - For participating! Click the "Like" on a post if someone helped you!
Reply With Quote
  #3  
Old 29 Feb 2016, 14:47
ub.ch ub.ch is offline
 
Join Date: Jul 2010
Heya!

thank you so much for the article!

I still have a question

As far as I understood the changes made in my local repository (so eg /var/www/) are never pushed?
I am still confused as to how this exactly works, but shouldn't changed that have been commited also be pushed?
Especially if you were to have a dev environment and a live environment.

My plan is to "work" on the dev env, to rebases etc, and once done push all those commits to live.
Or - if absolutely need be - do changes on live and push them back to the repo to also have them on dev

As far as I can see this does not work?
Seeing that the changes made in /var/www are never pushed?
Or am I missing something?

Again thank you so much for posting!
Reply With Quote
  #4  
Old 29 Feb 2016, 16:39
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
Originally Posted by ub.ch View Post
Heya!

thank you so much for the article!

I still have a question

As far as I understood the changes made in my local repository (so eg /var/www/) are never pushed?
I am still confused as to how this exactly works, but shouldn't changed that have been commited also be pushed?
Especially if you were to have a dev environment and a live environment.

My plan is to "work" on the dev env, to rebases etc, and once done push all those commits to live.
Or - if absolutely need be - do changes on live and push them back to the repo to also have them on dev

As far as I can see this does not work?
Seeing that the changes made in /var/www are never pushed?
Or am I missing something?

Again thank you so much for posting!
To do what you want you'd need a third level repository for your live site that is downstream from the second repository in the article.

Something like:

          vb repo
|
dev repo
|
live repo

The dev repo is the second repo from the article. You use it to deal with upstream changes from vbulletin as well as your own customizations. Once you have all of that dealt with you can fetch the changes in the live repo and reset to HEAD, which will update/add/delete all relevant files.
Reply With Quote
  #5  
Old 29 Feb 2016, 16:45
ub.ch ub.ch is offline
 
Join Date: Jul 2010
thanks for the very quick reply!

I am not sure I understand correctly.
the dev repo has the vb repo as remote, so all changes that are pushed will land there?

Right now I can't push any changes made in dev:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #6  
Old 29 Feb 2016, 18:54
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
No you don't push to the vb repo, since you have to treat it as a repo you can't edit, which you can't since you have no control over the code vb creates. You fetch from the dev repo on your live repo. All work on your dev repo will be in a branch that isn't HEAD so you aren't fetching non-head commits from your live site.
Reply With Quote
  #7  
Old 29 Feb 2016, 19:03
ub.ch ub.ch is offline
 
Join Date: Jul 2010
ah I see!
It's just that your Step 4 did not say anything about using a branch - that's maybe where my confusion came from
Reply With Quote
  #8  
Old 02 Mar 2016, 16:32
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
That's because in the instructions above I leave how you administer your repo and how you want to handle doing your changes to yourself. The best practice for using git is that any changes you make to your repo are done on a branch and when finalized merged back into HEAD. The instructions are for setting up a simple method of applying vbulletin changes to a location where you have your own customized changes to vbulletin. How you track your customization to the vbulletin code base is up to you, as is any additional infrastructure you want to add around the above process.
Reply With Quote
  #9  
Old 02 Mar 2016, 22:41
ub.ch ub.ch is offline
 
Join Date: Jul 2010
ok
I am fairly new to git, I do understand the basics but rebases etc are a bit over my head atm - thats the reason behind my numerous questions

Thanks again!
Your help made things and my future env setup a lot clearer!
Reply With Quote
Reply

Similar Article
Article Author Type Replies Last Post
Miscellaneous Hacks Ban IP's In vBulletin Options Easily Simon Lloyd vBulletin 3.8 Add-ons 46 05 Jan 2015 15:09
Miscellaneous Hacks Ban IP's In vBulletin Options Easily Simon Lloyd vBulletin 4.x Add-ons 55 14 Dec 2012 22:13



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 15:46.

Layout Options | Width: Wide Color: