PageRenderTime 60ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/source/admincp/admincp_upgrade.php

https://github.com/kuaileshike/upload
PHP | 416 lines | 380 code | 30 blank | 6 comment | 102 complexity | 50b8bde0ef0fdb7a3e53a01801db7608 MD5 | raw file
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: admincp_upgrade.php 31966 2012-10-26 08:47:20Z zhangjie $
  7. */
  8. if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
  9. exit('Access Denied');
  10. }
  11. @set_time_limit(0);
  12. cpheader();
  13. include_once 'source/discuz_version.php';
  14. $discuz_upgrade = new discuz_upgrade();
  15. $step = intval($_GET['step']);
  16. $step = $step ? $step : 1;
  17. $operation = $operation ? $operation : 'check';
  18. if(!$_G['setting']['bbclosed'] && in_array($operation, array('cross', 'patch'))) {
  19. cpmsg('upgrade_close_site', '', 'error');
  20. }
  21. if($operation == 'patch' || $operation == 'cross') {
  22. $version = trim($_GET['version']);
  23. $release = trim($_GET['release']);
  24. $locale = trim($_GET['locale']);
  25. $charset = trim($_GET['charset']);
  26. $upgradeinfo = $upgrade_step = array();
  27. if($_GET['ungetfrom']) {
  28. if(md5($_GET['ungetfrom'].$_G['config']['security']['authkey']) == $_GET['ungetfrommd5']) {
  29. $dbreturnurl = $_G['siteurl'].ADMINSCRIPT.'?action=upgrade&operation='.$operation.'&version='.$version.'&release='.$release.'&step=5';
  30. dheader('Location: '.$_G['siteurl'].'install/update.php?step=prepare&from='.rawurlencode($dbreturnurl).'&frommd5='.rawurlencode(md5($dbreturnurl.$_G['config']['security']['authkey'])));
  31. } else {
  32. cpmsg('upgrade_param_error', '', 'error');
  33. }
  34. }
  35. $upgrade_step = C::t('common_cache')->fetch('upgrade_step');
  36. $upgrade_step = dunserialize($upgrade_step['cachevalue']);
  37. $upgrade_step['step'] = $step;
  38. $upgrade_step['operation'] = $operation;
  39. $upgrade_step['version'] = $version;
  40. $upgrade_step['release'] = $release;
  41. $upgrade_step['charset'] = $charset;
  42. $upgrade_step['locale'] = $locale;
  43. C::t('common_cache')->insert(array(
  44. 'cachekey' => 'upgrade_step',
  45. 'cachevalue' => serialize($upgrade_step),
  46. 'dateline' => $_G['timestamp'],
  47. ), false, true);
  48. $upgrade_run = C::t('common_cache')->fetch('upgrade_run');
  49. if(!$upgrade_run) {
  50. C::t('common_cache')->insert(array(
  51. 'cachekey' => 'upgrade_run',
  52. 'cachevalue' => serialize($_G['setting']['upgrade']),
  53. 'dateline' => $_G['timestamp'],
  54. ), false, true);
  55. $upgrade_run = $_G['setting']['upgrade'];
  56. } else {
  57. $upgrade_run = dunserialize($upgrade_run['cachevalue']);
  58. }
  59. shownav('tools', 'nav_founder_upgrade');
  60. showsubmenusteps('nav_founder_upgrade', array(
  61. array('founder_upgrade_updatelist', $step == 1),
  62. array('founder_upgrade_download', $step == 2),
  63. array('founder_upgrade_compare', $step == 3),
  64. array('founder_upgrade_upgrading', $step == 4),
  65. array('founder_upgrade_complete', $step == 5),
  66. ));
  67. showtableheader();
  68. if($step != 5) {
  69. foreach($upgrade_run as $type => $list) {
  70. if($type == $operation && $version == $list['latestversion'] && $release == $list['latestrelease']) {
  71. $discuz_upgrade->locale = $locale;
  72. $discuz_upgrade->charset = $charset;
  73. $upgradeinfo = $list;
  74. break;
  75. }
  76. }
  77. if(!$upgradeinfo) {
  78. cpmsg('upgrade_none', '', '', array('upgradeurl' => upgradeinformation(-1)));
  79. }
  80. $updatefilelist = $discuz_upgrade->fetch_updatefile_list($upgradeinfo);
  81. $updatemd5filelist = $updatefilelist['md5'];
  82. $updatefilelist = $updatefilelist['file'];
  83. $theurl = 'upgrade&operation='.$operation.'&version='.$version.'&locale='.$locale.'&charset='.$charset.'&release='.$release;
  84. if(empty($updatefilelist)) {
  85. cpmsg('upgrade_download_upgradelist_error', 'action='.$theurl, 'form', array('upgradeurl' => upgradeinformation(-2)));
  86. }
  87. }
  88. if($step == 1) {
  89. showtablerow('class="header"', '', $lang['founder_upgrade_preupdatelist']);
  90. foreach($updatefilelist as $file) {
  91. $file = '<em class="files bold">'.$file.'</em>';
  92. showtablerow('', '', array($file));
  93. }
  94. $linkurl = ADMINSCRIPT.'?action='.$theurl.'&step=2';
  95. showtablerow('', '', array($lang['founder_upgrade_store_directory'].'./data/update/Discuz! X'.$version.' Release['.$release.']'));
  96. showtablerow('', '', array('<input type="button" class="btn" onclick="window.location.href=\''.$linkurl.'\'" value="'.$lang['founder_upgrade_download'].'">'));
  97. echo upgradeinformation(0);
  98. } elseif($step == 2) {
  99. $fileseq = intval($_GET['fileseq']);
  100. $fileseq = $fileseq ? $fileseq : 1;
  101. $position = intval($_GET['position']);
  102. $position = $position ? $position : 0;
  103. $offset = 100 * 1024;
  104. if($fileseq > count($updatefilelist)) {
  105. if($upgradeinfo['isupdatedb']) {
  106. $discuz_upgrade->download_file($upgradeinfo, 'install/data/install.sql');
  107. $discuz_upgrade->download_file($upgradeinfo, 'install/data/install_data.sql');
  108. $discuz_upgrade->download_file($upgradeinfo, 'update.php', 'utility');
  109. }
  110. $linkurl = 'action='.$theurl.'&step=3';
  111. cpmsg('upgrade_download_complete_to_compare', $linkurl, 'loading', array('upgradeurl' => upgradeinformation(0)));
  112. } else {
  113. $downloadstatus = $discuz_upgrade->download_file($upgradeinfo, $updatefilelist[$fileseq-1], 'upload', $updatemd5filelist[$fileseq-1], $position, $offset);
  114. if($downloadstatus == 1) {
  115. $linkurl = 'action='.$theurl.'&step=2&fileseq='.$fileseq.'&position='.($position+$offset);
  116. cpmsg('upgrade_downloading_file', $linkurl, 'loading', array('file' => $updatefilelist[$fileseq-1], 'percent' => sprintf("%2d", 100 * $fileseq/count($updatefilelist)).'%', 'upgradeurl' => upgradeinformation(1)));
  117. } elseif($downloadstatus == 2) {
  118. $linkurl = 'action='.$theurl.'&step=2&fileseq='.($fileseq+1);
  119. cpmsg('upgrade_downloading_file', $linkurl, 'loading', array('file' => $updatefilelist[$fileseq-1], 'percent' => sprintf("%2d", 100 * $fileseq/count($updatefilelist)).'%', 'upgradeurl' => upgradeinformation(1)));
  120. } else {
  121. cpmsg('upgrade_redownload', 'action='.$theurl.'&step=2&fileseq='.$fileseq, 'form', array('file' => $updatefilelist[$fileseq-1], 'upgradeurl' => upgradeinformation(-3)));
  122. }
  123. }
  124. } elseif($step == 3) {
  125. list($modifylist, $showlist, $ignorelist) = $discuz_upgrade->compare_basefile($upgradeinfo, $updatefilelist);
  126. if(empty($modifylist) && empty($showlist) && empty($ignorelist)) {
  127. cpmsg('filecheck_nofound_md5file', '', 'error', array('upgradeurl' => upgradeinformation(-4)));
  128. }
  129. showtablerow('class="header"', 'colspan="2"', $lang['founder_upgrade_diff_show']);
  130. foreach($updatefilelist as $v) {
  131. if(isset($ignorelist[$v])) {
  132. continue;
  133. } elseif(isset($modifylist[$v])) {
  134. showtablerow('', array('class="" style="color:red;"', 'class="td24" style="color:red;"'), array('<em class="files bold">'.$v.'</em>', $lang['founder_upgrade_diff'].'<em class="edited">&nbsp;</em>'));
  135. } elseif(isset($showlist[$v])) {
  136. showtablerow('', array('class=""', 'class="td24"'), array('<em class="files bold">'.$v.'</em>', $lang['founder_upgrade_normal'].'<em class="fixed">&nbsp;</em>'));
  137. } else {
  138. showtablerow('', array('class=""', 'class="td24"'), array('<em class="files bold">'.$v.'</em>', $lang['founder_upgrade_new'].'<em class="unknown">&nbsp;</em>'));
  139. }
  140. }
  141. $linkurl = ADMINSCRIPT.'?action='.$theurl.'&step=4';
  142. showtablerow('', 'colspan="2"', $lang['founder_upgrade_download_file'].' ./data/update/Discuz! X'.$version.' Release['.$release.']'.'');
  143. showtablerow('', 'colspan="2"', $lang['founder_upgrade_backup_file'].' ./data/back/Discuz! '.DISCUZ_VERSION.' Release['.DISCUZ_RELEASE.']'.$lang['founder_upgrade_backup_file2']);
  144. showtablerow('', 'colspan="2"', '<input type="button" class="btn" onclick="window.location.href=\''.$linkurl.'\'" value="'.(!empty($modifylist) ? $lang['founder_upgrade_force'] : $lang['founder_upgrade_regular']).'" />');
  145. echo upgradeinformation(0);
  146. } elseif($step == 4) {
  147. $confirm = $_GET['confirm'];
  148. if(!$confirm) {
  149. if($_GET['siteftpsetting']) {
  150. $action = $theurl.'&step=4&confirm=ftp'.($_GET['startupgrade'] ? '&startupgrade=1' : '');
  151. siteftp_form($action);
  152. exit;
  153. }
  154. if($upgradeinfo['isupdatedb']) {
  155. $checkupdatefilelist = array('install/update.php', 'install/data/install.sql','install/data/install_data.sql');
  156. $checkupdatefilelist = array_merge($checkupdatefilelist, $updatefilelist);
  157. } else {
  158. $checkupdatefilelist = $updatefilelist;
  159. }
  160. if($discuz_upgrade->check_folder_perm($checkupdatefilelist)) {
  161. $confirm = 'file';
  162. } else {
  163. $linkurl = ADMINSCRIPT.'?action='.$theurl.'&step=4';
  164. $ftplinkurl = $linkurl.'&siteftpsetting=1';
  165. cpmsg('upgrade_cannot_access_file',
  166. '',
  167. '',
  168. array(),
  169. '<br /><input type="button" class="btn" onclick="window.location.href=\''.$ftplinkurl.'\'" value="'.$lang['founder_upgrade_set_ftp'].'" />'.
  170. ' &nbsp; <input type="button" class="btn" onclick="window.location.href=\''.$linkurl.'\'" value="'.$lang['founder_upgrade_reset'].'" /><br /><br />'
  171. );
  172. }
  173. }
  174. $paraftp = '';
  175. if($_GET['siteftp']) {
  176. foreach($_GET['siteftp'] as $k => $v) {
  177. $paraftp .= '&siteftp['.$k.']='.$v;
  178. }
  179. }
  180. if(!$_GET['startupgrade']) {
  181. if(!$_GET['backfile']) {
  182. cpmsg('upgrade_backuping', 'action='.$theurl.'&step=4&backfile=1&confirm='.$confirm.$paraftp, 'loading', array('upgradeurl' => upgradeinformation(2)), false);
  183. }
  184. foreach($updatefilelist as $updatefile) {
  185. $destfile = DISCUZ_ROOT.$updatefile;
  186. $backfile = DISCUZ_ROOT.'./data/back/Discuz! X'.substr(DISCUZ_VERSION, 1).' Release['.DISCUZ_RELEASE.']/'.$updatefile;
  187. if(is_file($destfile)) {
  188. if(!$discuz_upgrade->copy_file($destfile, $backfile, 'file')) {
  189. cpmsg('upgrade_backup_error', '', 'error', array('upgradeurl' => upgradeinformation(-5)));
  190. }
  191. }
  192. }
  193. cpmsg('upgrade_backup_complete', 'action='.$theurl.'&step=4&startupgrade=1&confirm='.$confirm.$paraftp, 'loading', array('upgradeurl' => upgradeinformation(3)), false);
  194. }
  195. $linkurl = ADMINSCRIPT.'?action='.$theurl.'&step=4&startupgrade=1&confirm='.$confirm.$paraftp;
  196. $ftplinkurl = ADMINSCRIPT.'?action='.$theurl.'&step=4&startupgrade=1&siteftpsetting=1';
  197. foreach($updatefilelist as $updatefile) {
  198. $srcfile = DISCUZ_ROOT.'./data/update/Discuz! X'.$version.' Release['.$release.']/'.$updatefile;
  199. if($confirm == 'ftp') {
  200. $destfile = $updatefile;
  201. } else {
  202. $destfile = DISCUZ_ROOT.$updatefile;
  203. }
  204. if(!$discuz_upgrade->copy_file($srcfile, $destfile, $confirm)) {
  205. if($confirm == 'ftp') {
  206. cpmsg('upgrade_ftp_upload_error',
  207. '',
  208. '',
  209. array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-6)),
  210. '<br /><input type="button" class="btn" onclick="window.location.href=\''.$linkurl.'\'" value="'.$lang['founder_upgrade_reupload'].'" />'.
  211. ' &nbsp; <input type="button" class="btn" onclick="window.location.href=\''.$ftplinkurl.'\'" value="'.$lang['founder_upgrade_reset_ftp'].'" /><br /><br />'
  212. );
  213. } else {
  214. cpmsg('upgrade_copy_error',
  215. '',
  216. '',
  217. array('file' => $updatefile, 'upgradeurl' => upgradeinformation(-7)),
  218. '<br /><input type="button" class="btn" onclick="window.location.href=\''.$linkurl.'\'" value="'.$lang['founder_upgrade_recopy'].'" />'.
  219. ' &nbsp; <input type="button" class="btn" onclick="window.location.href=\''.$ftplinkurl.'\'" value="'.$lang['founder_upgrade_set_ftp'].'" /><br /><br />'
  220. );
  221. }
  222. }
  223. }
  224. if($upgradeinfo['isupdatedb']) {
  225. $dbupdatefilearr = array('update.php', 'install/data/install.sql','install/data/install_data.sql');
  226. foreach($dbupdatefilearr as $dbupdatefile) {
  227. $srcfile = DISCUZ_ROOT.'./data/update/Discuz! X'.$version.' Release['.$release.']/'.$dbupdatefile;
  228. $dbupdatefile = $dbupdatefile == 'update.php' ? 'install/update.php' : $dbupdatefile;
  229. if($confirm == 'ftp') {
  230. $destfile = $dbupdatefile;
  231. } else {
  232. $destfile = DISCUZ_ROOT.$dbupdatefile;
  233. }
  234. if(!$discuz_upgrade->copy_file($srcfile, $destfile, $confirm)) {
  235. if($confirm == 'ftp') {
  236. cpmsg('upgrade_ftp_upload_error',
  237. '',
  238. '',
  239. array('file' => $dbupdatefile, 'upgradeurl' => upgradeinformation(-6)),
  240. '<br /><input type="button" class="btn" onclick="window.location.href=\''.$linkurl.'\'" value="'.$lang['founder_upgrade_reupload'].'" />'.
  241. ' &nbsp; <input type="button" class="btn" onclick="window.location.href=\''.$ftplinkurl.'\'" value="'.$lang['founder_upgrade_reset_ftp'].'" /><br /><br />'
  242. );
  243. } else {
  244. cpmsg('upgrade_copy_error',
  245. '',
  246. '',
  247. array('file' => $dbupdatefile, 'upgradeurl' => upgradeinformation(-7)),
  248. '<br /><input type="button" class="btn" onclick="window.location.href=\''.$linkurl.'\'" value="'.$lang['founder_upgrade_recopy'].'" />'.
  249. ' &nbsp; <input type="button" class="btn" onclick="window.location.href=\''.$ftplinkurl.'\'" value="'.$lang['founder_upgrade_set_ftp'].'" /><br /><br />'
  250. );
  251. }
  252. }
  253. }
  254. $upgrade_step['step'] = 'dbupdate';
  255. C::t('common_cache')->insert(array(
  256. 'cachekey' => 'upgrade_step',
  257. 'cachevalue' => serialize($upgrade_step),
  258. 'dateline' => $_G['timestamp'],
  259. ), false, true);
  260. $dbreturnurl = $_G['siteurl'].ADMINSCRIPT.'?action=upgrade&operation='.$operation.'&version='.$version.'&release='.$release.'&step=5';
  261. cpmsg('upgrade_file_successful', $_G['siteurl'].'install/update.php?step=prepare&from='.rawurlencode($dbreturnurl).'&frommd5='.rawurlencode(md5($dbreturnurl.$_G['config']['security']['authkey'])), '', array('upgradeurl' => upgradeinformation(4)));
  262. }
  263. dheader('Location: '.ADMINSCRIPT.'?action=upgrade&operation='.$operation.'&version='.$version.'&release='.$release.'&step=5');
  264. } elseif($step == 5) {
  265. $file = DISCUZ_ROOT.'./data/update/Discuz! X'.$version.' Release['.$release.']/updatelist.tmp';
  266. @unlink($file);
  267. @unlink(DISCUZ_ROOT.'./install/update.php');
  268. C::t('common_cache')->delete('upgrade_step');
  269. C::t('common_cache')->delete('upgrade_run');
  270. C::t('common_setting')->update('upgrade', '');
  271. updatecache('setting');
  272. $old_update_dir = './data/update/';
  273. $new_update_dir = './data/update'.md5('update'.$_G['config']['security']['authkey']).'/';
  274. $old_back_dir = './data/back/';
  275. $new_back_dir = './data/back'.md5('back'.$_G['config']['security']['authkey']).'/';
  276. $discuz_upgrade->copy_dir(DISCUZ_ROOT.$old_update_dir, DISCUZ_ROOT.$new_update_dir);
  277. $discuz_upgrade->copy_dir(DISCUZ_ROOT.$old_back_dir, DISCUZ_ROOT.$new_back_dir);
  278. $discuz_upgrade->rmdirs(DISCUZ_ROOT.$old_update_dir);
  279. $discuz_upgrade->rmdirs(DISCUZ_ROOT.$old_back_dir);
  280. cpmsg('upgrade_successful', '', 'succeed', array('version' => $version, 'release' => $release, 'save_update_dir' => $new_update_dir, 'save_back_dir' => $new_back_dir, 'upgradeurl' => upgradeinformation(0)), '<script type="text/javascript">if(parent.document.getElementById(\'notice\')) parent.document.getElementById(\'notice\').style.display = \'none\';</script>');
  281. }
  282. showtablefooter();
  283. } elseif($operation == 'check') {
  284. if(!intval($_GET['rechecking'])) {
  285. $upgrade_step = C::t('common_cache')->fetch('upgrade_step');
  286. if(!empty($upgrade_step['cachevalue'])) {
  287. $upgrade_step['cachevalue'] = dunserialize($upgrade_step['cachevalue']);
  288. if(!empty($upgrade_step['cachevalue']['step'])) {
  289. $theurl = 'upgrade&operation='.$upgrade_step['cachevalue']['operation'].'&version='.$upgrade_step['cachevalue']['version'].'&locale='.$upgrade_step['cachevalue']['locale'].'&charset='.$upgrade_step['cachevalue']['charset'].'&release='.$upgrade_step['cachevalue']['release'];
  290. $steplang = array('', cplang('founder_upgrade_updatelist'), cplang('founder_upgrade_download'), cplang('founder_upgrade_compare'), cplang('founder_upgrade_upgrading'), cplang('founder_upgrade_complete'), 'dbupdate' => cplang('founder_upgrade_dbupdate'));
  291. $recheckurl = ADMINSCRIPT.'?action=upgrade&operation=recheck';
  292. if($upgrade_step['cachevalue']['step'] == 'dbupdate') {
  293. $dbreturnurl = $_G['siteurl'].ADMINSCRIPT.'?action='.$theurl.'&step=5';
  294. $stepurl = $_G['siteurl'].'install/update.php?step=prepare&from='.rawurlencode($dbreturnurl).'&frommd5='.rawurlencode(md5($dbreturnurl.$_G['config']['security']['authkey']));
  295. cpmsg('upgrade_continue',
  296. '',
  297. '',
  298. array('step' => $steplang['dbupdate']),
  299. '<br /><input type="button" class="btn" onclick="window.location.href=\''.$stepurl.'\'" value="'.$lang['founder_upgrade_continue'].'" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" class="btn" onclick="window.location.href=\''.$recheckurl.'\'" value="'.$lang['founder_upgrade_recheck'].'" /><br /><br />'
  300. );
  301. } else {
  302. $stepurl = ADMINSCRIPT.'?action='.$theurl.'&step='.$upgrade_step['cachevalue']['step'];
  303. cpmsg('upgrade_continue',
  304. '',
  305. '',
  306. array('step' => $steplang[$upgrade_step['cachevalue']['step']]),
  307. '<br /><input type="button" class="btn" onclick="window.location.href=\''.$stepurl.'\'" value="'.$lang['founder_upgrade_continue'].'" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" class="btn" onclick="window.location.href=\''.$recheckurl.'\'" value="'.$lang['founder_upgrade_recheck'].'" /><br /><br />'
  308. );
  309. }
  310. }
  311. }
  312. } else {
  313. C::t('common_cache')->delete('upgrade_step');
  314. }
  315. if(!intval($_GET['checking'])) {
  316. cpmsg('upgrade_checking', 'action=upgrade&operation=check&checking=1', 'loading', '', false);
  317. }
  318. $discuz_upgrade->check_upgrade();
  319. dheader('Location: '.ADMINSCRIPT.'?action=upgrade&operation=showupgrade');
  320. } elseif($operation == 'showupgrade') {
  321. shownav('tools', 'nav_founder_upgrade');
  322. showsubmenu('nav_founder_upgrade');
  323. showtableheader();
  324. if(!$_G['setting']['upgrade']) {
  325. cpmsg('upgrade_latest_version', '', 'succeed');
  326. } else {
  327. C::t('common_cache')->insert(array(
  328. 'cachekey' => 'upgrade_step',
  329. 'cachevalue' => serialize(array('curversion' => $discuz_upgrade->versionpath(), 'currelease' => DISCUZ_RELEASE)),
  330. 'dateline' => $_G['timestamp'],
  331. ), false, true);
  332. $upgraderow = $patchrow = array();
  333. $charset = str_replace('-', '', strtoupper($_G['config']['output']['charset']));
  334. $dbversion = helper_dbtool::dbversion();
  335. $locale = '';
  336. if($charset == 'BIG5') {
  337. $locale = 'TC';
  338. } elseif($charset == 'GBK') {
  339. $locale = 'SC';
  340. } elseif($charset == 'UTF8') {
  341. if($_G['config']['output']['language'] == 'zh_cn') {
  342. $locale = 'SC';
  343. } elseif($_G['config']['output']['language'] == 'zh_tw') {
  344. $locale = 'TC';
  345. }
  346. }
  347. foreach($_G['setting']['upgrade'] as $type => $upgrade) {
  348. $unupgrade = 0;
  349. if(version_compare($upgrade['phpversion'], PHP_VERSION) > 0 || version_compare($upgrade['mysqlversion'], $dbversion) > 0) {
  350. $unupgrade = 1;
  351. }
  352. $linkurl = ADMINSCRIPT.'?action=upgrade&operation='.$type.'&version='.$upgrade['latestversion'].'&locale='.$locale.'&charset='.$charset.'&release='.$upgrade['latestrelease'];
  353. if($unupgrade) {
  354. $upgraderow[] = showtablerow('', '', array('Discuz! X'.$upgrade['latestversion'].'_'.$locale.'_'.$charset.$lang['version'].' [Release '.$upgrade['latestrelease'].']'.($type == 'patch' ? '('.$lang['founder_upgrade_newword'].'release)' : '').'', $lang['founder_upgrade_require_config'].' php v'.PHP_VERSION.'MYSQL v'.$dbversion, ''), TRUE);
  355. } else {
  356. $upgraderow[] = showtablerow('', '', array('Discuz! X'.$upgrade['latestversion'].'_'.$locale.'_'.$charset.$lang['version'].' [Release '.$upgrade['latestrelease'].']'.($type == 'patch' ? '('.$lang['founder_upgrade_newword'].'release)' : '').'', '<input type="button" class="btn" onclick="confirm(\''.$lang['founder_upgrade_backup_remind'].'\') ? window.location.href=\''.$linkurl.'\' : \'\';" value="'.$lang['founder_upgrade_automatically'].'">', '<a href="'.$upgrade['official'].'" target="_blank">'.$lang['founder_upgrade_manually'].'</a>'), TRUE);
  357. }
  358. }
  359. showtablerow('class="header"','', array($lang['founder_upgrade_select_version'], '', ''));
  360. if($upgraderow) {
  361. foreach($upgraderow as $row) {
  362. echo $row;
  363. }
  364. }
  365. if($patchrow) {
  366. foreach($patchrow as $row) {
  367. echo $row;
  368. }
  369. }
  370. }
  371. showtablefooter();
  372. } elseif($operation == 'recheck') {
  373. $upgrade_step = C::t('common_cache')->fetch('upgrade_step');
  374. $upgrade_step = dunserialize($upgrade_step['cachevalue']);
  375. $file = DISCUZ_ROOT.'./data/update/Discuz! X'.$upgrade_step['version'].' Release['.$upgrade_step['release'].']/updatelist.tmp';
  376. @unlink($file);
  377. @unlink(DISCUZ_ROOT.'./install/update.php');
  378. C::t('common_cache')->delete('upgrade_step');
  379. C::t('common_cache')->delete('upgrade_run');
  380. C::t('common_setting')->update('upgrade', '');
  381. updatecache('setting');
  382. $old_update_dir = './data/update/';
  383. $discuz_upgrade->rmdirs(DISCUZ_ROOT.$old_update_dir);
  384. dheader('Location: '.ADMINSCRIPT.'?action=upgrade');
  385. }
  386. ?>