Beispiel #1
0
         break;
     default:
         $c = new wcurl(UPDATE_SERVER_GITHUB);
         $floderName = UPDATE_FNAME_GITHUB;
         break;
 }
 $file = $c->exec();
 $c->close();
 $zipPath = UPDATE_CACHE . 'update_' . time() . '.zip';
 if (file_put_contents($zipPath, $file) === false) {
     DeleteFile(UPDATE_CACHE);
     msg('错误 - 更新失败:<br/><br/>无法从更新服务器下载更新包');
 }
 //解压缩
 $z = new zip();
 $z->open($zipPath);
 $z->extract(UPDATE_CACHE);
 $z->close();
 //检查更新文件
 $floderName = UPDATE_CACHE . $floderName;
 if (!is_dir($floderName)) {
     DeleteFile(UPDATE_CACHE);
     msg('错误 - 更新失败:<br/><br/>无法解压缩更新包');
 }
 //删除配置文件
 if (file_exists($floderName . '/config.php')) {
     unlink($floderName . '/config.php');
 }
 if (file_exists($floderName . '/app.conf')) {
     unlink($floderName . '/app.conf');
 }