I'm reopening this topic, as it applies to my upgrade from 1.27.4 to 1.31.0. @Ciencia Al Poder provided the solution I was looking for.
I also ran my usual 'php maintenance/update.php' and encountered the same exception when I attempted to view my wiki in the web browser.
[W48fI-QM63YPxj1AGEiUeQAAAA8] 2018-09-05 00:11:15: Fatal exception of type "Wikimedia\Rdbms\DBQueryError"
My command line and results:
$ php update.php
MediaWiki 1.31.0 Updater
Your composer.lock file is up to date with current dependencies!
Going to run database updates for wiki
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds (skip this countdown with --quick) ... 0
Turning off Content Handler DB fields for this part of upgrade.
...have ipb_id field in ipblocks table.
...have ipb_expiry field in ipblocks table.
...already have interwiki table
...indexes seem up to 20031107 standards.
...
...wl_notificationtimestamp is already nullable.
...index times already set on logging table.
...have ipb_range_start field in ipblocks table.
Set $wgShowExceptionDetails = true; and $wgShowDBErrorBacktrace = true; at the bottom of LocalSettings.php to show detailed debugging information.
The important point is that the error message did not display. Only the 2nd line explaining how to set the error reporting appears. The MariaDB error log contained this error:
1180903 10:44:25 [ERROR] Incorrect definition of table mysql.proc: expected column 'sql_mode' at position 14 to have type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVA
Without an error message, I was very concerned my database was broken. I then implemented the error reporting variables in LocalSettings.php. The error message is displayed:
...wl_notificationtimestamp is already nullable.
...index times already set on logging table.
...have ipb_range_start field in ipblocks table.
[75cb065940c7af8c0bae4737] [no req] Wikimedia\Rdbms\DBReadOnlyError from line 1121 of /var/www/html/w/includes/libs/rdbms/database/Database.php: Database is read-only: Software upgrade
Backtrace:
#0 /var/www/html/w/includes/installer/MysqlUpdater.php(878): Wikimedia\Rdbms\Database->query(string, string)
#1 /var/www/html/w/includes/installer/DatabaseUpdater.php(482): MysqlUpdater->doPageRandomUpdate()
#2 /var/www/html/w/includes/installer/DatabaseUpdater.php(446): DatabaseUpdater->runUpdates(array, boolean)
#3 /var/www/html/w/maintenance/update.php(200): DatabaseUpdater->doUpdates(array)
#4 /var/www/html/w/maintenance/doMaintenance.php(94): UpdateMediaWiki->execute()
#5 /var/www/html/w/maintenance/update.php(245): require_once(string)
#6 {main}
I then set unset $wgreadonly and the upgrade proceeded with no error.
Not displaying the error message is a bug. Should it be reported as a new bug, or add this report to Bug T151833?
Bug T151833 also provides a good solution to have the wiki set to read-only for users, but unset for command line updates.
I recommend this implementation for the user manual: Can my wiki stay online while it is upgrading?
- Alternatively, you can also place the wiki in read-only mode for users, but keep the wiki writable for the upgrade script.
$wgReadOnly = ( PHP_SAPI === 'cli' ) ? false : 'This wiki is currently being upgraded to a newer software version.';
A side effect of setting $wgReadOnly during the upgrade is that I am prevented from logging in to my wiki. I am using https:// protocol. This error message is displayed:
There seems to be a problem with your login session; this action has been canceled as a precaution against session hijacking. Please resubmit the form.
Perhaps Manual:$wgReadOnly should be updated?