upgrade 2.7.9 to 2.9.1 with Git not working

upgrade 2.7.9 to 2.9.1 with Git not working

by J Scheller -
Number of replies: 8

Currently trying to upgrade version 2.7.9 (build 20150706) to 2.9 using git
Running Ubuntu 14.04 LTS

Git was used to do this moodle install.

I upgraded from an earlier version of 2.7 to the current newest 2.7.9 build
Starting with past used commands

try to upgrade via Git:
user@redacted:/var/www/learning$ sudo git pull
Already up-to-date.

Checked git branch:
user@redacted:/var/www/learning$ sudo git branch -a
* MOODLE_27_STABLE
 remotes/origin/MOODLE_27_STABLE

changed branch:
user@redacted:/var/www/learning$ sudo git checkout -b MOODLE_29_STABLE
Mfilter/algebra/algebra2tex.pl
Mfilter/tex/mimetex.darwin
Mfilter/tex/mimetex.freebsd
Mfilter/tex/mimetex.linux
Mlib/editor/tinymce/lib.php
Switched to a new branch 'MOODLE_29_STABLE'

Checked Git Branch:
user@redacted:/var/www/learning$ sudo git branch -a
  MOODLE_27_STABLE
* MOODLE_29_STABLE
  remotes/origin/MOODLE_27_STABLE

Tried to Pull upgraded version:
user@redacted:/var/www/learning$ sudo git pull
Already up-to-date.

Tried to run install script:
user@redacted:/var/www/learning$ sudo php admin/cli/upgrade.php
No upgrade needed for the installed version 2.7.9 (Build: 20150706) (2014051209). Thanks for coming anyway!


End result:
Still on 2.7.9 - any advice on what I am doing wrong or how to give further info?

Best Regards,
J


Average of ratings: -
In reply to J Scheller

Re: upgrade 2.7.9 to 2.9.1 with Git not working

by Ken Task -
Picture of Particularly helpful Moodlers

I think ...  from the moodle code directory

git branch --track MOODLE_2#_STABLE origin/MOODLE_2#_STABLE
git checkout MOODLE_2#_STABLE

Then to see:

git branch -a

and double check:

fgrep '$release' version.php

should show: $release  = '2.9.1 (Build: 20150706)'; // Human-friendly version name

To upgrade

php admin/cli/upgrade.php --non-interactive

(hope you did a backup of SQL and of original code directory first)

'spirit of sharing', Ken


In reply to Ken Task

Re: upgrade 2.7.9 to 2.9.1 with Git not working

by J Scheller -

No luck.  I am thinking about reverting back to an earlier snapshot before I started working on things, I am wondering if I messed something p and it is causing git issues.  Here is what I get when I try what you suggested.


user@redacted:/var/www/learning$ sudo git branch --track MOODLE_29_STABLE origin/MOODLE_29_STABLE
fatal: A branch named 'MOODLE_29_STABLE' already exists.

user@redacted:/var/www/learning$ sudo git checkout MOODLE_29_STABLE
Mfilter/algebra/algebra2tex.pl
Mfilter/tex/mimetex.darwin
Mfilter/tex/mimetex.freebsd
Mfilter/tex/mimetex.linux
Mlib/editor/tinymce/lib.php
Already on 'MOODLE_29_STABLE'

user@redacted:/var/www/learning$ sudo git branch -a
  MOODLE_27_STABLE
* MOODLE_29_STABLE
  remotes/origin/MOODLE_27_STABLE

user@redacted:/var/www/learning$ sudo fgrep '$release' version.php
$release  = '2.7.9 (Build: 20150706)'; // Human-friendly version name


No worries, I backed u all db's and files, made a copy of the vm, and have been taking snapshots as well.

In reply to J Scheller

Re: upgrade 2.7.9 to 2.9.1 with Git not working

by Ken Task -
Picture of Particularly helpful Moodlers

This might stem from how it was originally installed via git ...

If I re-call correctly, using:

git clone -b MOODLE_2X_STABLE git://git.moodle.org/moodle.git

