Executing of upgrade.php does not work

Executing of upgrade.php does not work

by Roman Müller -
Number of replies: 16

Hello,

i'm using Moodle 4.1 installation with Git. I successfully update minor releases weekly with:

git pull
sudo -u pleskadmin /opt/plesk/php/8.1/bin/php admin/cli/upgrade.php

Upgrade.php is always working as intended. Today i am trying to update to Moodle 4.3 with:

git branch --track MOODLE_403_STABLE origin/MOODLE_403_STABLE
git checkout MOODLE_403_STABLE
sudo -u pleskadmin /opt/plesk/php/8.1/bin/php admin/cli/upgrade.php

Git commands are executed successfully and then on upgrade.php command nothing happens. After a second, the prompt appears again. There is no error message. Upgrade just dont start.
Does anyone have any idea what the problem is and what I can try? Thank you.
Average of ratings: -
In reply to Roman Müller

Re: Executing of upgrade.php does not work

by Ken Task -
Picture of Particularly helpful Moodlers

After the git check out command issue:

git pull

then the upgrade.php script

'SoS', Ken

In reply to Roman Müller

Re: Executing of upgrade.php does not work

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
> sudo -u pleskadmin /opt/plesk/php/8.1/bin/php admin/cli/upgrade.php

Doesn't one need the PHP executable there, like
sudo -u pleskadmin /PATH/TO/php /opt/plesk/php/8.1/bin/php admin/cli/upgrade.php
In reply to Visvanath Ratnaweera

Re: Executing of upgrade.php does not work

by Roman Müller -
Thx for the response. I enabled the debuggin in config.cfg, but can not see any error messages. If i try "git pull" i get the message "already up to date".
I am using plesk on my server and "/opt/plesk/php/8.1/bin/php" is the path to php in this environment.
Its seems to be a php problem to me. I try to install new php version tomorrow.
In reply to Roman Müller

Re: Executing of upgrade.php does not work

by Ken Task -
Picture of Particularly helpful Moodlers

'Already up-to-date' ....

from moodle code directory:

fgrep '$release' version.php

Also, you might have to give full paths ... not only to the version of PHP cli needed but also the full path to the upgrade.php file.

pleskadmin is a real user or an aliased user?

Do all the files/folders in moodle code belong to user 'pleskadmin'?

Do know that Plesk is a lot more restrictive than other panels.

'SoS', Ken

In reply to Roman Müller

Re: Executing of upgrade.php does not work

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
In my earlier reply I haven't noticed a blank character and misunderstood:
> sudo -u pleskadmin /opt/plesk/php/8.1/bin/php admin/cli/upgrade.php
The path to the PHP executable is there. Try the full path to the upgrade.php like
sudo -u pleskadmin /opt/plesk/php/8.1/bin/php /PATH/TO/admin/cli/upgrade.php
Is it still "on upgrade.php command nothing happens. After a second, the prompt appears again"?
In reply to Roman Müller

Re: Executing of upgrade.php does not work

by Ken Task -
Picture of Particularly helpful Moodlers

A couple of more things ...

git banch -a

should show 'main' at the top.

The command line upgrade.php script talks to the DB.   DB ok?

In admin/cli/ run checks.php and check_database_schema.php

'SoS', Ken

In reply to Ken Task

Re: Executing of upgrade.php does not work

by Roman Müller -
Thank you for all the suggestions:
1 fgrep '$release' version.php shows $release=4.1 bevor git checkout and $release=4.3 after.
2 Using full path does not change anything.
3 /opt/plesk/php/8.1/bin/php -v shows PHP 8.1.28 (cli) message.
4 running admin/cli/checks.php works before the git checkout and does also not work after the checkout, like upgrade.php

Its seems to be something wrong with git on my installation. I googled about how force to git pull again and tried to execute: $ git stash --include-untracked
This command actually breaks my installation and delete all plugins, but running php files with commands like
sudo -u pleskadmin /opt/plesk/php/8.1/bin/php admin/cli/checks.php
starts suddenly working again.
In reply to Roman Müller

