I've been trying to update CiviCRM from version 5.22.1. I've tried several of the different versions that have been released over the last week, each to no avail.
I have put the site in maintenance mode, removed the old version, and unpacked the new version in /sites/all/modules/ just as I always do. The problems start when I try to upgrade the database.
I visit the upgrade page at /civicrm/upgrade?reset=1 as normal:
I see a couple of warnings, but they've been around for a while without causing a problem. I'm not really sure why, as I've not customised any message templates. Had been assuming maybe it was to do with Mosaico.
After I click 'Upgrade now', though, the site appears to freeze for a while, and then displays this:
After that, Drupal still loads fine, but CiviCRM won't display anything but this:
If I roll back /sites/all/modules/civicrm/ to the backup of 5.22.1 everything works fine.
Edit: I've found this in the log:
Mar 27 12:15:33 [error] $Fatal Error Details = Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -1
[message] => DB Error: unknown error
[mode] => 16
[debug_info] => CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EACH ROW BEGIN END [nativecode=1359 ** Trigger already exists]
[type] => DB_Error
[user_info] => CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EACH ROW BEGIN END [nativecode=1359 ** Trigger already exists]
[to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EACH ROW BEGIN END [nativecode=1359 ** Trigger already exists]"]
)
Mar 27 12:15:33 [debug] $backTrace = #0 <drupal_root>/sites/all/modules/civicrm/CRM/Core/Error.php(192): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 <drupal_root>/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::handle(Object(DB_Error))
#2 <drupal_root>/sites/all/modules/civicrm/packages/DB.php(998): PEAR_Error->__construct("DB Error: unknown error", -1, 16, (Array:2), "CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EAC...")
#3 <drupal_root>/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-1, 16, (Array:2), "CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EAC...")
#4 <drupal_root>/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -1, 16, (Array:2), "CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EAC...", "DB_Error", TRUE)
#5 <drupal_root>/sites/all/modules/civicrm/packages/DB/common.php(1925): PEAR->__call("raiseError", (Array:7))
#6 <drupal_root>/sites/all/modules/civicrm/packages/DB/mysqli.php(935): DB_common->raiseError(-1, NULL, NULL, "CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EAC...", "1359 ** Trigger already exists")
#7 <drupal_root>/sites/all/modules/civicrm/packages/DB/mysqli.php(405): DB_mysqli->mysqliRaiseError()
#8 <drupal_root>/sites/all/modules/civicrm/packages/DB/common.php(1231): DB_mysqli->simpleQuery("CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EAC...")
#9 <drupal_root>/sites/all/modules/civicrm/packages/DB/DataObject.php(2691): DB_common->query("CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EAC...")
#10 <drupal_root>/sites/all/modules/civicrm/packages/DB/DataObject.php(1829): DB_DataObject->_query("CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EAC...")
#11 <drupal_root>/sites/all/modules/civicrm/CRM/Core/DAO.php(421): DB_DataObject->query("CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EAC...")
#12 <drupal_root>/sites/all/modules/civicrm/CRM/Core/DAO.php(2160): CRM_Core_DAO->query("CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EAC...")
#13 <drupal_root>/sites/all/modules/civicrm/CRM/Upgrade/Form.php(470): CRM_Core_DAO::checkTriggerViewPermission(FALSE, TRUE)
#14 <drupal_root>/sites/all/modules/civicrm/CRM/Upgrade/Page/Upgrade.php(81): CRM_Upgrade_Form->checkUpgradeableVersion("5.22.1", "5.23.4")
#15 <drupal_root>/sites/all/modules/civicrm/CRM/Upgrade/Page/Upgrade.php(57): CRM_Upgrade_Page_Upgrade->runIntro()
#16 <drupal_root>/sites/all/modules/civicrm/CRM/Core/Invoke.php(268): CRM_Upgrade_Page_Upgrade->run((Array:2), NULL)
#17 <drupal_root>/sites/all/modules/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:13))
#18 <drupal_root>/sites/all/modules/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:2))
#19 <drupal_root>/sites/all/modules/civicrm/drupal/civicrm.module(456): CRM_Core_Invoke::invoke((Array:2))
#20 <drupal_root>/includes/menu.inc(527): civicrm_invoke("upgrade")
#21 <drupal_root>/index.php(21): menu_execute_active_handler()
#22 {main}
Further Update: I tried to rerun the upgrade again and got a ton of errors in the browser console:
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/bower_components/jquery-ui/jquery-ui.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/bower_components/lodash-compat/lodash.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/packages/jquery/plugins/jquery.mousewheel.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/bower_components/select2/select2.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/packages/jquery/plugins/jquery.form.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/packages/jquery/plugins/jquery.timeentry.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/packages/jquery/plugins/jquery.blockUI.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/bower_components/datatables/media/js/jquery.dataTables.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/bower_components/jquery-validation/dist/jquery.validate.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/packages/jquery/plugins/jquery.ui.datepicker.validation.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] ReferenceError: Can't find variable: _
Global Code (Common.js:5)
[Error] ReferenceError: Can't find variable: _
Global Code (crm.ajax.js:632)
[Error] TypeError: undefined is not an object (evaluating '_.noop')
(anonymous function) (crm.wysiwyg.js:21)
Global Code (crm.wysiwyg.js:72)
[Error] TypeError: undefined is not an object (evaluating '$.datepicker._defaults')
(anonymous function) (en_GB:11)
Global Code (en_GB:113)
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/packages/jquery/plugins/jquery.tableHeader.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/packages/jquery/plugins/jquery.notify.min.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Refused to execute <drupal_root>/sites/all/modules/civicrm/bower_components/jquery-ui/ui/i18n/datepicker-en-GB.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] ReferenceError: Can't find variable: _
Global Code (noconflict.js:3)
[Error] Error: Bootstrap requires jQuery
Global Code (bootstrap.min.js:6)
[Error] TypeError: undefined is not an object (evaluating '$.fn')
(anonymous function) (superfish.js:11)
Global Code (superfish.js:11:2766)
[Error] TypeError: undefined is not an object (evaluating 'a.fn')
(anonymous function) (mobilemenu.js:1:1885)
Global Code (mobilemenu.js:1:2045)
[Error] TypeError: jQuery is not a function. (In 'jQuery(window)', 'jQuery' is undefined)
Global Code (custom.js:1)
[Error] TypeError: undefined is not an object (evaluating 'jQuery.extend')
Global Code (upgrade:77)
[Error] TypeError: undefined is not an object (evaluating 'jQuery.support')
(anonymous function) (drupal.js:584)
l (jquery.min.js:2:17002)
fireWith (jquery.min.js:2:17785)
ready (jquery.min.js:2:12516)
A (jquery.min.js:2:9915)
Yet further edit: On further investigation, all those .js files that are reporting the incorrect Content-Type seem to be trying to load from a bad path. It looks like instead of prefixing the path with the base URL, it's trying to load from the $civicrm_root as defined in civicrm.settings.php. e.g. instead of trying to load
it's trying to get
The guidance in the File System Paths section of civicrm.settings.php says that $civicrm_root should be the absolute system path, so it looks to me like it is defined correctly. So I'm not sure why it's loading from the wrong place?
Another Edit, March 31st: I had a play around with $civicrm_root and looking at the results it produces in those javascript errors. It's clear that is where the incorrect path is coming from. But it definitely looks like it's set as per the instructions. If I set it so as that it fixes those errors and reaches the missing files with valid paths (e.g. $civicrm_root = '/sites/all/modules/civicrm
';) then CiviCRM won't even load. I just get this:
What else might be affecting that path besides $civicrm_root?