restricted me to the 2X version and I had issues in tracking higher versions.

I've never seen:

Mfilter/algebra/algebra2tex.pl
Mfilter/tex/mimetex.darwin
Mfilter/tex/mimetex.freebsd
Mfilter/tex/mimetex.linux
Mlib/editor/tinymce/lib.php

and looks like git branch -a is seeing something weird.

So here's a work-around to try before going through a restore process:

In this example, CentOS ... which has /var/www/ as the Apache root.   Document root is html and where the moodle code lies.   You adjust for your OS.

As root user:

cd /var/www/

git clone git://git.moodle.org/moodle.git htmlgit

This creates (clones into) the 'htmlgit' directory while acquiring Moodle code.

cd htmlgit

git branch -a

should show:

* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/MOODLE_13_STABLE
  remotes/origin/MOODLE_14_STABLE
  remotes/origin/MOODLE_15_STABLE
  remotes/origin/MOODLE_16_STABLE
  remotes/origin/MOODLE_17_STABLE
  remotes/origin/MOODLE_18_STABLE
  remotes/origin/MOODLE_19_STABLE
  remotes/origin/MOODLE_20_STABLE
  remotes/origin/MOODLE_21_STABLE
  remotes/origin/MOODLE_22_STABLE
  remotes/origin/MOODLE_23_STABLE
  remotes/origin/MOODLE_24_STABLE
  remotes/origin/MOODLE_25_STABLE
  remotes/origin/MOODLE_26_STABLE
  remotes/origin/MOODLE_27_STABLE
  remotes/origin/MOODLE_28_STABLE
  remotes/origin/MOODLE_29_STABLE
  remotes/origin/master

We want to set to this htmlgit directory to the version you currently have (2.7.x)

git branch --track MOODLE_27_STABLE origin/MOODLE_27_STABLE

it should show:

Branch MOODLE_27_STABLE set up to track remote branch MOODLE_27_STABLE from origin.

Now we check it out:

git checkout MOODLE_27_STABLE

It should now say:

Your branch is up-to-date with 'origin/MOODLE_27_STABLE'.

Check the version file:

fgrep '$release' version.php

It should show:

$release  = '2.7.9 (Build: 20150706)'; // Human-friendly version name

Now the "tricky part" ...

Code directory is /var/www/html/ in this example and where the messed up .git resides.

cd /var/www/html/

mv .git ../

That moves the hidden .git directory up one level and out of the code directory.

cp config.php ../

We are 'archiving' a copy of config.php file up one level.

cd /var/www/htmlgit/

cp -rp * ../html/

This should copy recursively and preserve ownership/permissions which well change ALL files/folders up one level and into the html directory where the moodle code should reside.

Then one more:

cp -rp .git ../html/

That copies recursively the hidden .git directory into the directory where moodle code resides.

cd /var/www/html/

chown apache:apache

Check to make sure your config.php file is there still.

ls -l config.php

If ok, then, we make sure it has current files for 27.  This might be redundant and un-necessary, but just making sure:

git pull

Check version:

fgrep '$release' version.php

git branch -a should show:

* MOODLE_27_STABLE
  master
  remotes/origin/HEAD -> origin/master

Then we'll make sure the DB is updated also:

php admin/cli/upgrade.php --non-interactive

If all is ok to this point, then we'll now move it to 2.9.

cd /var/www/html/


git branch --track MOODLE_29_STABLE origin/MOODLE_29_STABLE

git checkout MOODLE_29_STABLE

should show:

Switched to branch 'MOODLE_29_STABLE'
Your branch is up-to-date with 'origin/MOODLE_29_STABLE'.

and a git branch -a shows

  MOODLE_27_STABLE
* MOODLE_29_STABLE
  master

and a fgrep '$release' version.php
$release  = '2.9.1 (Build: 20150706)'; // Human-friendly version name

Now upgrade

php admin/cli/upgrade.php --non-interactive

change ownership's

chown apache:apache * -R

Now we try the web browser. ;)

