Upgrading from command line

Upgrading from command line

Jonathan Lackey發表於
Number of replies: 12

Hello all.

I've been getting this error for a while now when trying to upgrade via the command line...

"No upgrade needed for the installed version 3.1.1+ (Build: 20160811) (2016052301.06). Thanks for coming anyway!"

Of course the admin area says otherwise.

Any ideas on what could be causing this? I've check file permissions on everything and I think they are correct.

Any and all help is greatly appreciated.

-Jon

評比平均分數: -
In reply to Jonathan Lackey

Re: Upgrading from command line

Rick Jerz發表於
Particularly helpful Moodlers的相片 Testers的相片

Others might know exactly what happened, but I don't.  What I wonder is what command did you issue?  Also, what did you intend to upgrade?  Your Moodle? Plug-ins?  mySQL?  Apache?

In reply to Rick Jerz

Re: Upgrading from command line

Jonathan Lackey發表於

Sorry for the lack of details. I'm a bit new to Moodle.

I'm trying...

"php admin/cli/upgrade.php"

I am trying to upgrade the Moodle core from 3.1.1+ to 3.1.2+

Thanks for the reply!

In reply to Jonathan Lackey

Re: Upgrading from command line

Rick Jerz發表於
Particularly helpful Moodlers的相片 Testers的相片

Welcome to the world of "upgrading Moodle."  There are many ways, but quite honestly I did not know about the command line approach that you are trying, nor do I know if it would every work.

Have you reviewed these instructions from the Moodle docs yet?

What is your Linux skill level?  Do you know how to SSH into your server?  Is your server Linux or Windows?

In reply to Jonathan Lackey

Re: Upgrading from command line

Just H發表於

Dumb question, but you have updated the code I assume?

In reply to Just H

Re: Upgrading from command line

Jonathan Lackey發表於

Actually not a dumb question at all. I do not have updated code. I am trying to upgrade from 3.1.1+ to 3.1.2+.

I assumed that doing the upgrade via the command line automatically downloaded the updated code base/patches/whatnot. Based on your comment I'm guessing that is not the case?????

Thanks for the reply!

In reply to Jonathan Lackey

Re: Upgrading from command line

Just H發表於

Sadly not ... unless I've missed a massive announcement 大笑 Hopefully we'll get there eventually though, it has been raised a number of times over the years.

Until then, you have to grab the latest code yourself.

In reply to Jonathan Lackey

Re: Upgrading from command line

Ken Task發表於
Particularly helpful Moodlers的相片

Well, you've got command line.   Does your server have git?

whereis git

If so there's a way to not only install but easily upgrade (acquire new code) using git and those scripts you've discovered in moodlecode/admin/cli/   IMHO, well worth the effort (not all that tough) to set Moodle up the  git way - can update or upgrade in a matter of minutes.

'spirit of sharing', Ken

評比平均分數:Useful (1)
In reply to Ken Task

Re: Upgrading from command line

Jonathan Lackey發表於

Thanks, Ken!

I've pulled down the latest codebase following the instructions here https://docs.moodle.org/31/en/Git_for_Administrators

I'm not sure I have things in the correct place though. I have a directory called "moodle" which is what was created by the GIT pull. This directory is at the root of my Moodle installation/codebase.

When I do the upgrade.php script from admin/cli I am still getting the message that there is "no upgrade needed for the installed version 3.1.1+".

Any ideas? Does my GIT repo need to be up a level (outside of the Moodle installation)?

In reply to Jonathan Lackey

Re: Upgrading from command line

Ken Task發表於
Particularly helpful Moodlers的相片

First, before doing any below, make a tar ball backup of current code directory and get an sql dump of your current DB.    Always that before doing anything with git.   This provides a fall back to what you had before updating or upgrading.

Ok, what has happend ... using git according the docs provided you assumed you had no previously installed moodle code directory.    Thus when you issued the git command to acquire the moodle code that automatically created a 'moodle' code directory - which now resides in the code directory you already had.   So that directory has the hidden .git directory.

So since I don't know full paths to your stuff in this example below the current moodle code is in

/var/www/html/

you executed the git commands inside there

thus what was created was /var/www/html/moodle/

IF that is correct, then here's the easy fix

cd /var/www/html/moodle/

To check for the hidden git directory: ls -ld .git (note the dot in front of git)

We need to move the hidden .git directory up on level to the location of the code you already have at /var/www/html/

from /var/www/html/moodle/

cp -rp .git ../ [ENTER]

to see if that did make a copy of the hidden .git directory while still in /var/www/html/moodle/ issue: ls -d ../git

is it there?  Great!

Now cd ../ to get out of the git acquired moodle directory.

Now run:

git branch -a

That command should show you what version of Moodle is being tracked according to git.

You should see:

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

The * indicates the version

Great!  That's what we want.

Now run at /var/www/html/

git pull [ENTER]

You'll see the screen display all things git is doing .... as an example at the end might show something like this:

 user/editadvanced_form.php                         |   2 +-
 user/profile/definelib.php                         |   8 +-
 user/profile/index.php                             |   2 +-
 version.php                                        |   4 +-
 webservice/lib.php                                 |  10 ++
 140 files changed, 1350 insertions(+), 470 deletions(-)
 create mode 100644 blocks/navigation/tests/behat/participants_link.feature
 create mode 100644 lib/tests/progress_display_test.php

Check the version git has acquired.   You are in /var/www/html/

fgrep '$release' version.php

You should see the highest available 3.1:

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

Now we are ready to update/upgrade.

You are in /var/www/html/

php admin/cli/cron.php

php admin/cli/maintenance.php --enable

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

The above will upgrade the DB

php admin/cli/maintenace.php --disable

*** important .... everything you have done might have done as the root user of your system.

Reset all files/directories to the apache user and apache group ... dunno what that is for your system but on mine ... CentOS ... that's apache:apache

So am in /var/www/html/

chown apache:apache * -R

The -R is recursive and will go down into every directory/file and change the ownerships to user apache group apache.

Now we're done.

Hit site with browser.   Check to see if everything works ok.

One last thing ... remove the git acquired directory ... *** make sure you are in the right location *** following the example, you are in /var/www/html/ where the git acquire moodle directory is located.

rm -fR moodle [ENTER].

Now you are done!

'spirit of sharing' Ken




In reply to Ken Task

Re: Upgrading from command line

monika sharma發表於

I have also facing the same problem with command line error . i still working on the to resolved the error but it will not working for me . so i think i should hire any person to resolved my this error and i shold pay for this one .

In reply to monika sharma

Re: Upgrading from command line

Albert Ramsbottom發表於

No Monika you should not

Why are you upgrading? You do not have to use the CLI upgrade

Have you replaced your old codebase with the new one? if you have just browse to the site and upgrade it

Albert