本文整理汇总了PHP中ModuleManager::uninstall方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleManager::uninstall方法的具体用法?PHP ModuleManager::uninstall怎么用?PHP ModuleManager::uninstall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleManager
的用法示例。
在下文中一共展示了ModuleManager::uninstall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
public function validate($data)
{
if (DEMO_MODE) {
print 'You cannot modify installed modules in demo';
return false;
}
@set_time_limit(0);
$installed = array();
$install = array();
$uninstall = array();
$anonymous_setup = false;
foreach ($data as $k => $v) {
${$k} = $v;
}
foreach ($installed as $name => $new_version) {
$old_version = ModuleManager::is_installed($name);
if ($old_version == $new_version) {
continue;
}
if ($old_version == -1 && $new_version >= 0) {
$install[$name] = $new_version;
continue;
}
if ($new_version == -2) {
$uninstall[$name] = 1;
$install[$name] = $old_version;
continue;
}
if ($old_version >= 0 && $new_version == -1) {
$uninstall[$name] = 1;
continue;
}
if ($old_version < $new_version) {
if (!ModuleManager::upgrade($name, $new_version)) {
return false;
}
continue;
}
if ($old_version > $new_version) {
if (!ModuleManager::downgrade($name, $new_version)) {
return false;
}
continue;
}
}
//uninstall
$modules_prio_rev = array();
foreach (ModuleManager::$modules as $k => $v) {
$modules_prio_rev[] = $k;
}
$modules_prio_rev = array_reverse($modules_prio_rev);
foreach ($modules_prio_rev as $k) {
if (array_key_exists($k, $uninstall)) {
if (!ModuleManager::uninstall($k)) {
return false;
}
if (count(ModuleManager::$modules) == 0) {
print 'No modules installed';
}
}
}
//install
foreach ($install as $i => $v) {
$post_install[$i] = $v;
if (isset($uninstall[$i])) {
if (!ModuleManager::install($i, $v, true, false)) {
return false;
}
} else {
if (!ModuleManager::install($i, $v)) {
return false;
}
}
}
$processed = ModuleManager::get_processed_modules();
$this->set_module_variable('post-install', $processed['install']);
Base_ThemeCommon::create_cache();
if (empty($post_install)) {
Epesi::redirect();
}
return true;
}
示例2: array
Utils_RecordBrowserCommon::add_access('rc_related', 'add', 'ADMIN');
Utils_RecordBrowserCommon::add_access('rc_related', 'edit', 'SUPERADMIN');
Utils_RecordBrowserCommon::add_access('rc_related', 'delete', 'SUPERADMIN');
Utils_RecordBrowserCommon::new_record_field('rc_mails', array('name' => _M('Related'), 'type' => 'multiselect', 'QFfield_callback' => array('CRM_RoundcubeCommon', 'QFfield_related'), 'param' => '__RECORDSETS__::;CRM_RoundcubeCommon::related_crits', 'extra' => false, 'required' => false, 'visible' => true, 'position' => 'Employee'));
Utils_RecordBrowserCommon::new_record('rc_related', array('recordset' => 'company'));
Utils_RecordBrowserCommon::new_record('rc_related', array('recordset' => 'contact'));
Utils_RecordBrowserCommon::add_access('rc_mails', 'edit', 'ACCESS:employee', array(), array('subject', 'employee', 'date', 'headers_data', 'body', 'from', 'to', 'thread', 'message_id', 'references'));
$rs_checkpoint->done();
}
Patch::set_message('Processing addons');
$old_checkpoint = Patch::checkpoint('old');
if (!$old_checkpoint->is_done()) {
$old = $old_checkpoint->get('old', array());
if (empty($old) && ModuleManager::is_installed('Premium/RoundcubeCustomAddons') >= 0) {
$old = Utils_RecordBrowserCommon::get_records('premium_roundcube_custom_addon');
ModuleManager::uninstall('Premium/RoundcubeCustomAddons');
}
foreach ($old as $i => $r) {
if ($r['recordset'] == 'company' || $r['recordset'] == 'contact') {
continue;
}
$old_checkpoint->require_time(2);
Utils_RecordBrowserCommon::new_record('rc_related', array('recordset' => $r['recordset']));
unset($old[$i]);
$old_checkpoint->set('old', $old);
}
$old_checkpoint->done();
}
Patch::set_message('Processing related');
$related_checkpoint = Patch::checkpoint('related');
if (!$related_checkpoint->is_done()) {