Upgrade 2.6 to 2.7 CLI GIT

Upgrade 2.6 to 2.7 CLI GIT

by Helson C -
Number of replies: 7

Hello,

I'm trying to update MOODLE 2.6 to 2.7 by command line with GIT.


My steps.

cd moodle

git init

git remote add origin git://git.moodle.org/moodle.git

git pull origin MOODLE_27_STABLE

php admin/cli/updgrade.php

No update required for the installed version 2.6.11+ (Build: 20150619) (2013111811.01). Thank you....


git branch -a 

*master


git remote -v

origin  git://git.moodle.org/moodle.git (fetch)

origin  git://git.moodle.org/moodle.git (push)


git log 

commit 6480b0c1ea31beed1813e4c11e37efcae8659838

Author: Eloy Lafuente (stronk7) <stronk7@moodle.org>

Date:   Sun Jul 10 00:29:03 2016 +0200


    Moodle release 2.7.15


commit 5b25976c77dda2d16eb39aa9be0f862505d22a4a

Merge: 80c861c 24593b4

Author: Eloy Lafuente (stronk7) <stronk7@moodle.org>

Date:   Sun Jul 10 00:28:59 2016 +0200


    Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_S


cat version.php

$version  = 2013111811.01;              // 20131118      = branching date YYYYMMDD - do not modify!

                                        //         RR    = release increments - 00 in DEV branches.

                                        //           .XX = incremental changes.

$release  = '2.6.11+ (Build: 20150619)'; // Human-friendly version name

$branch   = '26';                       // This version's branch.

$maturity = MATURITY_STABLE;             // This version's maturity level.


git show 

commit 6480b0c1ea31beed1813e4c11e37efcae8659838

Author: Eloy Lafuente (stronk7) <stronk7@moodle.org>

Date:   Sun Jul 10 00:29:03 2016 +0200


    Moodle release 2.7.15


diff --git a/version.php b/version.php

index ece0a23..bec29dc 100644

--- a/version.php

+++ b/version.php

@@ -29,11 +29,11 @@


 defined('MOODLE_INTERNAL') || die();


-$version  = 2014051214.00;              // 20140512      = branching date YYYYMMDD - do not modify!

+$version  = 2014051215.00;              // 20140512      = branching date YYYYMMDD - do not modify!

                                                             //         RR    = release increments - 00 in DEV branches.

                                                            //           .XX = incremental changes.

-$release  = '2.7.14 (Build: 20160509)'; // Human-friendly version name

+$release  = '2.7.15 (Build: 20160711)'; // Human-friendly version name

 $branch   = '27';                       // This version's branch.



I don't understand why version don't update.

What's wrong?

If anyone can light my brain...



Average of ratings: -
In reply to Helson C

Re: Upgrade 2.6 to 2.7 CLI GIT

by Ken Task -
Picture of Particularly helpful Moodlers

Well, you've throughly explored git, for sure! ;)

git branch -a

should should the branch of code it's currently tracking - like so:

[root@sos moodle28]# git branch -a
* MOODLE_28_STABLE
  master

The * is above master and shows this is for a version 2.8 of code.   Your's shows it's still tracking master.

So to set your current 2.6.x to upgrade to 2.7.highest .... I'd first do:

git pull (which git's the highest 2.6.x available)

and then

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

to update the DB.

Then, after checking the site still functions as expected *AND* running a backup of code and a DB dump, upgrade to 2.7.highest thusly:

git branch --track MOODLE_27_STABLE origin/MOODLE_27_STABLE
git checkout MOODLE_27_STABLE

git branch -a should now show tacking the 27 branch.

Running git pull now should acquire the highest 2.7 code.

Then also running the upgrade script.

Don't forget to change ownerships of files after running git from command line IF you are using root as all newly acquired files or files that have been changed by git will belong to root user.   One of those files touched by this is version.php and if restrictions on that file are such that others cannot read it, one will get the 'white screen of death' in browser (not really broken, BTW).

You can check version.php for what Moodle is set to via the following in moodle code directory:

fgrep '$release' version.php

'spirit of sharing', Ken



In reply to Ken Task

Re: Upgrade 2.6 to 2.7 CLI GIT

by Helson C -

Ken,

I'm very grateful.


The version is 2.6.11+ and I would like to update to latest moodle 2.7 and after moodle 3.1 in sequence.

But I have no success in upgrade 2.6.11+ to 2.7 lastest with GIT.


Is this possible to achive?


My moodle have some custom plugins that I made, and I don't want copy manually the folders to new moodle,

for it I would like to update with GIT. 

We have success upgrading 3.1 to 3.1.1+


My best regards.


In reply to Helson C

Re: Upgrade 2.6 to 2.7 CLI GIT

by Ken Task -
Picture of Particularly helpful Moodlers

Ahhh ... something new not disclosed in original posting ....

The diff is in 'some custom plugins that I have made' and your insistence on not wanting to copy (manually) the folders to the new moodle.

I was referring to core code ... not custom code.   Does your custom code hack any core code?

Yes, I believe it is possible *but* your custom code (maybe each one of those) needs to have it's own git repo or merged into core code via git (am not a programmer, have read that one could so that, but then one has their own really private unless shared git repo for your 'semi-forked' version of Moodle.

The success you had with 3.1 to 3.1.1+ may have been due to no custom code that hacked core code.

Comment: I've a local plugin I've developed I call snapshot - makes a backup of moodle code and does an sql dump of the DB).    My snapshot has a version.php file and that is the only thing I need to edit when updating or upgrading.

So what you are really asking is how to setup a git repo for a moodle that can update/upgrade core code as well as your custom plugins.    Is that right?

If so, suggest maybe the moderator could move this from General - Updating/Upgrading to a forum for Developers.

'spirit of sharing', Ken


In reply to Ken Task

Re: Upgrade 2.6 to 2.7 CLI GIT

by Helson C -

I don't make any hack on core code.

I only need merge the core.


Thank you.

In reply to Helson C

Re: Upgrade 2.6 to 2.7 CLI GIT

by Ken Task -
Picture of Particularly helpful Moodlers

No hack of core code ... well then, when you changed the tracking did git complain or warn about code it discovered that was not part of core when attempting a git pull of core?    Did it ask of you to stash (or something like that ... it's been many moons ago for me with my custom local plugin and I don't recall now.   But whatever, I've not had to do that again when using git to go after the core updates/upgrades.

Again ... this probably needs to be moved to developers and continued with some one who is much more knowledgeable about git than myself.   Am almost certain they will have some questions for ya.

'spirit of sharing', Ken



In reply to Ken Task

Re: Upgrade 2.6 to 2.7 CLI GIT

by Helson C -
When I try merge 2.6.11 with 2.7 git show me following

Unmerged paths:

  (use "git add <file>..." to mark resolution)


        both added:      admin/auth_config.php

        both added:      admin/category.php

        both added:      admin/cli/install.php

        both added:      admin/cli/install_database.php

        both added:      admin/enrol.php

        both added:      admin/environment.xml

... and much more...



In reply to Helson C

Re: Upgrade 2.6 to 2.7 CLI GIT

by Helson C -
Until now, I don't know if it upgrade is possible with GIT.

Thanks Ken.