Cheetah
installer.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import("ChWsbInstaller");
9 
11 {
13  {
14  parent::__construct($aConfig);
15  $this->_aActions['check_payment'] = array(
16  'title' => _t('_adm_txt_modules_check_dependencies'),
17  );
18  }
19 
20  function actionCheckPayment($bInstall = true)
21  {
22  if(!$bInstall)
24 
25  $aError = array('code' => CH_WSB_INSTALLER_FAILED, 'content' => _t('_adm_txt_modules_wrong_dependency_install_payment'));
26 
27  $sPayment = getParam('sys_default_payment');
28  if(empty($sPayment))
29  return $aError;
30 
31  $oModuleDb = new ChWsbModuleDb();
32  $aPayment = $oModuleDb->getModuleByUri($sPayment);
33  if(empty($aPayment) || !is_array($aPayment))
34  return $aError;
35 
37  }
38 
39  function actionCheckPaymentFailed($mixedResult)
40  {
41  return $mixedResult['content'];
42  }
43 
44  function install($aParams)
45  {
46  $aResult = parent::install($aParams);
47 
48  if($aResult['result'] && ChWsbRequest::serviceExists('payment', 'update_dependent_modules'))
49  ChWsbService::call('payment', 'update_dependent_modules', array($this->_aConfig['home_uri'], true));
50 
51  if($aResult['result'] && ChWsbRequest::serviceExists('payflow', 'update_dependent_modules'))
52  ChWsbService::call('payflow', 'update_dependent_modules', array($this->_aConfig['home_uri'], true));
53 
54  return $aResult;
55  }
56 
57  function uninstall($aParams)
58  {
59  if(ChWsbRequest::serviceExists('payment', 'update_dependent_modules'))
60  ChWsbService::call('payment', 'update_dependent_modules', array($this->_aConfig['home_uri'], false));
61 
62  if(ChWsbRequest::serviceExists('payflow', 'update_dependent_modules'))
63  ChWsbService::call('payflow', 'update_dependent_modules', array($this->_aConfig['home_uri'], false));
64 
65  return parent::uninstall($aParams);
66  }
67 }
ChMbpInstaller\uninstall
uninstall($aParams)
Definition: installer.php:57
ChWsbRequest\serviceExists
static serviceExists($mixedModule, $sMethod, $sClass="Module")
Definition: ChWsbRequest.php:70
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
$aResult
$aResult
Definition: index.php:19
ChMbpInstaller\actionCheckPaymentFailed
actionCheckPaymentFailed($mixedResult)
Definition: installer.php:39
php
ChWsbInstaller
Definition: ChWsbInstaller.php:38
ChWsbModuleDb
Definition: ChWsbModuleDb.php:12
$oModuleDb
$oModuleDb
Definition: classifieds.php:20
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
ChMbpInstaller
Definition: installer.php:11
CH_WSB_INSTALLER_FAILED
const CH_WSB_INSTALLER_FAILED
Definition: ChWsbInstaller.php:15
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
$aConfig
$aConfig
Definition: config.php:8
ChMbpInstaller\install
install($aParams)
Definition: installer.php:44
ChMbpInstaller\__construct
__construct($aConfig)
Definition: installer.php:12
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
ChWsbService\call
static call($mixed, $sMethod, $aParams=array(), $sClass='Module')
Definition: ChWsbService.php:32
ChMbpInstaller\actionCheckPayment
actionCheckPayment($bInstall=true)
Definition: installer.php:20
CH_WSB_INSTALLER_SUCCESS
const CH_WSB_INSTALLER_SUCCESS
Definition: ChWsbInstaller.php:14