本文整理汇总了PHP中BxDolCmts::onModuleUninstall方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolCmts::onModuleUninstall方法的具体用法?PHP BxDolCmts::onModuleUninstall怎么用?PHP BxDolCmts::onModuleUninstall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolCmts
的用法示例。
在下文中一共展示了BxDolCmts::onModuleUninstall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall
function uninstall($aParams, $bDisable = false)
{
// check if module is already waiting while files are deleting
bx_import('BxDolInstallerUtils');
if (BxDolInstallerUtils::isModulePendingUninstall($this->_aConfig['home_uri'])) {
return array('message' => _t('_adm_err_modules_pending_uninstall_already'), 'result' => false);
}
// queue for deletion storage files
$bSetModulePendingUninstall = false;
foreach ($this->_aStorages as $s) {
if (($o = BxDolStorage::getObjectInstance($s)) && $o->queueFilesForDeletionFromObject()) {
$bSetModulePendingUninstall = true;
}
}
// delete comments and queue for deletion comments attachments
bx_import('BxDolCmts');
$iFiles = 0;
BxDolCmts::onModuleUninstall($this->_aConfig['name'], $iFiles);
if ($iFiles) {
$bSetModulePendingUninstall = true;
}
// if some files were added to the queue, set module as pending uninstall
if ($bSetModulePendingUninstall) {
BxDolInstallerUtils::setModulePendingUninstall($this->_aConfig['home_uri']);
return array('message' => _t('_adm_err_modules_pending_uninstall'), 'result' => false);
}
// delete associated connections
if ($this->_aConnections) {
bx_import('BxDolConnection');
foreach ($this->_aConnections as $sObjectConnections => $a) {
$o = BxDolConnection::getObjectInstance($sObjectConnections);
if (!$o) {
continue;
}
$sFuncSuffix = 'DeleteInitiatorAndContent';
if (isset($a['conn']) && 'initiator' == $a['conn']) {
$sFuncSuffix = 'DeleteInitiator';
} elseif (isset($a['conn']) && 'content' == $a['conn']) {
$sFuncSuffix = 'DeleteContent';
}
if (isset($a['type']) && 'profiles' == $a['type']) {
$sFunc = 'onModuleProfile' . $sFuncSuffix;
$o->{$sFunc}($this->_aConfig['name']);
} else {
$sFunc = 'onModule' . $sFuncSuffix;
$o->{$sFunc}($a['table'], $a['field_id']);
}
}
}
return parent::uninstall($aParams, $bDisable);
}
示例2: actionProcessStorages
/**
*
* Storage objects to automatically delete files from upon module uninstallation.
* Note. Don't add storage objects used in transcoder objects.
* @param string $sOperation - operation type.
*/
protected function actionProcessStorages($sOperation)
{
if (empty($this->_aConfig['storages'])) {
return BX_DOL_STUDIO_INSTALLER_FAILED;
}
// check if module is already waiting while files are deleting
if (self::isModulePendingUninstall($this->_aConfig['home_uri'])) {
return array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => _t('_adm_err_modules_pending_uninstall_already'));
}
$bSetModulePendingUninstall = false;
// queue for deletion storage files
foreach ($this->_aConfig['storages'] as $s) {
if (($o = BxDolStorage::getObjectInstance($s)) && $o->queueFilesForDeletionFromObject()) {
$bSetModulePendingUninstall = true;
}
}
// delete comments and queue for deletion comments attachments
$iFiles = 0;
BxDolCmts::onModuleUninstall($this->_aConfig['name'], $iFiles);
if ($iFiles) {
$bSetModulePendingUninstall = true;
}
// if some files were added to the queue, set module as pending uninstall
if ($bSetModulePendingUninstall) {
self::setModulePendingUninstall($this->_aConfig['home_uri']);
return array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => _t('_adm_err_modules_pending_uninstall'));
}
return BX_DOL_STUDIO_INSTALLER_SUCCESS;
}