Stop dropping temp table on finish of contact import job
authorEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 23 Apr 2022 23:44:39 +0000 (11:44 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 23 Apr 2022 23:48:17 +0000 (11:48 +1200)
This is being done in order to support as-required downloading of output
csv from the temp table.

(note that viewing the temp table directly rather than down loading might
also be on the cards)

CRM/Contact/Import/Form/Preview.php
CRM/Contact/Import/Form/Summary.php
CRM/Contact/Import/ImportJob.php

index b65467c14458e808e58bd49b6c002aaf04ba2a78..f6192e02dfd4d36d712b2e11cdcaa3aa2efa6217 100644 (file)
@@ -290,7 +290,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview {
 
     //hack to clean db
     //if job complete drop table.
-    $importJob->isComplete(TRUE);
+    $importJob->isComplete();
   }
 
 }
index b21391fd0ed20181ae7e6553c1293c1b117fa8aa..4b11b5b1fb98a3a8df12ad3cd0fde5c592c968d0 100644 (file)
@@ -107,15 +107,6 @@ class CRM_Contact_Import_Form_Summary extends CRM_Import_Form_Summary {
    * Clean up the import table we used.
    */
   public function postProcess() {
-    $dao = new CRM_Core_DAO();
-    $db = $dao->getDatabaseConnection();
-
-    $importTableName = $this->get('importTableName');
-    // do a basic sanity check here
-    if (strpos($importTableName, 'civicrm_import_job_') === 0) {
-      $query = "DROP TABLE IF EXISTS $importTableName";
-      $db->query($query);
-    }
   }
 
 }
index 838ee5ce836ce361529017eb25d3859363af73b8..d11a13f8a070588db885b51b10af45b837bed73a 100644 (file)
@@ -84,12 +84,12 @@ class CRM_Contact_Import_ImportJob {
   }
 
   /**
-   * @param bool $dropIfComplete
+   * Has the job completed.
    *
    * @return bool
    * @throws Exception
    */
-  public function isComplete($dropIfComplete = TRUE) {
+  public function isComplete() {
     if (!$this->_statusFieldName) {
       throw new CRM_Core_Exception("Could not get name of the import status field");
     }
@@ -99,10 +99,6 @@ class CRM_Contact_Import_ImportJob {
     if ($result->fetch()) {
       return FALSE;
     }
-    if ($dropIfComplete) {
-      $query = "DROP TABLE $this->_tableName";
-      CRM_Core_DAO::executeQuery($query);
-    }
     return TRUE;
   }