1

I have a script to upgrade my civicrm configuration running under Drupal 7:

#!/bin/bash
CMD=$(basename "$0")

BIN="$HOME/.config/composer/vendor/bin"
DRUPALROOT="/usr/share/drupal"
DOWNLOADDIR="$HOME/Downloads"
USER="www-data"

PKG=$(find "$DOWNLOADDIR" -name 'civicrm-*-drupal.tar.gz' | sort -rV | head -n1)

read -r -p "$CMD: Installing $(basename "$PKG") (y/n)? " answer
if [ "$answer" != "y" ] ; then
  exit 1
fi

error () {
  [ -n "$1" ] && echo "$CMD: $1"
  echo "$CMD: Aborted"
  exit 1
}

cd "$DRUPALROOT" 2>/dev/null || error "No such directory: $DRUPALROOT"
# sudo true is used to ask the password from the user 
# before putting the website into maintenance mode
sudo true  || error "Authentication failed"

drush vset --exact maintenance_mode 1             || exit 4

sudo -u "$USER" "$BIN"/drush cache-clear all      || exit 5
( cd sites/all/modules 2>/dev/null || 
    error "No such directory: $DRUPALROOT/sites/all/modules"  
  sudo mv civicrm civicrm.bak                     || exit 6
  sudo -u "$USER" tar -xzf "$PKG" ||
    error "Couldn't extract from archive $PKG"
  sudo rm -rf civicrm.bak                         || exit 8
) 
sudo -u "$USER" "$BIN"/drush civicrm-upgrade-db   || exit 9

drush vset --exact maintenance_mode 0             || exit 10

sudo -u "$USER" "$BIN"/drush cache-clear all      || exit 11

The command drush vset --exact maintenance_mode 1 gave as output:

maintenance_mode was set to 1.                                       [success]

Next command sudo -u "$USER" "$BIN"/drush cache-clear all was also successful:

'all' cache was cleared.                                             [success]

But then I got an unrecoverable error message when the drush command was executed:

WD php: Error: Class 'CRM_Contact_Form_Search_Custom_Base' not found [error]
in require_once() (line 29 of
/usr/share/drupal/sites/default/files/civicrm/ext/dataprocessor/CRM/DataprocessorSearch/Form/Search/Custom/DataprocessorSmartGroupIntegration.php).
Error: Class 'CRM_Contact_Form_Search_Custom_Base' not found in require_once() (line 29 of /usr/share/drupal/sites/default/files/civicrm/ext/dataprocessor/CRM/DataprocessorSearch/Form/Search/Custom/DataprocessorSmartGroupIntegration.php).
Drush command terminated abnormally due to an unrecoverable error.   [error]

I never had problems until today, and that is the reason why the processing of errors is still not gracefully. the statements exit 4 and following should be replaced by a call to the function error (), which is not yet implemented.

I also discovered that the backup directory civicrm.bak was also distroyed after the failed installation, which is an ugly bug of my script.

I have backups made with backup_migrate but since my webinterface is down, I don't know how to recover from the command line.

I am here to ask for any pointer to start fixing this mess.

1
  • First target has been reached: I could downgrade to civicrm 5.40.1 and the website is up and running again. Sep 3, 2021 at 19:12

1 Answer 1

3

See https://lab.civicrm.org/dev/core/-/issues/2812.

There is a temporary quick-fix at https://github.com/civicrm/civicrm-core/pull/21347/files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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