1

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:

Screenshot of the upgrade screen showing some warnings, but nothing out of the ordinary.

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:

Screenshot of failed upgrade screen.

After that, Drupal still loads fine, but CiviCRM won't display anything but this:

Screenshot of incomplete CiviCRM Dashboard, showing System Status: Warning

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

https://example.net/sites/all/modules/civicrm/bower_components/datatables/media/css/jquery.dataTables.min.css

it's trying to get

https://example.net//var/sites/example.net/public_html/sites/all/modules/civicrm/bower_components/datatables/media/css/jquery.dataTables.min.css

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:

screenshot of CiviCRM not loading

What else might be affecting that path besides $civicrm_root?

  • 1
    check browser console to see if there are any js error? worth checking civicrm log file if anything supicious – Pradeep Nayak Mar 27 at 13:01
  • @PradeepNayak Updated the question with something that looks suspicious from the log. – somnolentsurfer Mar 27 at 14:11
  • 1
    Can you execute the 'DROP TRIGGER IF EXISTS civicrm_domain_trigger' sql and do upgrade? – Pradeep Nayak Mar 27 at 14:19
  • @PradeepNayak I get 'MySQL returned an empty result set (i.e. zero rows).' and then the upgrade gives the same result as before. I'm a total SQL beginner, so maybe I'm doing it in the wrong place? I pasted your command (minus the quotes) into the SQL tab of my CiviCRM database on phpMyAdmin and hit 'Go'. – somnolentsurfer Mar 27 at 14:27
  • 1
    do you still get DB error? – Pradeep Nayak Mar 27 at 14:44
1

I've finally managed to upgrade to 5.24.0 after fixing the resource URLs problem. Thanks to Pradeep for answering that question, and thus also solving this one.

| improve this answer | |
0

Just as a remark. It looks as my question "Strange error when updating 5.23.0 Joomla". Is your site on Windows?

| improve this answer | |
  • No, Linux/Apache. – somnolentsurfer Mar 30 at 9:35
  • 1
    The problem must be in the absolute path setting. If you have no slash at the end in the setting, you can try the working with a slash. On windows I use no backslash at the end, but i saw that in the code that there was a test with a slash (not backslash). I have solved my problem (in 5.23.4 it is solved by CiviCRM) with updating the absolute path when it is generated. – HanV Mar 30 at 20:49
  • The slash at the end doesn't seem to make a difference, but I tested some changes to the setting, and it does appear to be that. I've put more details in the main question. – somnolentsurfer Mar 31 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.