Upgrading moodle via GIT

Upgrading moodle via GIT

by sarfaraz Mohamed -
Number of replies: 12

Hi

I am new here i am playing around with a version of moodle i am trying to upgrade via git , but after endless hours of head scratching i thought i might ask the community, feel like i am missing something basic, I have never used git before

My moodle is up and running : version 3.5.6 Upgrading to 3.7x

I have read the following guide:

https://docs.moodle.org/37/en/Git_for_Administrators

Done the following:

$ cd /path/to/your/webroot

$ git clone git://git.moodle.org/moodle.git (1) 

$ cd moodle $ git branch -a (2) 

$ git branch --track MOODLE_37_STABLE origin/MOODLE_37_STABLE (3)

 $ git checkout MOODLE_37_STABLE (4)

$ cd /path/to/your/moodle/ 

$ git pull 

---------------------------------------------------------------

my moodle path is : /var/www/html/ "files here"

---------------------------------------------------------------

When i complete this step :

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


#Creates another folder called moodle            --- (/var/www/html/moodle)

Problem: I do not know what to do from here or how to proceed ?

----------------------------------------------------

What i think should be done :

cd /var/www/html/moodle

cp ../

cd /var/www/html

&(which  php) /admin/cli/upgrade.php

Average of ratings: -
In reply to sarfaraz Mohamed

Re: Upgrading moodle via GIT

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Replace the first three lines with:
$ cd /var/www
$ rmdir html (I assumed it is empty. Otherwise 'rm -rf html')
$ git clone git://git.moodle.org/moodle.git html
$ cd html
In reply to Visvanath Ratnaweera

Re: Upgrading moodle via GIT

by sarfaraz Mohamed -
Hi thank you for the reply

1.$ cd /var/www - Change Directory
2.$ rmdir html (I assumed it is empty. Otherwise 'rm -rf html') - No my current version of moodle is in there 3.5.6 with all configs, so this would remove the entire "html" with the current
moodle files in.
3.$ git clone git://git.moodle.org/moodle.git html - This will create a the following directory "/var/www/html - with the clone
4.$ cd html - Changes directory

- I like adding comments so i understand what each line does.
- If i do step 2 : my original moodle install with my configs and current moodle will be gone ? ,
In reply to sarfaraz Mohamed

Re: Upgrading moodle via GIT

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
I thought you want the new Moodle code directory to be /var/www/html. If it needs to be /var/www/somethingelse then do:
$ cd /var/www
$ git clone git://git.moodle.org/moodle.git somethingelse
In reply to sarfaraz Mohamed

Re: Upgrading moodle via GIT

by Ken Task -
Picture of Particularly helpful Moodlers

First ... ** backup what you have ... code directory and DB are minimal **

Then ...

moodle git cannot be installed in an existing directory.  Your current moodle code is in /var/www/html/ and you don't want to move config.php nor go after any addons, right?

Strategy is called a 'sideload' .. kudos to Howard Miller in these forums!

cd /var/www/ ... note that is one level up from document root (html).

Then:

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

notice the end tells git where to acquire the code ... the htmlgit directory.

After you step through

cd htmlgit

git branch -a

git branch --track MOODLE_37_STABLE origin/MOODLE_37_STABLE

git checkout MOODLE_37_STABLE

check version: fgrep '$release' version.php

If you have acquired what you want, then copy the hidden .git directory and hidden .gitignore to the working document root:

still in htmlgit

cp -rp .git .gitignore ../html/

Then change to your document root:

cd ../html/

ls -ld .git (is it there?)

** make sure by re-issuing **

git branch --track MOODLE_37_STABLE origin/MOODLE_37_STABLE

git checkout MOODLE_37_STABLE

git branch -a

now check ... git pull

nothing to acquire?

Then pull the trigger on upgrading.

php admin/cli/maintenance.php --enable

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

php admin/cli/purge_caches.php

php admin/cli/maintenance.php --disable

Check ownerships/permissions on all files/folders.

Hit with browser.

Can remove htmlgit now.  Should be the last time you have to sideload.  From now on, cd /var/www/html/ and work in the real code directory.

*** Uhhhh ... I did mention ... backup what you have, didn't I? ;) ***

Oh, yeah ... the one thing that will bite ya ... themes ... if you have theme issues after upgrading to 3.7.highest, add a line to config.php for setting theme to one of the stock themes that came with 3.7 ... boost or classic.   Not in Kansas ... again! :\

$CFG-->theme='boost'; .... or 'classic'.


'SoS', Ken


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

Re: Upgrading moodle via GIT

by Ken Task -
Picture of Particularly helpful Moodlers

A couple of potential catch 22's ...

We are assuming you have checked environment of server via moodle's Environment check with current version, updated the component, and checked for issues upgrading to 3.7.highest.

And you know that all your plugins have 3.7.x compat versions.

in config.php what are settings for dbcollation?

Must match tables for moodle DB

Always an 'adventure'!

'SoS', Ken

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

Re: Upgrading moodle via GIT

by sarfaraz Mohamed -
Firstly thank you for the assist
#Backup completed

-- now check ... git pull ---> At this step I get the following issue, I confirmed there is an internet connection

