upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

by mart van der niet -
Number of replies: 10

Could someone please shed light on this problem?

 

Trying to upgrade from 3.1 to 3.4.1

PHP: 7.1.2

DB: 10.0.34-MariaDB - MariaDB Server

Steps taken:

  • Produced clone environment with moodle_data present there
  • Copied old database to temp_version
  • Set temp_version to utf8mb4_general_ci
  • Copied moodle-3.4.1.zip to clone environment and unzipped
  • Adapted config.php to refer to clone environment: wwwroot, dataroot and db
  • Copied config.php to clone root

Started from browser.

Result see TRACE below.

What baffles me is "moodle/site:maintenanceaccess was not found! " : this capablity is not in mdl_capabilities, so of course it is not found in the db before upgrading...

Any ideas?

 
TRACE:

Capability "moodle/site:maintenanceaccess" was not found! This has to be fixed in code.
  • line 416 of /lib/accesslib.php: call to debugging()
  • line 56 of /index.php: call to has_capability()
Error reading from database
Debug info: Unknown column 'bi.requiredbytheme' in 'field list'
SELECT
bi.id,
COALESCE(bp.id, bs.id) AS blockpositionid,
bi.blockname,
bi.parentcontextid,
bi.showinsubcontexts,
bi.pagetypepattern,
bi.requiredbytheme,
bi.subpagepattern,
bi.defaultregion,
bi.defaultweight,
COALESCE(bp.visible, bs.visible, 1) AS visible,
COALESCE(bp.region, bs.region, bi.defaultregion) AS region,
COALESCE(bp.weight, bs.weight, bi.defaultweight) AS weight,
bi.configdata
, ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstance

FROM mdl_block_instances bi
JOIN mdl_block b ON bi.blockname = b.name
LEFT JOIN mdl_block_positions bp ON bp.blockinstanceid = bi.id
AND bp.contextid = ?
AND bp.pagetype = ?
AND bp.subpage = ?
LEFT JOIN mdl_block_positions bs ON bs.blockinstanceid = bi.id
AND bs.contextid = ?
AND bs.pagetype = ?
AND bs.subpage = ?
LEFT JOIN mdl_context ctx ON (ctx.instanceid = bi.id AND ctx.contextlevel = ?)

WHERE
(bi.parentcontextid IN (?, ?) OR (bi.showinsubcontexts = 1 AND bi.parentcontextid = ?))
AND bi.pagetypepattern IN (?,?,?,?)
AND (bi.subpagepattern IS NULL OR bi.subpagepattern = ?)
AND (bp.visible = 1 OR bp.visible IS NULL) AND (bs.visible = 1 OR bs.visible IS NULL)
AND b.visible = 1
AND ((bi.blockname IN (?,?) AND bi.requiredbytheme = 1) OR (bi.blockname NOT IN (?,?) AND bi.requiredbytheme = 0))

ORDER BY
COALESCE(bp.region, bs.region, bi.defaultregion),
COALESCE(bp.weight, bs.weight, bi.defaultweight),
bi.id
[array (
0 => 2,
1 => 'site-index',
2 => '',
3 => 1,
4 => 'site-index',
5 => '',
6 => 80,
7 => 2,
8 => 1,
9 => '1',
10 => 'site-index',
11 => 'site-index-*',
12 => 'site-*',
13 => '*',
14 => '',
15 => 'navigation',
16 => 'settings',
17 => 'navigation',
18 => 'settings',
)]
Error code: dmlreadexception
Stack trace:
  • line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
  • line 1155 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 791 of /lib/blocklib.php: call to mysqli_native_moodle_database->get_recordset_sql()
  • line 1499 of /lib/pagelib.php: call to block_manager->load_blocks()
  • line 975 of /lib/pagelib.php: call to moodle_page->starting_output()
  • line 1186 of /lib/outputrenderers.php: call to moodle_page->set_state()
  • line 117 of /index.php: call to core_renderer->header()
Average of ratings: -
In reply to mart van der niet

Re: upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

by Nilesh Pathade -

Hi Mart

Try to follow : https://docs.moodle.org/34/en/Upgrading 

Put your site into maintenance mode.

Docs makes help you !!! 

In reply to Nilesh Pathade

Re: upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

