本文整理汇总了PHP中BxDolModuleDb::isModuleParamsUsed方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolModuleDb::isModuleParamsUsed方法的具体用法?PHP BxDolModuleDb::isModuleParamsUsed怎么用?PHP BxDolModuleDb::isModuleParamsUsed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolModuleDb
的用法示例。
在下文中一共展示了BxDolModuleDb::isModuleParamsUsed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
function install($aParams)
{
$oModuleDb = new BxDolModuleDb();
$sTitle = _t('_adm_txt_modules_operation_install', $this->_aConfig['title']);
//--- Check whether the module was already installed ---//
if ($oModuleDb->isModule($this->_aConfig['home_uri'])) {
return array('operation_title' => $sTitle, 'message' => _t('_adm_txt_modules_already_installed'), 'result' => false);
}
//--- Check mandatory settings ---//
if ($oModuleDb->isModuleParamsUsed($this->_aConfig['home_uri'], $this->_aConfig['home_dir'], $this->_aConfig['db_prefix'], $this->_aConfig['class_prefix'])) {
return array('operation_title' => $sTitle, 'message' => _t('_adm_txt_modules_params_used'), 'result' => false);
}
//--- Check version compatibility ---//
$bCompatible = false;
if (isset($this->_aConfig['compatible_with']) && is_array($this->_aConfig['compatible_with'])) {
foreach ($this->_aConfig['compatible_with'] as $iKey => $sVersion) {
$sVersion = '/^' . str_replace(array('.', 'x'), array('\\.', '[0-9]+'), $sVersion) . '$/is';
$bCompatible = $bCompatible || preg_match($sVersion, $GLOBALS['site']['ver'] . '.' . $GLOBALS['site']['build']) > 0;
}
}
if (!$bCompatible) {
return array('operation_title' => $sTitle, 'message' => $this->_displayResult('check_script_version', false, '_adm_txt_modules_wrong_version_script'), 'result' => false);
}
//--- Check actions ---//
$aResult = $this->_perform('install', 'Installation');
if ($aResult['result']) {
$sDependencies = "";
if (isset($this->_aConfig['install']['check_dependencies']) && (int) $this->_aConfig['install']['check_dependencies'] == 1 && isset($this->_aConfig['dependencies']) && is_array($this->_aConfig['dependencies'])) {
$sDependencies = implode(',', array_keys($this->_aConfig['dependencies']));
}
db_res("INSERT IGNORE INTO `sys_modules`(`title`, `vendor`, `version`, `update_url`, `path`, `uri`, `class_prefix`, `db_prefix`, `dependencies`, `date`) VALUES ('" . $this->_aConfig['title'] . "', '" . $this->_aConfig['vendor'] . "', '" . $this->_aConfig['version'] . "', '" . $this->_aConfig['update_url'] . "', '" . $this->_aConfig['home_dir'] . "', '" . $this->_aConfig['home_uri'] . "', '" . $this->_aConfig['class_prefix'] . "', '" . $this->_aConfig['db_prefix'] . "', '" . $sDependencies . "', UNIX_TIMESTAMP())");
$iModuleId = (int) db_last_id();
$aFiles = array();
$this->_hash($this->_sModulePath, $aFiles);
foreach ($aFiles as $aFile) {
db_res("INSERT IGNORE INTO `sys_modules_file_tracks`(`module_id`, `file`, `hash`) VALUES('" . $iModuleId . "', '" . $aFile['file'] . "', '" . $aFile['hash'] . "')");
}
$GLOBALS['MySQL']->cleanMemory('sys_modules_' . $this->_aConfig['home_uri']);
$GLOBALS['MySQL']->cleanMemory('sys_modules_' . $iModuleId);
$GLOBALS['MySQL']->cleanMemory('sys_modules');
}
$aResult['operation_title'] = $sTitle;
return $aResult;
}