From d8526720e130c39edab90d074858c1cc434a9893 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 21 Apr 2022 15:06:01 +1200 Subject: [PATCH] Simplify dataSource contract - remove unused preProcess The choice of required functions was not great - postProcess passes silly params & preProcess is never used / always empty - this removes preProcess and gets rid of the abstract class for postProcess (which will be decommissioned in a follow up) --- CRM/Import/DataSource.php | 16 ---------------- CRM/Import/DataSource/CSV.php | 12 +----------- CRM/Import/DataSource/SQL.php | 8 -------- 3 files changed, 1 insertion(+), 35 deletions(-) diff --git a/CRM/Import/DataSource.php b/CRM/Import/DataSource.php index c5a4a44cef..4b59d52614 100644 --- a/CRM/Import/DataSource.php +++ b/CRM/Import/DataSource.php @@ -138,13 +138,6 @@ abstract class CRM_Import_DataSource { */ abstract public function getInfo(); - /** - * Set variables up before form is built. - * - * @param CRM_Core_Form $form - */ - abstract public function preProcess(&$form); - /** * This is function is called by the form object to get the DataSource's form snippet. * @@ -154,15 +147,6 @@ abstract class CRM_Import_DataSource { */ abstract public function buildQuickForm(&$form); - /** - * Process the form submission. - * - * @param array $params - * @param string $db - * @param CRM_Core_Form $form - */ - abstract public function postProcess(&$params, &$db, &$form); - /** * Determine if the current user has access to this data source. * diff --git a/CRM/Import/DataSource/CSV.php b/CRM/Import/DataSource/CSV.php index c91ca15a88..6d76bf9fed 100644 --- a/CRM/Import/DataSource/CSV.php +++ b/CRM/Import/DataSource/CSV.php @@ -35,14 +35,6 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource { return ['title' => ts('Comma-Separated Values (CSV)')]; } - /** - * Set variables up before form is built. - * - * @param CRM_Core_Form $form - */ - public function preProcess(&$form) { - } - /** * This is function is called by the form object to get the DataSource's form snippet. * @@ -56,9 +48,7 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource { public function buildQuickForm(&$form) { $form->add('hidden', 'hidden_dataSource', 'CRM_Import_DataSource_CSV'); - $config = CRM_Core_Config::singleton(); - - $uploadFileSize = CRM_Utils_Number::formatUnitSize($config->maxFileSize . 'm', TRUE); + $uploadFileSize = CRM_Utils_Number::formatUnitSize(Civi::settings()->get('maxFileSize') . 'm', TRUE); //Fetch uploadFileSize from php_ini when $config->maxFileSize is set to "no limit". if (empty($uploadFileSize)) { $uploadFileSize = CRM_Utils_Number::formatUnitSize(ini_get('upload_max_filesize'), TRUE); diff --git a/CRM/Import/DataSource/SQL.php b/CRM/Import/DataSource/SQL.php index 2e712f4317..8c81f9bfc7 100644 --- a/CRM/Import/DataSource/SQL.php +++ b/CRM/Import/DataSource/SQL.php @@ -36,14 +36,6 @@ class CRM_Import_DataSource_SQL extends CRM_Import_DataSource { ]; } - /** - * Set variables up before form is built. - * - * @param CRM_Core_Form $form - */ - public function preProcess(&$form) { - } - /** * This is function is called by the form object to get the DataSource's * form snippet. It should add all fields necesarry to get the data -- 2.25.1