by mart van der niet -

Can't do it when the side is not up&running.

Why would it help??

In reply to mart van der niet

Re: upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

by Ken Task -
Picture of Particularly helpful Moodlers

Oh, but you can put  site in maintenance mode .... via entry in config.php.

Even if site is not up for viewing via apache, there is a command line only script in newcode/admin/cli/ that should show all settings ...

cd /path/to/moodle_code/admin/cli/

php cfg.php

Will scroll with too much info ...  so to capture all the settings to a text file:

php cfg.php > configsettings.txt

Since the error is about capabilities ... BTW, I checked the tables of a 3.1 and that value is not present ... but it is in 3.2,3.3, an a 3.4 ... and related to maintenace mode, you could try adding a line to the config.php file of the new 3.4.x code.  To take site out of maintenance mode:

$CFG->maintenance_enabled='0';

While on is at the command line, in admin/cli/ there is a script to check database schema:

Since you made changes to DB, might be a good idea to check

php check_database_schema.php

And one could attempt and upgrade in admin/cli/ as well.

php upgrade.php

this takes apache out of the loop.

'spirit of sharing', Ken


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

Re: upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

by mart van der niet -

Thanks for the reply, but setting maintenane mode does not help:

 

Capability "moodle/site:maintenanceaccess" was not found! This has to be fixed in code.
  • line 416 of /lib/accesslib.php: call to debugging()
  • line 56 of /index.php: call to has_capability()
 

XXXX

The site is undergoing maintenance and is currently not available

The system is upgrading

We'll be up & running as soon as possible!

In reply to mart van der niet

Re: upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

by Ken Task -
Picture of Particularly helpful Moodlers

Ok, we are gaining on it ... believe it or not.

Got a couple of probems ... .

Recheck ownerships and permissions on the directory you created to hold the new code

Does the DB user have alter priv's on your DB for Moodle?   Do you have a 'superuser' for your DB server?

Change the DB user and password to the 'superuser's' credentials.   Also ...

the stack trace is a about a block and a theme. You might have had a block in the old version of code that's not compat with new version of code and the theme might also have issues with 3.4.x.

Add to config.php a line to force the theme to a stock theme that comes with the 3.4.x code:

$CFG-->theme='clean';

or you could use 'more'.

Do you happen to re-call if you added a block to old site?

Did you have access to command line?

'spirit of sharing', Ken


In reply to Ken Task

Re: upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

by Ken Task -
Picture of Particularly helpful Moodlers

Well, looks  like you've been successful in upgrading 'nimo'. ;)

Essentials theme is large ... many settings ... changing the theme to a default theme that comes with version is sometimes needed.

Congrats! ;)

'spirit of sharing', Ken


In reply to Ken Task

Re: upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

by mart van der niet -

Think I found the solution:

As this was a clone (for testing purpose) from the production site, in the cache moodledata/muc there was a copy of config.php from the original site. I think that somewhere in the upgrade this copy is used and its $CFG won't work of course.

Removing the old version and let Moodle put a fresh version there solved the problem. (lots of other problems to go....)

 

Thanks for your efforts!

In reply to mart van der niet

Re: upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

by Ken Task -
Picture of Particularly helpful Moodlers

Again ... congrats!   Come to think of it, I use git to update sites and I've resorted to clearing server caches as the very last item in the CLI script now.

Me thinks it's kinda getting to the point where one should use git to update/upgrade ... why?   Moodle releases new code (fixes) every week ... updated a 3.4.1 to a 3.4.1+ today.   The '+' does mean something fixed!

Think you might have experienced/discovered really a bug ... but difficult to report in tracker as one might have a hard time providing info to replicate the issue ... maybe not ... if somone had the interest and the time.

But, you've peaked my interest ... 'lots of other problems to go' means what?

'spirit of sharing', Ken

In reply to Ken Task

Re: upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

by mart van der niet -

Another upgrade problem appeared in upgrading the database, see here 

In reply to Ken Task

Re: upgrading to 3.4.1 Capability "moodle/site:maintenanceaccess" was not found!

by mart van der niet -

Slowly getting there, but another problem:

 

On cloned site:

In site admin-> appearance themes are visible, but when selecting a new them it does not take effect.

I suspect it must have something to do with caching, but what......