Doh! Moodle 3.7 upgrade errors

Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Number of replies: 23

https://education.ucemergency.com
Hosted e-commerce VPS hosted.

My host (TMD Hosting) updated my Moodle to 3.7. Threw an error indicating it conflicted with a theme (Lambda) :

Fatal error: Access level to theme_lambda_core_renderer::build_action_menu_from_navigation() must be protected (as in class core_renderer) or weaker in /home/emergency/public_html/theme/lambda/renderers/core_renderer.php on line 0

Ironically, I didn't even think we were using Lamda (was uploaded as an option, didnt like it, went with boost).

Deleted all occurrences of Lamda which should default me to Boost.  But it keeps erroring at Admin login reporting that Lamda is being used or called and output.php errors as below.  Note: Student/Test account can login without issue but Admin throws this error

Notice: Undefined property: stdClass::$layouts in /home/emergency/public_html/lib/outputlib.php on line 796
Warning: Invalid argument supplied for foreach() in /home/emergency/public_html/lib/outputlib.php on line 796

This page should be using theme lambda which cannot be initialised. Falling back to the site theme boost
  • line 704 of /lib/outputlib.php: call to debugging()
  • line 7348 of /lib/moodlelib.php: call to theme_config::load()
  • line 702 of /lib/classes/user.php: call to get_list_of_themes()
  • line 863 of /lib/classes/user.php: call to core_user::fill_properties_cache()
  • line 832 of /lib/classes/user.php: call to core_user::get_property_type()
  • line 59 of /user/lib.php: call to core_user::clean_field()
  • line 4007 of /lib/moodlelib.php: call to user_create_user()
  • line 4497 of /lib/moodlelib.php: call to create_user_record()
  • line 143 of /login/index.php: call to authenticate_user_login()
Notice: Undefined property: stdClass::$layouts in /home/emergency/public_html/lib/outputlib.php on line 796
Warning: Invalid argument supplied for foreach() in /home/emergency/public_html/lib/outputlib.php on line 796

_____________________________

TMD says its theme, theme developer logged in and says its TMD.  Lovely.  Cant find any reference to Lambda via cPanel and not sure why Lambda absence isnt calling a default theme.

As always, thanks for any tips for this neophites.

https://education.ucemergency.com

DB Server:

  • Server: Localhost via UNIX socket
  • Server type: MariaDB
  • Server connection: SSL is not being used Documentation
  • Server version: 10.2.24-MariaDB - MariaDB Server
  • Protocol version: 10
  • User: emergency@localhost
  • Server charset: UTF-8 Unicode (utf8)
Web Server

  • cpsrvd 11.78.0.24
  • Database client version: libmysql - 5.1.73
  • PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation
  • PHP version: 7.2.7
PhPMyAdmin  
  • Version information: 4.8.3

Average of ratings: -
In reply to Todd W. Roat

Re: Doh! Moodle 3.7 upgrade errors

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
If you are able to access admin settings, go in and set theme to boost. If you cannot get that far, you can set it in your config file...a quick google will show you how.
Average of ratings: Useful (1)
In reply to Todd W. Roat

Re: Doh! Moodle 3.7 upgrade errors

by Ken Task -
Picture of Particularly helpful Moodlers

You've probably resolved this by now ... admin users a 'special' and sometimes things are working for everyone else ... just not admin.  In such cases, I've had to manually remove all the session files in the sessions directory of moodledata, purge server cache as well as cookies and cache from browser.  Not fun!

So what I do now to avoid such things ... if fresh install, the very first category and course created is one for 'SA' ... system admins.  Themes are allowed at category/course level and I always use a 'stock theme' for the SA category and SA course - hidden, no one assigned, admin level users can see it ... I know that course is ID 2 - ID 1 is front page.   So when I have such issues, I know I can go directly to the SA course via URL and the theme is set to a stock/came with moodle version.

If not a fresh install do above any way and bookmark/favorite the course.

Have even gone to the lengths of installing a 'sos.html' page that doesn't use config.php and points to admin areas of config ... like theme .. that would allow admin to get to certain areas of admin.

