/** * Title * * Description * * @access public */ function downloadUpdatesSVN(&$out) { global $code; global $data; $code = 1; $data = 0; $out['BACKUP'] = 1; $this->dump($out); $this->removeTree(ROOT . 'saverestore/temp'); include_once DIR_MODULES . 'saverestore/phpsvnclient.php'; $url = 'http://majordomo-sl.googlecode.com/svn/'; $phpsvnclient = new phpsvnclient($url); set_time_limit(0); global $to_update; $total = count($to_update); for ($i = 0; $i < $total; $i++) { $path = 'trunk/' . $to_update[$i]; $file_content = $phpsvnclient->getFile($path); if (!is_dir(dirname(ROOT . $to_update[$i]))) { @mkdir(dirname(ROOT . $to_update[$i]), 0777); } @SaveFile(ROOT . $to_update[$i], $file_content); if (file_exists(dirname(ROOT . $to_update[$i]) . '/installed')) { @unlink(dirname(ROOT . $to_update[$i]) . '/installed'); } } $this->redirect("?ok_msg=" . urlencode('Files have been updated!')); }
function dosvn() { global $app_tmppath; $svntemppath = $app_tmppath . "svn/"; $sv = $_SESSION['setup_conf']['svn']; $root = $_SESSION['setup_conf']['conf']['app_root']; if (count($sv) > 0) { //deldir($svntemppath); foreach ($sv as $v => $s) { $temppath = $svntemppath . "{$v}/"; msg('正在从' . $s['SVN_URL'] . '上下载文件,请耐心等待……<br>'); $svn = new phpsvnclient($s['SVN_URL'], $s['SVN_USER'], $s['SVN_PWD']); $files = $svn->getDirectoryTree($s['SVN_DIR']); foreach ($files as $k => $f) { if ($f['type'] == 'file') { $content = $svn->getFile($f['path']); $file = str_replace($s['SVN_DIR'], $temppath, $f['path']); write_file($file, $content); } } } foreach ($sv as $v => $s) { $temppath = $svntemppath . "{$v}/"; copydir($temppath, $root . $s['DIR_PATH']); } } remark_setup(1); echo "<script language='JavaScript'>top.godourl(4);</script>"; }