Answers.Body: <p>See <a href="https://lab.civicrm.org/dev/core/-/issues/2812" rel="nofollow noreferrer">https://lab.civicrm.org/dev/core/-/issues/2812</a>.</p>
  <p>There is a temporary quick-fix at <a href="https://github.com/civicrm/civicrm-core/pull/21347/files" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/21347/files</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-03T19:07:15.627Z
Answers.LastActivityDate: 2021-09-03T19:07:15.627Z
Answers.UserDisplayName: Demerit
Body: <p>I have a script to upgrade my civicrm configuration running under Drupal 7:</p>
  <pre><code>#!/bin/bash
  CMD=$(basename &quot;$0&quot;)
  
  BIN=&quot;$HOME/.config/composer/vendor/bin&quot;
  DRUPALROOT=&quot;/usr/share/drupal&quot;
  DOWNLOADDIR=&quot;$HOME/Downloads&quot;
  USER=&quot;www-data&quot;
  
  PKG=$(find &quot;$DOWNLOADDIR&quot; -name 'civicrm-*-drupal.tar.gz' | sort -rV | head -n1)
  
  read -r -p &quot;$CMD: Installing $(basename &quot;$PKG&quot;) (y/n)? &quot; answer
  if [ &quot;$answer&quot; != &quot;y&quot; ] ; then
    exit 1
  fi
  
  error () {
    [ -n &quot;$1&quot; ] &amp;&amp; echo &quot;$CMD: $1&quot;
    echo &quot;$CMD: Aborted&quot;
    exit 1
  }
  
  cd &quot;$DRUPALROOT&quot; 2&gt;/dev/null || error &quot;No such directory: $DRUPALROOT&quot;
  # sudo true is used to ask the password from the user 
  # before putting the website into maintenance mode
  sudo true  || error &quot;Authentication failed&quot;
  
  drush vset --exact maintenance_mode 1             || exit 4
  
  sudo -u &quot;$USER&quot; &quot;$BIN&quot;/drush cache-clear all      || exit 5
  ( cd sites/all/modules 2&gt;/dev/null || 
      error &quot;No such directory: $DRUPALROOT/sites/all/modules&quot;  
    sudo mv civicrm civicrm.bak                     || exit 6
    sudo -u &quot;$USER&quot; tar -xzf &quot;$PKG&quot; ||
      error &quot;Couldn't extract from archive $PKG&quot;
    sudo rm -rf civicrm.bak                         || exit 8
  ) 
  sudo -u &quot;$USER&quot; &quot;$BIN&quot;/drush civicrm-upgrade-db   || exit 9
  
  drush vset --exact maintenance_mode 0             || exit 10
  
  sudo -u &quot;$USER&quot; &quot;$BIN&quot;/drush cache-clear all      || exit 11
  </code></pre>
  <p>The command <code>drush vset --exact maintenance_mode 1</code> gave as output:</p>
  <pre><code>maintenance_mode was set to 1.                                       [success]
  </code></pre>
  <p>Next command <code>sudo -u &quot;$USER&quot; &quot;$BIN&quot;/drush cache-clear all</code> was also successful:</p>
  <pre><code>'all' cache was cleared.                                             [success]
  </code></pre>
  <p>But then I got an unrecoverable error message when the <code>drush</code> command was executed:</p>
  <pre><code>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 &amp;#039;CRM_Contact_Form_Search_Custom_Base&amp;#039; 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]
  
  </code></pre>
  <p>I never had problems until today, and that is the reason why the processing of errors is still not gracefully. the statements <code>exit 4</code> and following should be replaced by a call to the function <code>error ()</code>, which is not yet implemented.</p>
  <p>I also discovered that the backup directory <code>civicrm.bak</code> was also distroyed after the failed installation, which is an ugly bug of my script.</p>
  <p>I have backups made with <code>backup_migrate</code> but since my webinterface is down, I don't know how to recover from the command line.</p>
  <p>I am here to ask for any pointer to start fixing this mess.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-03T19:12:08.210Z
Comments.Text: First target has been reached: I could downgrade to civicrm 5.40.1 and the website is up and running again.
Comments.UserDisplayName: Pierre François
Tags: <upgrade>
Title: Unrecoverable error when upgrading to civicrm-5.41.0
ThreadText: # Unrecoverable error when upgrading to civicrm-5.41.0
  
  (Asked by: username_0 on 2021-09-03)
  
  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 &#039;CRM_Contact_Form_Search_Custom_Base&#039; 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.
  
  **Tags:** upgrade
  
  > **Comments:**
  > **username_0**: First target has been reached: I could downgrade to civicrm 5.40.1 and the website is up and running again.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-09-03. Score: 3 | Accepted answer
  
  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>
  
  
  ---
  
  