Anyhooo .... 2 cent sharing!

'SoS', Ken

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

Re: Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Thanks for the replies! Kens idea is a great solution for the future.

Currently I just cant get past this issue : can only login as admin if I use the Forgot Password option on login screen. Weird. Was hoping to add new user then grant them Site Admin status but its not writing to database and cant create new user via web interface.

Caches cleared, homage to the Gods complete, stuck.  I switched back to classic then back to boost but still issues.

Interestingly, and a little new (or just noticed), within the web interface sit admin area, the same errors appear in the top of many pages, like its info being called into that spot:

errors



Attachment 2019-05-29_14-33-43.jpg
In reply to Todd W. Roat

Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Ken Task -
Picture of Particularly helpful Moodlers

Tough position to be in ... commercial theme, is it not?   So unless someone here in community just happens to have upgraded to 3.7+ recently and has purchased Lambda .... ????

And some major changes to theme in 3.7.  What did you upgrade from?

Wouldn't be the first time this happened, but wonder if even after un-installing lamdba's theme, some related rows in DB didn't get cleaned up nor changed.

If you run this query on the db for your site one should see only boost and classic rows.

select * from mdl_config_plugins where plugin like '%theme%';

Caching is still located in moodledata/

Have you tried manually removing the contents of moodledata/localcache/theme/

Safe to do as moodle will re-cache upon any users next use of the site.

'SoS', Ken


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

Re: Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Thanks Ken.

Its is a commercial theme. Tried it and didnt like it, switched to Boost. The developer did look into and does not think its the theme.

I upgraded from 3.6 I believe.

I will try and check for Lambda debris remains in DB and report back.

Thought I manually deleted the cache theme area but will try again to make sure.
In reply to Todd W. Roat

Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Deleted More, and Clean and the top breadcrumb nav that was throwing errors is fixed. Now just need to resolve site admin user cant login w/o reset password.

fixed
In reply to Todd W. Roat

Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Some new clues. In public_html/theme the config and version.php both reference lambda!
Additionally, in the public_html/theme folder I have two other themes or elements: MORE and Bootstrapbase.  Delete them all?  

Theme Folder
themes

public_html/themes/config.php
config

public_html/themes/version.php
version

In MORE theme config and version:
more config more version
In reply to Todd W. Roat

Re: Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Closer still?

Saw a post about similar fissue: https://moodle.org/mod/forum/discuss.php?d=350767 and removing custom check from admin/environemnt.xml

This helped I think. OI can now login but the debugger throws the following now. Possible duplicate admin account?


Debug info: Duplicate entry '1-admin' for key 'mdl3c_user_mneuse_uix'
INSERT INTO mdl3c_user (city,auth,username,lang,confirmed,lastip,timecreated,timemodified,mnethostid,calendartype,maildisplay,mailformat,maildigest,autosubscribe,trackforums) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[array (
0 => '',
1 => 'manual',
2 => 'admin',
3 => 'en',
4 => 1,
5 => '65.31.36.3',
6 => 1559176475,
7 => 1559176475,
8 => '1',
9 => 'gregorian',
10 => '0',
11 => '1',
12 => '0',
13 => '0',
14 => '0',
)]
Error code: dmlwriteexception
×Stack trace:
line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
line 1329 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 1375 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
line 111 of /user/lib.php: call to mysqli_native_moodle_database->insert_record()
line 4007 of /lib/moodlelib.php: call to user_create_user()
line 4497 of /lib/moodlelib.php: call to create_user_record()
line 143 of /login/index.php: call to authenticate_user_login()
In reply to Todd W. Roat

Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Ken Task -
Picture of Particularly helpful Moodlers

In your config.php file, what does the line for 'dbcollation' have?

Have seen  similar error with others who have a database not in sync with that variable.

