Exemple #1
0
$zip_file = $new_v ? DC_BACKUP_PATH . '/' . basename($updater->getFileURL()) : '';
$version_info = $new_v ? $updater->getInfoURL() : '';
# Hide "update me" message
if (!empty($_GET['hide_msg'])) {
    $updater->setNotify(false);
    http::redirect('index.php');
}
$p_url = 'update.php';
$step = isset($_GET['step']) ? $_GET['step'] : '';
$step = in_array($step, array('check', 'download', 'backup', 'unzip')) ? $step : '';
$default_tab = !empty($_GET['tab']) ? html::escapeHTML($_GET['tab']) : 'update';
if (!empty($_POST['backup_file'])) {
    $default_tab = 'files';
}
$archives = array();
foreach (files::scanDir(DC_BACKUP_PATH) as $v) {
    if (preg_match('/backup-([0-9A-Za-z\\.-]+).zip/', $v)) {
        $archives[] = $v;
    }
}
if (!empty($archives)) {
    usort($archives, "version_compare");
} else {
    $default_tab = 'update';
}
# Revert or delete backup file
if (!empty($_POST['backup_file']) && in_array($_POST['backup_file'], $archives)) {
    $b_file = $_POST['backup_file'];
    try {
        if (!empty($_POST['b_del'])) {
            if (!@unlink(DC_BACKUP_PATH . '/' . $b_file)) {
Exemple #2
0
    dcPage::close();
    exit;
}
$updater = new dcUpdate(DC_UPDATE_URL, 'dotclear', DC_UPDATE_VERSION, DC_TPL_CACHE . '/versions');
$new_v = $updater->check(DC_VERSION);
$zip_file = $new_v ? DC_ROOT . '/' . basename($updater->getFileURL()) : '';
# Hide "update me" message
if (!empty($_GET['hide_msg'])) {
    $updater->setNotify(false);
    http::redirect('index.php');
}
$p_url = 'update.php';
$step = isset($_GET['step']) ? $_GET['step'] : '';
$step = in_array($step, array('check', 'download', 'backup', 'unzip')) ? $step : '';
$archives = array();
foreach (files::scanDir(DC_ROOT) as $v) {
    if (preg_match('/backup-([0-9A-Za-z\\.-]+).zip/', $v)) {
        $archives[] = $v;
    }
}
# Revert or delete backup file
if (!empty($_POST['backup_file']) && in_array($_POST['backup_file'], $archives)) {
    $b_file = $_POST['backup_file'];
    try {
        if (!empty($_POST['b_del'])) {
            if (!@unlink(DC_ROOT . '/' . $b_file)) {
                throw new Exception(sprintf(__('Unable to delete file %s'), html::escapeHTML($b_file)));
            }
            http::redirect($p_url);
        }
        if (!empty($_POST['b_revert'])) {
	protected function __flushCache() {
		$this->__putLog('Flushing cache');
		$sCacheFiles = files::scanDir($this->sCacheDir);
		foreach ($sCacheFiles as $v) {
			$sCacheFile = $this->sCacheDir.'/'.$v;
			$sCacheFile = path::clean(path::real($sCacheFile));
			if (is_file($sCacheFile)) {
				if (time() - filemtime($sCacheFile) >= $this->nCacheTime) {
					unlink($sCacheFile);
					$this->__putLog('Deleting '.$v);
				}
			}
		}
		$sCacheFiles = files::scanDir($this->sCacheDir);
		return true;
	}