From 923c8e87aad6bfae6f07e6c3d740d810c338dc85 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 26 Sep 2022 14:23:16 +1300 Subject: [PATCH] Remove legacy table delete method --- CRM/Import/DataSource.php | 12 ------- ext/civiimport/Civi/Api4/Import/Import.php | 1 + .../Civi/Api4/Import/ImportProcessTrait.php | 31 +++++++++++++++++++ ext/civiimport/Civi/Api4/Import/Validate.php | 21 +++++++++++++ 4 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 ext/civiimport/Civi/Api4/Import/Import.php create mode 100644 ext/civiimport/Civi/Api4/Import/ImportProcessTrait.php create mode 100644 ext/civiimport/Civi/Api4/Import/Validate.php diff --git a/CRM/Import/DataSource.php b/CRM/Import/DataSource.php index e592c5a906..236e65afc0 100644 --- a/CRM/Import/DataSource.php +++ b/CRM/Import/DataSource.php @@ -384,18 +384,6 @@ abstract class CRM_Import_DataSource { return NULL; } if (!$this->tableName) { - // If we are just loading this table we will do some validation. - // In the case of viewing historical jobs the table could have - // been deleted so we check that when we first load it. - if (strpos($tableName, 'civicrm_tmp_') !== 0 - || !CRM_Utils_Rule::alphanumeric($tableName)) { - // The table name is generated and stored by code, not users so it - // should be safe - but a check seems prudent all the same. - throw new CRM_Core_Exception('Table cannot be deleted'); - } - if (!CRM_Core_DAO::singleValueQuery('SHOW TABLES LIKE %1', [1 => [$tableName, 'String']])) { - throw new CRM_Import_Exception_ImportTableUnavailable('table deleted'); - } $this->tableName = $tableName; } return $this->tableName; diff --git a/ext/civiimport/Civi/Api4/Import/Import.php b/ext/civiimport/Civi/Api4/Import/Import.php new file mode 100644 index 0000000000..b3d9bbc7f3 --- /dev/null +++ b/ext/civiimport/Civi/Api4/Import/Import.php @@ -0,0 +1 @@ +_entityName); + foreach ($items as &$item) { + $item['_user_job_id'] = (int) $userJobID; + } + return parent::write($items); + } + +} diff --git a/ext/civiimport/Civi/Api4/Import/Validate.php b/ext/civiimport/Civi/Api4/Import/Validate.php new file mode 100644 index 0000000000..57fccc2b13 --- /dev/null +++ b/ext/civiimport/Civi/Api4/Import/Validate.php @@ -0,0 +1,21 @@ +