If you can run command line scripts, go to moodlecode/admin/cli/ and run php mysql_collation.php -l (that's a lower case 'L' switch).

At the bottom of what scrolls a summation of all tables, columns in those tables for collation.   Should have something like:

Table collations summary for https://server:
utf8mb4_general_ci: 1494

If yours shows a mix ... fix with same script.

Also run:

php mysql_compressed_rows.php -i

Best if you see:

Database engine:       InnoDB
innodb_file_per_table: ON
innodb_file_format:    Barracuda

See: https://docs.moodle.org/37/en/MySQL_full_unicode_support

'SoS', Ken


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

Re: Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Under the root folder public_html/theme there is a config.php file there . It has no reference to dbcollation. Also noticed that file is encoded with just utf-8 if important.

One folder lower is boost public_html/theme/boost and its config.php file also shows no dbcollation line.

Will start studying up on the running scripts, havent dont it. Long long path of learning to go. Thanks for all the guidance.
In reply to Todd W. Roat

Re: Re: Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Ken Task -
Picture of Particularly helpful Moodlers

The config.php file for the site is at the root of the 3.7 moodle code.  It's at the same level as mods, blocks, theme ..  That's the config.php that has settings that pertain to the entire site ... among those, DB server, DB user, DB password, DB prefix, and an array for DB options which might/should contain a line for 'dbcollation'

While there are other config.php files, they are located in sub-directories ... not at roots of places like 'theme'.

Example (and not suggesting you do anything with them unless you know what you are doing):

./theme/boost/config.php
./theme/classic/config.php

Am assuming you are using a 'stock' moodle and not a fork of moodle code.

It appears, you might have inadvertently unzipped something that should have been in a directory in your theme directory.

To find out, download the 3.7 code to your local machine and unzip it.

Compare what you see in the locally unzipped code folder (theme) to what you see on the servers theme folder - which you shared via:

https://moodle.org/mod/forum/discuss.php?d=386778#p1559419

'SoS', Ken


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

Re: Re: Re: Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Thanks Ken, will do. Ironically, there is already a 3.7+ and Im not sure which they host techs installed but will find out. If I only have 3.7 I am NOT upgrading to PLUS!
In reply to Ken Task

Re: Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Done. Just had a few left as general utf one.

Converted: 18, skipped: 1559, errors: 0

emergency@vm1277 [~/public_html/admin/cli]# php mysql_compressed_rows.php -i
Database version: 5.5.5-10.2.24-MariaDB
Database name: emergency_moo333
Database engine: InnoDB
innodb_file_per_table: ON
innodb_file_format: Barracuda

Purged caches.  Problem still persists but learned a TON about terminal and running commands!
Still feels like the duplicate admin entry may be issue.   It still shows in the debug screen results:

Debug info: Duplicate entry '1-admin' for key 'mdl3c_user_mneuse_uix'
INSERT INTO mdl3c_user (city,auth,username,lang,confirmed,lastip,timecreated,timemodified,mnethostid,calendartype,maildisplay,mailformat,maildigest,autosubscribe,trackforums) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[array (
In reply to Todd W. Roat

Re: Re: Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Ken Task -
Picture of Particularly helpful Moodlers

Ok, back to the main config.php file.

In the $CFG->dboptions = array section what is the setting for

dbcollation

That must match what one sees in the output of

Bottom of mine: php mysql_collation.php -l

mdl_workshopform_rubric_levels          utf8mb4_general_ci
    definition                          utf8mb4_general_ci

My main config.php file db options has:

  'dbcollation' => 'utf8mb4_general_ci'

'SoS', Ken

Average of ratings: Useful (2)
In reply to Todd W. Roat

Re: Re: Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
SWEET BABY JESUS im in! Thanks Ken. My last changed was the persistent error in the Server > Enivronemnt check was still showing "The current setup of MySQL or MariaDB is using 'utf8'. This character set does not support four byte characters..."

So some forum searching here suggested changing 'dbcollation' in config.php to utf8mb4_general_ci. RESOLVED. And of course, Ken was part of that threat solution as well.

Terrifying experience but learned a lot:

1. how volatile third party themes are even if they claim 3.7 compatibility
2. Terminal use and script running
3. searching within config.php files for clues
4. running debug mode
5. why I should have a separate page/login for Site admins
6. Never upgrade again! (just kidding, I think)

Remaining global questions:

1. since Im not supposed to have config.php in the root theme folder can I delete it? Should there be any files in there other that the BOOST and CLEAN folders?
2. Host provider said they have enabled weekly site backup. Should I trust them but still make my own? I assume they mean full image backup of that instance in time.
3. How to I set up a test environment to duplicate my existing site and test with new versions? Existing how to documents pretty complex.
In reply to Todd W. Roat

Re: Re: Re: Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Ken Task -
Picture of Particularly helpful Moodlers

Feel free to rate postings that helped as 'useful'. smile

Remaining global questions:

1. since Im not supposed to have config.php in the root theme folder can I delete it? Should there be any files in there other that the BOOST and CLEAN folders?

Make a backup ... then check to see if Moodle admin even sees those themes in config. If it does, use moodle admin UI to un-install ... that not only removes the files/folders but also removes tables in DB.

Once you have cleaned up, make another full site backup and delete the old backups.


https://docs.moodle.org/37/en/Moodle_migration
but you are not moving to another server just setting up the clone of production using virtual apaches (or whatever they call that in IIS) ... site by slightly different FQDN ... like 'dev.yourtopleveldomain'.  dev site has its own DB, its own code directory, and its own moodledata.

What might prevent that is size of moodledata.  Depends upon hosting environment/space, etc.

IMHO, make backups of your own.
https://docs.moodle.org/37/en/Site_backup


2. Host provider said they have enabled weekly site backup. Should I trust them but still make my own? I assume they mean full image backup of that instance in time.

See above.  If you use their 'weekly backups', you could loose a weeks worth.   Best you control backups ... make your own.  If students just finished a major section of work, make a backup ... site + course.

3. How to I set up a test environment to duplicate my existing site and test with new versions? Existing how to documents pretty complex.

See above.  Before you embark ... *** make a full site backup ***

On your next upgrade, check environment first.  If you add any plugins, check those plugins for compatibility with version you are upgrading to.

'SoS', Ken

Average of ratings: Useful (1)
In reply to Todd W. Roat

Re: Doh! Moodle 3.7 upgrade errors - final response ...

by Ken Task -
Picture of Particularly helpful Moodlers

You've learned alot ...

Terrifying experience but learned a lot:

1. how volatile third party themes are even if they claim 3.7 compatibility
2. Terminal use and script running
3. searching within config.php files for clues
4. running debug mode

* 5. why I should have a separate page/login for Site admins

Probably should be in advocacy, but ... this, IMHO, should be built into core Moodle.   Having theme being inline, like it is now, and for everything Moodle ... including admin area ... when it goes 'south', big problems and many work-arounds to be able to fix.

IMHO, should be more like Joomla ... where admin area is a different theme/interface .. one that's stock for the version of Moodle.  Why?  If the front end isn't working admins can still get to the sites admin interface.

6. Never upgrade again! (just kidding, I think)

Hope so.  Now if I followed your situation correctly, remotely hosted Windows and TMD did the upgrade?   So must be a managed account ... provider does the heavy stuff, you just do the apps.

And, you got in between 'rock' and 'hard place' where theme author said it was provider and provider said it was the app/theme.   Hmmm ... been there done that many moons ago.   It's what encouraged me to go Linux and learn.  In defense of parties ... hosting providers rarely say or go into apps ... especially those that are not Moodle Partner.  Author ... taking a look at a specific server is going the extra mile ... after all, it's been tested!!!

Now you made mention that you didn't want to upgrade from 3.7.0 to 3.7+ ... understandable ... but it's so easy to do using git.

Some will disagree, but ... a .0 is right out of the 'shrink wrap' so to speak ... for all practical purposes, OP is an 'omicron tester' (IMHO).  Yes, it's 'stable' but there will be  updates forth coming and soon.   Moodle releases new code (fixes/patches) every week ... that's why the + version.

As a general rule, I won't upgrade from the 3.6.x am on to 3.7 until a .1 or .2 has been released.   If I want to get a look at it, install a fresh 3.7.x dev site on Linux box using git ... takes just a few minutes ... and look at it there.   Only if I saw something very compelling in core would I consider upgrading the 3.6.x - not wihout checking plugins I had installed in the 3.6.x however.

In case you hadn't noticed, more often than not, the docs for Moodle talk about/show Linux ... and Ubuntu specific at that .... hmmmm ...

Bigger picture ... even Microsoft is changing directions ... with their Azure they have developed their own Linux (Balmer was wrong ... not a 'cancer') to act as a shim for the most popular guest OS on Azure ... Ubuntu!  Now think about that a minute ... Azure should have Windows servers right?

Besides that ... just look at major hosting providers ... like TMD where you host ... bet they offer more Linux than Windows and that hosting cost more ... most providers do ... only makes sense ... FREE OS ... no cals, no licensing, etc.

Microsoft is surrounded by Linuxes ... even on desktop!!!

Suggestion ... maybe it's time for you to lease a Linux flavored server??!!!

This from a confessed Linux bigot ... so do your own research. smile

'Spirit of Sharing', Ken

Average of ratings: Useful (1)
In reply to Todd W. Roat

Re: Re: Doh! Moodle 3.7 upgrade errors

by Ken Task -
Picture of Particularly helpful Moodlers

In a site upgraded from 3.6 to 3.7, there is no config.php file in theme and only boost and classic directories exist in that directory.

I use git to upgrade.   You must be following the typical docs of copy back into new code plugins addons from old code to new code.

[root@server theme]# pwd
/var/www/html/moodle37/theme
[root@server theme]# ls
boost     image.php       jquery.php        switchdevice.php  yui_image.php
classic   index.php       styles_debug.php  upgrade.txt
font.php  javascript.php  styles.php        yui_combo.php

'SoS', Ken

Average of ratings: Useful (1)
In reply to Todd W. Roat

Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Maybe Im not out of the woods. Looks great on work computer. At home PC it looks like formatting gone.  https://education.ucemergency.com

Work PC:                                                                                                                   HOME PC:

work pc unformatted
In reply to Todd W. Roat

Re: Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Tragedy narrowly averted. I resolved the no formatting issue by putting all the files below BACK into the root of public_html/theme, where I thought I should only have the Boost and Classic folder. in the new 3.7 design. 

fix


In reply to Todd W. Roat

Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Ken Task -
Picture of Particularly helpful Moodlers

Not sure am a perfectionist, but ....

a 3.7+ theme directory that never had Lambda or any other theme other than the stock themes of a 3.7:

[root@server theme]# pwd (shows present working directory)
/var/www/html/moodle37/theme

[root@sos theme]# ls -1 (ls command just list files/folders at theme location)

boost - is a folder
classic - is a folder ... remaining are files ...
font.php
image.php
index.php
javascript.php
jquery.php
styles_debug.php
styles.php
switchdevice.php
upgrade.txt
yui_combo.php
yui_image.php

Suggest you archive ... move out to a keep directory ... any file not listed above.

If you don't and later decide that you need a 'fix' to your 3.7, who knows if leaving those files that shouldn't be there are there.

Moving them out to an archive location should not necessitate a reboot or restart, just login and refresh screen.

Also run your cron job

cd moodlecode/admin/cli/

php cron.php [ENTER]

'SoS', Ken

Back to NBA Finals! smile


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

Re: Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Todd W. Roat -
Yep, that was correct. Backed up and removed config, lib, renderers, settings, and version and the site remained stable with just the core files you listed. Thanks again!
In reply to Todd W. Roat

Re: Re: Re: Re: Re: Doh! Moodle 3.7 upgrade errors

by Ken Task -
Picture of Particularly helpful Moodlers

Weclome for the 'thanks' ... but there is another way to say 'thanks' and at the same time help those who have helped earn their 'moodle badges'.

Rate those responses that were helpful as 'helpful'.

Am guessing you are using direct email responses to postings and may not see the 'Rate' dialog box at the bottom of those messages in your inbox.  So visit this thread, login, and see if there is a 'Rate' button at the bottom of postings.

'SoS', Ken