/** * Install Modules * * @return @e void */ public function install_modules() { //----------------------------------------- // INIT //----------------------------------------- $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous, '', $this->settings['gb_char_set']); /* Set up DB driver */ $extra_install = $this->_setUpDBDriver(FALSE); //----------------------------------------- // Install SYSTEM Templates //----------------------------------------- $fields = array('sys_module_title', 'sys_module_application', 'sys_module_key', 'sys_module_description', 'sys_module_version', 'sys_module_protected', 'sys_module_visible', 'sys_module_position', 'sys_module_admin'); if ($next['key']) { $output[] = $next['title'] . ": Добавление модулей"; $modules = IPSSetUp::fetchXmlAppModules($next['key'], $this->settings['gb_char_set']); if (is_array($modules) and count($modules)) { if ($extra_install and method_exists($extra_install, 'before_inserts_run')) { $q = $extra_install->before_inserts_run('modules'); } foreach ($modules as $module) { foreach ($module as $k => $v) { if (!in_array($k, $fields)) { unset($module[$k]); } } $this->DB->insert('core_sys_module', $module); } if ($extra_install and method_exists($extra_install, 'after_inserts_run')) { $q = $extra_install->after_inserts_run('modules'); } } //----------------------------------------- // Done.. so get some more! //----------------------------------------- $this->_finishStep($output, "Установка: Модули", 'install&do=modules&previous=' . $next['key']); } else { //----------------------------------------- // Next... //----------------------------------------- $output[] = "Все модули добавлены"; $this->_finishStep($output, "Установка: Модули", 'install&do=settings'); } }
/** * Next Check * * @return @e void */ public function nextCheck() { /* INIT */ $vars = $this->getVars(); $output = array(); $errors = array(); /* Init Data */ $data = IPSSetUp::fetchXmlAppInformation($vars['app_directory'], $this->settings['gb_char_set']); $_numbers = IPSSetUp::fetchAppVersionNumbers($vars['app_directory']); $modules = IPSSetUp::fetchXmlAppModules($vars['app_directory'], $this->settings['gb_char_set']); /* Grab Data */ $data['app_directory'] = $vars['app_directory']; $data['current_version'] = $_numbers['current'][0] ? $_numbers['current'][0] : $this->lang->words['cur_version_none']; $data['latest_version'] = $_numbers['latest'][1]; $data['next_version'] = $_numbers['next'][0]; /* Update the app DB */ if ($vars['type'] == 'install') { /* Get current max position */ $pos = $this->DB->buildAndFetch(array('select' => 'MAX(app_position) as pos', 'from' => 'core_applications')); $new_pos = intval($pos['pos']) + 1; /* Insert details into the DB */ $this->DB->insert('core_applications', array('app_title' => $this->product_information['name'], 'app_public_title' => $this->product_information['public_name'], 'app_author' => $this->product_information['author'], 'app_description' => $this->product_information['description'], 'app_hide_tab' => intval($this->product_information['hide_tab']), 'app_version' => $_numbers['latest'][1], 'app_long_version' => $_numbers['latest'][0], 'app_directory' => $vars['app_directory'], 'app_location' => $vars['app_location'], 'app_added' => time(), 'app_position' => $new_pos, 'app_protected' => 0, 'app_enabled' => $this->product_information['disabledatinstall'] ? 0 : 1, 'app_website' => trim($this->product_information['website']), 'app_update_check' => trim($this->product_information['update_check']), 'app_global_caches' => trim($this->product_information['global_caches']))); $this->DB->insert('upgrade_history', array('upgrade_version_id' => $_numbers['latest'][0], 'upgrade_version_human' => $_numbers['latest'][1], 'upgrade_date' => time(), 'upgrade_notes' => '', 'upgrade_mid' => $this->memberData['member_id'], 'upgrade_app' => $vars['app_directory'])); /* Insert the modules */ foreach ($modules as $key => $module) { $this->DB->insert('core_sys_module', $module); } } else { $this->DB->update('core_applications', array('app_title' => $this->product_information['name'], 'app_public_title' => $this->product_information['public_name'], 'app_author' => $this->product_information['author'], 'app_description' => $this->product_information['description'], 'app_hide_tab' => intval($this->product_information['hide_tab']), 'app_version' => $_numbers['current'][1], 'app_long_version' => $_numbers['current'][0], 'app_website' => trim($this->product_information['website']), 'app_update_check' => trim($this->product_information['update_check']), 'app_global_caches' => trim($this->product_information['global_caches'])), "app_directory='" . $vars['app_directory'] . "'"); /* Update the modules */ foreach ($modules as $key => $module) { $this->DB->update('core_sys_module', $module, "sys_module_application='{$module['sys_module_application']}' AND sys_module_key='{$module['sys_module_key']}'"); } } /* Finish? */ if ($vars['type'] == 'install' or $vars['version'] == $_numbers['latest'][0]) { /* Go back and start over with the new version */ $output[] = $this->lang->words['redir__nomore_modules']; $this->showRedirectScreen($vars['app_directory'], $output, $errors, $this->getNextURL('templates', $vars)); } else { /* Go back and start over with the new version */ $output[] = sprintf($this->lang->words['redir__upgraded_to'], $_numbers['current'][1]); /* Work out the next step */ $vars['version'] = $_numbers['next'][0]; $this->showRedirectScreen($vars['app_directory'], $output, $errors, $this->getNextURL('sql', $vars)); } }
/** * Install Modules * * @return void */ public function install_modules() { //----------------------------------------- // INIT //----------------------------------------- $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous); /* Set up DB driver */ $extra_install = $this->_setUpDBDriver(FALSE); //----------------------------------------- // Install SYSTEM Templates //----------------------------------------- if ($next['key']) { $output[] = $next['title'] . ": Inserting modules..."; $modules = IPSSetUp::fetchXmlAppModules($next['key']); if (is_array($modules) and count($modules)) { if ($extra_install and method_exists($extra_install, 'before_inserts_run')) { $q = $extra_install->before_inserts_run('modules'); } foreach ($modules as $module) { $this->DB->insert('core_sys_module', $module); } if ($extra_install and method_exists($extra_install, 'after_inserts_run')) { $q = $extra_install->after_inserts_run('modules'); } } //----------------------------------------- // Done.. so get some more! //----------------------------------------- $this->_finishStep($output, "Install: Modules", 'install&do=modules&previous=' . $next['key']); } else { //----------------------------------------- // Next... //----------------------------------------- $output[] = "All modules installed"; $this->_finishStep($output, "Install: Modules", 'install&do=settings'); } }