From 7849225abf68d0ad84783329bf7c1a02a055b257 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 9 Jun 2013 08:20:45 -0700 Subject: [PATCH] Merge stateMachine into one file CRM-11254 ---------------------------------------- * CRM-11254: Create parent class for import http://issues.civicrm.org/jira/browse/CRM-11254 --- CRM/Activity/Import/Controller.php | 7 ++- CRM/Activity/Import/StateMachine.php | 63 ------------------------- CRM/Contact/Import/Controller.php | 2 +- CRM/Contact/Import/StateMachine.php | 63 ------------------------- CRM/Contribute/Import/Controller.php | 2 +- CRM/Contribute/Import/StateMachine.php | 63 ------------------------- CRM/Event/Import/Controller.php | 2 +- CRM/{Event => }/Import/StateMachine.php | 17 ++++--- CRM/Member/Import/Controller.php | 2 +- CRM/Member/Import/StateMachine.php | 63 ------------------------- 10 files changed, 18 insertions(+), 266 deletions(-) delete mode 100644 CRM/Activity/Import/StateMachine.php delete mode 100644 CRM/Contact/Import/StateMachine.php delete mode 100644 CRM/Contribute/Import/StateMachine.php rename CRM/{Event => }/Import/StateMachine.php (84%) delete mode 100644 CRM/Member/Import/StateMachine.php diff --git a/CRM/Activity/Import/Controller.php b/CRM/Activity/Import/Controller.php index b85b021a8a..0833be5a88 100644 --- a/CRM/Activity/Import/Controller.php +++ b/CRM/Activity/Import/Controller.php @@ -40,7 +40,12 @@ class CRM_Activity_Import_Controller extends CRM_Core_Controller { function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) { parent::__construct($title, $modal); - $this->_stateMachine = new CRM_Activity_Import_StateMachine($this, $action); + // lets get around the time limit issue if possible, CRM-2113 + if (!ini_get('safe_mode')) { + set_time_limit(0); + } + + $this->_stateMachine = new CRM_Import_StateMachine($this, $action); // create and instantiate the pages $this->addPages($this->_stateMachine, $action); diff --git a/CRM/Activity/Import/StateMachine.php b/CRM/Activity/Import/StateMachine.php deleted file mode 100644 index e5d2986fea..0000000000 --- a/CRM/Activity/Import/StateMachine.php +++ /dev/null @@ -1,63 +0,0 @@ -_pages = array( - 'CRM_Activity_Import_Form_UploadFile' => NULL, - 'CRM_Activity_Import_Form_MapField' => NULL, - 'CRM_Activity_Import_Form_Preview' => NULL, - 'CRM_Activity_Import_Form_Summary' => NULL, - ); - - $this->addSequentialPages($this->_pages, $action); - } -} - diff --git a/CRM/Contact/Import/Controller.php b/CRM/Contact/Import/Controller.php index c1cf2c7a87..375181cf72 100644 --- a/CRM/Contact/Import/Controller.php +++ b/CRM/Contact/Import/Controller.php @@ -45,7 +45,7 @@ class CRM_Contact_Import_Controller extends CRM_Core_Controller { set_time_limit(0); } - $this->_stateMachine = new CRM_Contact_Import_StateMachine($this, $action); + $this->_stateMachine = new CRM_Import_StateMachine($this, $action); // create and instantiate the pages $this->addPages($this->_stateMachine, $action); diff --git a/CRM/Contact/Import/StateMachine.php b/CRM/Contact/Import/StateMachine.php deleted file mode 100644 index 095762bf98..0000000000 --- a/CRM/Contact/Import/StateMachine.php +++ /dev/null @@ -1,63 +0,0 @@ -_pages = array( - 'CRM_Contact_Import_Form_DataSource' => NULL, - 'CRM_Contact_Import_Form_MapField' => NULL, - 'CRM_Contact_Import_Form_Preview' => NULL, - 'CRM_Contact_Import_Form_Summary' => NULL, - ); - - $this->addSequentialPages($this->_pages, $action); - } -} - diff --git a/CRM/Contribute/Import/Controller.php b/CRM/Contribute/Import/Controller.php index d98ad15bc2..8cd8efb493 100644 --- a/CRM/Contribute/Import/Controller.php +++ b/CRM/Contribute/Import/Controller.php @@ -45,7 +45,7 @@ class CRM_Contribute_Import_Controller extends CRM_Core_Controller { set_time_limit(0); } - $this->_stateMachine = new CRM_Contribute_Import_StateMachine($this, $action); + $this->_stateMachine = new CRM_Import_StateMachine($this, $action); // create and instantiate the pages $this->addPages($this->_stateMachine, $action); diff --git a/CRM/Contribute/Import/StateMachine.php b/CRM/Contribute/Import/StateMachine.php deleted file mode 100644 index a18f76c832..0000000000 --- a/CRM/Contribute/Import/StateMachine.php +++ /dev/null @@ -1,63 +0,0 @@ -_pages = array( - 'CRM_Contribute_Import_Form_UploadFile' => NULL, - 'CRM_Contribute_Import_Form_MapField' => NULL, - 'CRM_Contribute_Import_Form_Preview' => NULL, - 'CRM_Contribute_Import_Form_Summary' => NULL, - ); - - $this->addSequentialPages($this->_pages, $action); - } -} - diff --git a/CRM/Event/Import/Controller.php b/CRM/Event/Import/Controller.php index 761460fe5f..b735fd64cc 100644 --- a/CRM/Event/Import/Controller.php +++ b/CRM/Event/Import/Controller.php @@ -45,7 +45,7 @@ class CRM_Event_Import_Controller extends CRM_Core_Controller { set_time_limit(0); } - $this->_stateMachine = new CRM_Event_Import_StateMachine($this, $action); + $this->_stateMachine = new CRM_Import_StateMachine($this, $action); // create and instantiate the pages $this->addPages($this->_stateMachine, $action); diff --git a/CRM/Event/Import/StateMachine.php b/CRM/Import/StateMachine.php similarity index 84% rename from CRM/Event/Import/StateMachine.php rename to CRM/Import/StateMachine.php index 61af7dc3d0..6228826f37 100644 --- a/CRM/Event/Import/StateMachine.php +++ b/CRM/Import/StateMachine.php @@ -35,26 +35,25 @@ /** * State machine for managing different states of the Import process. - * */ -class CRM_Event_Import_StateMachine extends CRM_Core_StateMachine { +class CRM_Import_StateMachine extends CRM_Core_StateMachine { /** - * class constructor + * Class constructor * - * @param object CRM_Member_Import_Controller + * @param object CRM_*_Import_Controller * @param int $action * - * @return object CRM_Member_Import_StateMachine */ function __construct($controller, $action = CRM_Core_Action::NONE) { parent::__construct($controller, $action); + $classType = str_replace('_Controller', '', get_class($controller)); $this->_pages = array( - 'CRM_Event_Import_Form_UploadFile' => NULL, - 'CRM_Event_Import_Form_MapField' => NULL, - 'CRM_Event_Import_Form_Preview' => NULL, - 'CRM_Event_Import_Form_Summary' => NULL, + $classType . '_Form_UploadFile' => NULL, + $classType . '_Form_MapField' => NULL, + $classType . '_Form_Preview' => NULL, + $classType . '_Form_Summary' => NULL, ); $this->addSequentialPages($this->_pages, $action); diff --git a/CRM/Member/Import/Controller.php b/CRM/Member/Import/Controller.php index 7fb89c0ec2..1a9fecc1af 100644 --- a/CRM/Member/Import/Controller.php +++ b/CRM/Member/Import/Controller.php @@ -45,7 +45,7 @@ class CRM_Member_Import_Controller extends CRM_Core_Controller { set_time_limit(0); } - $this->_stateMachine = new CRM_Member_Import_StateMachine($this, $action); + $this->_stateMachine = new CRM_Import_StateMachine($this, $action); // create and instantiate the pages $this->addPages($this->_stateMachine, $action); diff --git a/CRM/Member/Import/StateMachine.php b/CRM/Member/Import/StateMachine.php deleted file mode 100644 index b0111e7887..0000000000 --- a/CRM/Member/Import/StateMachine.php +++ /dev/null @@ -1,63 +0,0 @@ -_pages = array( - 'CRM_Member_Import_Form_UploadFile' => NULL, - 'CRM_Member_Import_Form_MapField' => NULL, - 'CRM_Member_Import_Form_Preview' => NULL, - 'CRM_Member_Import_Form_Summary' => NULL, - ); - - $this->addSequentialPages($this->_pages, $action); - } -} - -- 2.25.1