NvUpdate::set_data_log PHP Method

set_data_log() public method

NvUpdate::set_data_log()
public set_data_log ( mixed $data )
$data mixed
    public function set_data_log($data)
    {
        $content_config = "<?php\n\n";
        $content_config .= NV_FILEHEAD . "\n\n";
        $content_config .= "if( ! defined( 'NV_IS_UPDATE' ) ) die( 'Stop!!!' );\n\n";
        $content_config .= "\$nv_update_config['updatelog'] = " . var_export($data, true) . ";";
        $content_config .= "\n\n";
        $content_config .= "?>";
        $return = file_put_contents(NV_ROOTDIR . '/' . NV_DATADIR . '/config_update_' . $this->config['packageID'] . '.php', $content_config, LOCK_EX);
        if ($return === false) {
            $message = sprintf($this->lang['update_error_log_data'], NV_DATADIR);
            $contents = $this->call_error($message);
            include NV_ROOTDIR . '/includes/header.php';
            echo $this->template($contents);
            include NV_ROOTDIR . '/includes/footer.php';
        }
        //Resets the contents of the opcode cache
        if (function_exists('opcache_reset')) {
            opcache_reset();
        }
    }

Usage Example

示例#1
0
文件: update.php 项目: nukeplus/nuke
            $array['current_version'] = $global_config['version'];
        }
        // Kiem tra ho tro phien ban nang cap
        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