NvUpdate::step1 PHP Method

step1() public method

NvUpdate::step1()
public step1 ( mixed $array )
$array mixed
    public function step1($array)
    {
        global $global_config;
        $xtpl = new XTemplate('updatestep1.tpl', NV_ROOTDIR . '/install/tpl');
        $xtpl->assign('LANG', $this->lang);
        $xtpl->assign('CONFIG', $this->config);
        $xtpl->assign('DATA', $array);
        $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
        $xtpl->assign('URL_DELETE', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=webtools&' . NV_OP_VARIABLE . '=deleteupdate&checksess=' . NV_CHECK_SESSION);
        $xtpl->assign('URL_RETURN', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=siteinfo');
        $xtpl->assign('RELEASE_DATE', !empty($this->config['release_date']) ? nv_date('d/m/Y H:i:s', $this->config['release_date']) : 'N/A');
        $xtpl->assign('ALLOW_OLD_VERSION', !empty($this->config['allow_old_version']) ? implode(', ', $this->config['allow_old_version']) : 'N/A');
        $xtpl->assign('UPDATE_AUTO_TYPE', isset($this->config['update_auto_type']) ? $this->lang['update_auto_type_' . $this->config['update_auto_type']] : 'N/A');
        if (!empty($this->config['formodule']) and empty($array['module_exist'])) {
            $xtpl->parse('main.notexistmod');
        } else {
            if ($array['isupdate_allow']) {
                $xtpl->parse('main.infoupdate.canupdate');
            } else {
                $xtpl->parse('main.infoupdate.cannotupdate');
            }
            $xtpl->parse('main.infoupdate');
        }
        $xtpl->parse('main');
        return $xtpl->text('main');
    }

Usage Example

Esempio n. 1
0
        if (in_array($array['current_version'], $nv_update_config['allow_old_version'])) {
            $array['ability'] = $lang_module['update_ability_1'];
            $array['isupdate_allow'] = true;
        } else {
            $array['ability'] = $lang_module['update_ability_0'];
            $array['isupdate_allow'] = false;
        }
        // Kiem tra va ghi log data
        $step = $array['isupdate_allow'] ? 1 : 0;
        if ($step == 0 or !isset($nv_update_config['updatelog']['step']) or $nv_update_config['updatelog']['step'] < $step) {
            $nv_update_config['updatelog']['step'] = $step;
            $nv_update_config['updatelog']['old_version'] = $array['current_version'];
            $NvUpdate->set_data_log($nv_update_config['updatelog']);
        }
        unset($step);
        $contents = $NvUpdate->step1($array);
    }
} elseif ($nv_update_config['step'] == 2) {
    // Buoc nang cap: Backup => List cong viec => Cap nhat CSDL => Di chuyen file => Nang cap bang tay.
    $array = array();
    $set_log = false;
    // Kiem tra thu tu cac buoc con
    $nv_update_config['substep'] = $nv_Request->get_int('substep', 'get', 1);
    if ($nv_update_config['substep'] < 1 or !isset($nv_update_config['updatelog']['substep']) or $nv_update_config['substep'] > 5 or $nv_update_config['updatelog']['substep'] < $nv_update_config['substep'] - 1) {
        $nv_update_config['substep'] = 1;
    }
    if ($nv_update_config['substep'] == 1) {
        // Backup CSDL va CODE
        // Backup CSDL
        if ($nv_Request->isset_request('dump', 'get')) {
            $checksess = $nv_Request->get_title('checksess', 'get', '');