Re: Executing of upgrade.php does not work

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
You wrote:
> $ git stash --include-untracked
> This command actually breaks my installation and delete all plugins

The lesson, don't copy-and-paste shell commands you found on a random web page!

> but running php files with commands like
> sudo -u pleskadmin /opt/plesk/php/8.1/bin/php admin/cli/checks.php
> starts suddenly working again.

So the sledge hammer solutions have their plus sides. You have an offending additional plug-in!
In reply to Visvanath Ratnaweera

Re: Executing of upgrade.php does not work

by Roman Müller -
Executing random commands is not that big problem. I got several Backups, VMWare Snapshot and additional test moodle installation for trying things out. I'm not doing crazy things on my productive moodle.

Thank you all for your help. It was indeed not a problem with php or git. It was a plugin problem. I got format_grid, format_tiles and format_topcoll plugins temporary removed and upgrade.php start working.
In reply to Roman Müller

Re: Executing of upgrade.php does not work

by Ken Task -
Picture of Particularly helpful Moodlers

So one of the prelims to upgrading is to check addon plugins for compatibility with core destination version! smile

Moodle doesn't have a 'plugins checker' - soooooo ...

Install moosh - version that matches your core.
https://moodle.org/plugins/view.php?id=522

checkaddons script
#!/bin/bash
#
cd /var/www/html/;
echo 'Add-on listing: ';
cat ./addons.txt;
echo '---------------------';
for i in `cat ./addons.txt`
do
   echo "Addon in que: $i";
moosh -n plugin-list |grep $i
done

addons.txt file consist of one liners - short name of plugin.

mod_certificate
mod_checklist
mod_questionnaire
block_checklist
format_grid
format_onetopic
format_topcoll
report_coursesize
report_coursestats
gradeexport_checklist
local_mass_enroll
tinymce_tiny_mce_wiris
atto_wiris
filter_wiris
mod_hvp
report_benchmark
report_customsql

When script is run, output looks like:
./checkaddons
Add-on listing: 
mod_checklist
mod_questionnaire
block_checklist
filter_wiris
atto_wiris
tinymce_tiny_mce_wiris
format_onetopic
format_topcoll
report_allbackups
report_benchmark
report_coursesize
report_coursestats
gradeexport_checklist
local_mailtest

---------------------
Addon in que: mod_checklist
mod_checklist,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.10,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,4.3,4.4,https://moodle.org/plugins/download.php/32138/mod_checklist_moodle44_2024051800.zip
Addon in que: mod_questionnaire
mod_questionnaire,1.9,2.0,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.10,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,https://moodle.org/plugins/download.php/29228/mod_questionnaire_moodle42_2022092202.zip
Addon in que: block_checklist
block_checklist,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.10,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,4.3,4.4,https://moodle.org/plugins/download.php/31737/block_checklist_moodle44_2024040400.zip
Addon in que: filter_wiris
filter_wiris,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.10,3.1,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,4.3,4.4,https://moodle.org/plugins/download.php/31807/filter_wiris_moodle44_2024042300.zip
Addon in que: atto_wiris
atto_wiris,2.7,2.8,2.9,3.0,3.10,3.1,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,4.3,4.4,https://moodle.org/plugins/download.php/31808/atto_wiris_moodle44_2024042300.zip
Addon in que: tinymce_tiny_mce_wiris
tinymce_tiny_mce_wiris,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.10,3.1,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,4.3,https://moodle.org/plugins/download.php/30677/tinymce_tiny_mce_wiris_moodle43_2023121300.zip
Addon in que: format_onetopic
format_onetopic,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.10,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,4.3,4.4,https://moodle.org/plugins/download.php/32105/format_onetopic_moodle44_2024050901.zip
Addon in que: format_topcoll
format_topcoll,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.10,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,4.3,4.4,https://moodle.org/plugins/download.php/31753/format_topcoll_moodle44_2024032800.zip
Addon in que: report_allbackups
report_allbackups,3.10,3.5,3.6,3.7,3.8,3.9,4.0,4.1,https://moodle.org/plugins/download.php/26133/report_allbackups_moodle41_2022031501.zip
Addon in que: report_benchmark
report_benchmark,2.7,2.8,2.9,3.0,3.1,3.10,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,https://moodle.org/plugins/download.php/28451/report_benchmark_moodle41_2023012800.zip
Addon in que: report_coursesize
report_coursesize,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.10,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.9,4.0,4.1,https://moodle.org/plugins/download.php/28315/report_coursesize_moodle41_2023010900.zip
Addon in que: report_coursestats
report_coursestats,2.9,3.0,3.1,3.10,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,4.3,https://moodle.org/plugins/download.php/21951/report_coursestats_moodle43_2020070900.zip
Addon in que: gradeexport_checklist
gradeexport_checklist,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.10,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,4.3,4.4,https://moodle.org/plugins/download.php/31738/gradeexport_checklist_moodle44_2024040500.zip
Addon in que: local_mailtest
local_mailtest,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.10,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,4.3,4.4,https://moodle.org/plugins/download.php/31843/local_mailtest_moodle44_2024042801.zip


