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; }
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()) {