PING 34.210.133.53 (34.210.133.53) 56(84) bytes of data.
64 bytes from 34.210.133.53: icmp_seq=1 ttl=33 time=306 ms
64 bytes from 34.210.133.53: icmp_seq=2 ttl=33 time=292 ms
64 bytes from 34.210.133.53: icmp_seq=3 ttl=33 time=292 ms
64 bytes from 34.210.133.53: icmp_seq=4 ttl=33 time=292 ms

Reading through the forums, if I figure it will post in the forum but stuck here at the moment

NB: Did nothing and tried again before i make any changes and works now :
/var/www/html]$ git pull
Already up-to-date.

Thank you

Attachment moodle iss.JPG
In reply to Ken Task

Re: Upgrading moodle via GIT

by sarfaraz Mohamed -
Issue 2 :
php admin/cli/maintenance.php --enable # Works
---
/var/www/html]$ php admin/cli/maintenance.php --enable
== Maintenance mode (https://learntest.sun.ac.za) ==
Your site is currently in CLI maintenance mode, no web access is allowed.
---

php admin/cli/upgrade.php --non-interactive # Have Issue 2 here

----
/var/www/html]$ php admin/cli/upgrade.php --non-interactive
No upgrade needed for the installed version 3.5.6 (Build: 20190513) (2018051706). Thanks for coming anyway!
----
# Or is it correct in saying that? and I should just continue?
In reply to sarfaraz Mohamed

Re: Upgrading moodle via GIT

by sarfaraz Mohamed -
Am I missing something, why can't I seem to find the edit text button on my other post , can see it on this one
In reply to sarfaraz Mohamed

Re: Upgrading moodle via GIT

by sarfaraz Mohamed -
Do i Need to first upgrade from 3.5.6 to 3.6x and then 3.7x ?
In reply to sarfaraz Mohamed

Re: Upgrading moodle via GIT

by Ken Task -
Picture of Particularly helpful Moodlers
According to:
https://docs.moodle.org/37/en/Upgrading#Check_the_requirements

"You can only upgrade to Moodle 3.7 from Moodle 3.2 or later. If upgrading from earlier versions, you must upgrade to 3.2 as a first step."

So a 3.5.6 to 3.7.highest - which from two days ago is 3.7.2 (Build: 20190909)
Where is "3.7.1-Round2' coming from in your screen shot?

Normally ...
git branch -a
* MOODLE_37_STABLE
master
remotes/origin/HEAD -> origin/master

When you issued upgrade.php and it replied:

No upgrade needed for the installed version 3.5.6 (Build: 20190513) (2018051706). Thanks for coming anyway!

Then moodle still thinks it's 3.5.6

So did we copy from htmlgit to html correctly?
In moodle code directory ... /var/www/html/ issue:
fgrep '$release' version.php
What does it say?

'SoS', Ken
In reply to Ken Task

Re: Upgrading moodle via GIT

by sarfaraz Mohamed -

According to:
https://docs.moodle.org/37/en/Upgrading#Check_the_requirements

"You can only upgrade to Moodle 3.7 from Moodle 3.2 or later. If upgrading from earlier versions, you must upgrade to 3.2 as a first step."  # Read that also was just confirming

So a 3.5.6 to 3.7.highest - which from two days ago is 3.7.2 (Build: 20190909)

Where is "3.7.1-Round2' coming from in your screen shot? #Was playing around with a local git # git commit -am '3.7.1-Round2'

git branch -a
* MOODLE_37_STABLE
master
remotes/origin/HEAD -> origin/master

# Showed that with a couple other branches

Then moodle still thinks it's 3.5.6   # Trying to figure out why

So did we copy from htmlgit to html correctly?               # Yes please see picture below
In moodle code directory ... /var/www/html/ issue:       
fgrep '$release' version.php                                                # Can't remember ended up doing the set up another way.

Still busy sorting some of the plugin gremlins, but it is upgraded to 3.7.2 now will post the steps I took
Note: would still like to figure out what i did wrong though


Attachment Inkedgit cop_LI.jpg
Attachment Inkedmoodle2_LI.jpg
In reply to sarfaraz Mohamed

Re: Upgrading moodle via GIT

by Ken Task -
Picture of Particularly helpful Moodlers

The step in the sideload ... the copy of hidden .git and 'dot' files shows there was already a .git directory in /var/www/html/ and was (maybe a 3.6.x).

That being the case one could have skipped the sideload and work only in /var/www/html/ to upgrade from 3.6.x to highest 3.7.x.

If above true, the following commands would have done that:

git branch --track MOODLE_37_STABLE origin/MOODLE_37_STABLE
git checkout MOODLE_37_STABLE

Then checks:

git branch -a

and fgrep '$release' version.php

If ok ...

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

Usually if one wants to see what one did ...

history [ENTER]

Or if just git commands:

history |grep git

Recently did some testing with newer version of PHPMailer and Unoconv so command above on that server shows:

[root@server ~]# history |grep git
  227  git clone https://github.com/PHPMailer/PHPMailer.git mtest
  735  git clone https://github.com/dagwieers/unoconv.git

I have used history to put together bash shell scripts of a process I desired to do again with just one command.  History doesn't, however, show sequence of commands/context of issued commands and won't show what one might have done in other clients ... like mysql.

If using history for such purpose, do it soon or history will loose commands issued X days ago.

'SoS', Ken




Average of ratings: Useful (1)