(REF) CRM/Upgrade - Remove unused entrypoint `verifyPreDBstate()`
authorTim Otten <totten@civicrm.org>
Fri, 10 Dec 2021 08:49:55 +0000 (00:49 -0800)
committerTim Otten <totten@civicrm.org>
Fri, 10 Dec 2021 08:49:55 +0000 (00:49 -0800)
Overview
--------

In olden times, upgraders sometimes implemented the method `verifyPreDBstate()`. However, this appears to be unused.
Additionally, it's not clear (from the documentation) how you would use it (if you wanted to).

So...  simplify the code....

Before
------

Function exists. But it does nothing. Because no subclasses implement it.

After
-----

Function does not exist. It still does nothing.

CRM/Upgrade/Form.php
CRM/Upgrade/Incremental/Base.php

index 79305b2fcedb97f27e12b2c3fb21cc57c03e6c34..513ffd1c47355e5a886693e6e0d7f1521407c379 100644 (file)
@@ -733,22 +733,6 @@ SET    version = '$version'
 
     $versionObject = $upgrade->incrementalPhpObject($rev);
 
-    // pre-db check for major release.
-    if ($upgrade->checkVersionRelease($rev, 'alpha1')) {
-      if (!(is_callable([$versionObject, 'verifyPreDBstate']))) {
-        throw new CRM_Core_Exception("verifyPreDBstate method was not found for $rev");
-      }
-
-      $error = NULL;
-      if (!($versionObject->verifyPreDBstate($error))) {
-        if (!isset($error)) {
-          $error = "post-condition failed for current upgrade for $rev";
-        }
-        throw new CRM_Core_Exception($error);
-      }
-
-    }
-
     $upgrade->setSchemaStructureTables($rev);
 
     if (is_callable([$versionObject, $phpFunctionName])) {
index b3884010e30511f91f9a5bb4744f3209a71ad363..771ed8ad679391d8b20291436bbf027eaca6e7a2 100644 (file)
@@ -68,17 +68,6 @@ class CRM_Upgrade_Incremental_Base {
     return $revList;
   }
 
-  /**
-   * Verify DB state.
-   *
-   * @param $errors
-   *
-   * @return bool
-   */
-  public function verifyPreDBstate(&$errors) {
-    return TRUE;
-  }
-
   /**
    * Compute any messages which should be displayed before upgrade.
    *