If you see a line that does not offer a destination version of the plugin,
it goes.

In above example from a live 4.1.highest server git installed and maintained,
you can see one that shows a 4.2 zip.

Addon in que: mod_questionnaire
mod_questionnaire,1.9,2.0,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.10,3.11,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,4.0,4.1,4.2,https://moodle.org/plugins/download.php/29228/mod_questionnaire_moodle42_2022092202.zip

There is a good chance that attempt to upgrade to 4.4 might fail due to the above
plugin.   Decision then is to contact maintainer of the plugin to inquire or
remove the plugin properly prior to upgrade attempt.

'SoS', Ken

In reply to Ken Task

Re: Executing of upgrade.php does not work

by Roman Müller -
Thank you, then one last question. I have some plugins that are only supported up to version 4.0 or 4.1. Nevertheless, they do not cause any problems when updating and also run under 4.3 or 4.4. Is it safe to leave these plugins installed or does the plugin version have to correspond to the Moodle version.
In reply to Roman Müller

Re: Executing of upgrade.php does not work

by Ken Task -
Picture of Particularly helpful Moodlers

How could I possibly answer that question since I don't program any of those plugins myself?

The only answer I could give is to point to your own experience - Incompatible plugins wrecked your git core upgrade.   When you erased those plugins, core upgrade worked.   Conclusion is?

At least you are forewarned of potential issues and have the knowledge of how to fix it.

Nice thing about moodle - it has plugins!   Bad thing about moodle is the same - it has plugins!

To my way of thinking ... core 'trumps' (no political pun intended)  plugins.

One more suggestion ... now that you have upgraded, run the cli only check_database_schema.php script.

If it reports issues ... fix 'em.

After everything reports green and no issues DB, make a full site backup - from command line using tar for code and moodledata/filedir/ and using mysqldump for DB to a backup directory on server.   If you have old backups, delete them so you won't be confused should you be forced to use a full site restore.

'SoS', Ken

In reply to Roman Müller

Re: Executing of upgrade.php does not work

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
As Ken mentions, you should check the plugins before upgrades, but this is where it is handy to have a development site. Do your upgrade on it first and if the plugins work okay there, then they should be okay on your production site also.

Personally, I have a few plugins that are not supported yet in Moodle 4.4, but I have fixed them myself, as needed.

@Ken, thanks for the reminder regarding the, check_database_schema.php script. I had six items I needed to fix on two of my plugins, and I see a bunch of others that I will need to pass along to the plugin maintainers.
In reply to AL Rachels

Re: Executing of upgrade.php does not work

by Ken Task -
Picture of Particularly helpful Moodlers

@Al ... welcome.   Ya know, I seem to keep adding to my check list of before update/upgrades and after update/upgrades.   With the schema check, I found some DB issues that had never 'whoopied' and have not a clue as to how they came to be!!! sad - missing columns, wrong data values in columns, even a missing core table!!!

Moodle is definitely a continuous work in progress! smile

'SoS', Ken