If everything works clean up the stuff we used to re-acquire ... including the htmlgit directory so it won't confuse later.

'spirit of sharing', Ken


Average of ratings: Useful (2)
In reply to Ken Task

Re: upgrade 2.7.9 to 2.9.1 with Git not working

by J Scheller -

It worked!  Thanks so much Ken!

I tried your instructions but they did not work on my current copy.

I ended up reverting back to my snapshot of an earlier version before I started trying to upgrade yesterday.
I tried normal branch switch and upgrade method which did not work.

I reverted back again and followed your instructions and everything worked and the upgrade went through flawlessly.


Once again, thank you for your assistance in this, it is much appreciated.

Average of ratings: Useful (1)
In reply to J Scheller

Re: upgrade 2.7.9 to 2.9.1 with Git not working

by Ken Task -
Picture of Particularly helpful Moodlers

Congrats! Glad to hear it.

Maybe you could share this ...

"I tried normal branch switch and upgrade method which did not work."

so I and others can learn what doesn't work/what to avoid in adventuring with git! ;)

'spirit of sharing', Ken

In reply to J Scheller

Re: upgrade 2.7.9 to 2.9.1 with Git not working

by Mark Pearson -

I've made this same mistake as well. Several times ....

sudo git checkout -b MOODLE_29_STABLE

I think you'll find that next time if you do :

sudo git checkout -b MOODLE_30_STABLE origin/MOODLE_30_STABLE

It'll create the new branch and switch to it.

Why ? Git voodoo, that's why smile

Mark

Average of ratings: Useful (2)
In reply to Mark Pearson

Re: upgrade 2.7.9 to 2.9.1 with Git not working

by Ken Task -
Picture of Particularly helpful Moodlers

Ahhhh Soooo! ;)

Thanks for sharing!  IF it works, think it would be better ... removes all the older versions of Moodle and only the current + newer in the git info locally.   Reduces the size of the code folder as well.

Am gonna try that and change my notes!!! ;)

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Mark Pearson

Re: upgrade 2.7.9 to 2.9.1 with Git not working

by Ken Task -
Picture of Particularly helpful Moodlers

@Mark ... just sharing back ...

Ok, just tried it ... and to share back ...

Yes, it does work ... with the -b switch and slight changes ...

git clone -b MOODLE_28_STABLE git://git.moodle.org/moodle.git [directory]
cd [directory]
git branch -a
fgrep '$release' version.php

To upgrade:

git checkout -b MOODLE_29_STABLE origin/MOODLE_29_STABLE
git checkout MOODLE_29_STABLE
git branch -a
fgrep '$release' version.php

either way ... one still ends up with git branch -a showing:

  remotes/origin/HEAD -> origin/master
  remotes/origin/MOODLE_13_STABLE
  remotes/origin/MOODLE_14_STABLE
  remotes/origin/MOODLE_15_STABLE
  remotes/origin/MOODLE_16_STABLE
  remotes/origin/MOODLE_17_STABLE
  remotes/origin/MOODLE_18_STABLE
  remotes/origin/MOODLE_19_STABLE
  remotes/origin/MOODLE_20_STABLE
  remotes/origin/MOODLE_21_STABLE
  remotes/origin/MOODLE_22_STABLE
  remotes/origin/MOODLE_23_STABLE
  remotes/origin/MOODLE_24_STABLE
  remotes/origin/MOODLE_25_STABLE
  remotes/origin/MOODLE_26_STABLE
  remotes/origin/MOODLE_27_STABLE
  remotes/origin/MOODLE_28_STABLE
  remotes/origin/MOODLE_29_STABLE

Was kinda hoping to see something like:

remotes/origin/HEAD -> origin/master

remotes/origin/MOODLE_28_STABLE

remotes/origin/MOODLE_29_STABLE

where git doesn't know about any version lower than the initial install of 28.

It might have been slightly faster ... but didn't put a stop watch to it.

But, I can live with it!

Sure beats the heck out of the FTP method!!!! ;)

'spirit of sharing', Ken

Average of ratings: Useful (1)