📄 upgrade.php.tmp
字号:
{?><input type=button value="next" onclick="javascript:do_start('Backup')"><?php}}function restoreSelect(){ title('Select Backup to Restore'); $dir = resolveTempDir(); $files = array(); if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (!preg_match('/kt-backup.+\.sql/',$file)) { continue; } $files[] = $file; } closedir($dh); } if (count($files) == 0) { ?> There don't seem to be any backups to restore from the <i>"<?php echo $dir;?>"</i> directory. <?php } else { ?> <P> Select a backup to restore from the list below: <P> <script> function selectRestore(filename) { document.location='?go=RestoreSelected&file=' + filename; } </script> <table border=1 cellpadding=1 cellspacing=1> <tr bgcolor="darkgrey"> <td>Filename <td>File Size <td>Action<?php $i=0; foreach($files as $file) { $color=((($i++)%2)==0)?'white':'lightgrey';?> <tr bgcolor="<?php echo $color;?>"> <td><?php echo $file;?> <td><?php echo filesize($dir . '/'.$file);?> <td><input type=button value="restore" onclick="javascript:selectRestore('<?php echo $file;?>')"><?php }?> </table> <?php } ?> <p> <input type=button value="back" onclick="javascript:do_start('welcome')"> <?php}function restoreSelected(){ $file=$_REQUEST['file']; $dir = resolveTempDir(); $_SESSION['backupFile'] = $dir . '/' . $file;?><script>document.location='?go=RestoreConfirm';</script><?php}function restoreConfirm(){ if (!isset($_SESSION['backupFile']) || !is_file($_SESSION['backupFile']) || filesize($_SESSION['backupFile']) == 0) { restoreSelect(); exit; } title('Confirm Restore'); $status = $_SESSION['backupStatus']; $filename=$_SESSION['backupFile']; $stmt=create_restore_stmt($filename); $dir=$stmt['dir']; if ($dir != '') {?><P><P>Manually, you would do the following to restore the backup:<P><table bgcolor="lightgrey"><tr><td><nobr>cd "<?php echo $dir;?>"</nobr><br><?php } else {?>The mysql backup utility could not be found automatically. Either do a manual restore, or edit the config.ini and update the backup/mysql Directory entry.<P>You can continue to do the restore manually using the following command(s):<P><table bgcolor="lightgrey"><tr><td><?php }?><nobr><?php echo $stmt['display'];?></table><P><?phpif ($dir != ''){?>Press <i>continue to restore</i> to attempt the command(s) above.<P><?php}?> <input type=button value="back" onclick="javascript:do_start('home')"> <input type=button value="select another backup" onclick="javascript:do_start('RestoreSelect')"><?phpif ($dir != ''){?><script>function restore(){ if (confirm('Are you sure you want to restore? This is your last chance if the current data has not been backed up.')) { do_start('Restore'); }}</script> <input type=button value="next" onclick="javascript:restore()"><?php}}function backupDone(){ check_state(2); set_state(3); title('Backup Status'); $status = $_SESSION['backupStatus']; $filename=$_SESSION['backupFile']; if ($status) { $stmt=create_restore_stmt($filename);?> The backup file <nobr><I>"<?php echo $filename;?>"</i></nobr> has been created. <P> It appears as though the <font color=green>backup has been successful</font>. <P> <?php if ($stmt['dir'] != '') { ?> Manually, you would do the following to restore the backup: <P> <table bgcolor="lightgrey"> <tr> <td> <nobr>cd <?php echo $stmt['dir'];?></nobr> <br> <?php } else { ?> The mysql backup utility could not be found automatically. Please edit the config.ini and update the backup/mysql Directory entry. <P> If you need to restore from this backup, you should be able to use the following statements: <P> <table bgcolor="lightgrey"> <tr> <td> <?php } ?> <nobr><?php echo $stmt['display'];?> </table><?php } else {?>It appears as though <font color=red>the backup process has failed</font>.<P></P> Unfortunately, it is difficult to diagnose these problems automaticallyand would recommend that you try to do the backup process manually.<P>We appologise for the inconvenience.<P><table bgcolor="lightgrey"><tr><td><?php echo $_SESSION['backupOutput'];?></table><?php }?><br> <input type=button value="back" onclick="javascript:do_start('welcome')"><?php if ($status) { ?> <input type=button value="next" onclick="javascript:do_start('UpgradeConfirm')"><?php }}function restoreDone(){ check_state(5); set_state(6); title('Restore Status'); $status = $_SESSION['restoreStatus']; $filename=$_SESSION['backupFile']; if ($status) {?> The restore of <nobr><I>"<?php echo $filename;?>"</i></nobr> has been completed. <P> It appears as though the <font color=green>restore has been successful</font>. <P><?php } else {?>It appears as though <font color=red>the restore process has failed</font>. <P>Unfortunately, it is difficult to diagnose these problems automaticallyand would recommend that you try to do the backup process manually.<P>We appologise for the inconvenience.<P><table bgcolor="lightgrey"><tr><td><?php echo $_SESSION['restoreOutput'];?></table><?php }?><br> <input type=button value="back" onclick="javascript:do_start('welcome')"><?php}function set_state($value){ $_SESSION['state'] = $value;}function check_state($value, $state='Home'){ if ($_SESSION['state'] != $value) { ?> <script> document.location="?go=<?php echo $state;?>"; </script> <?php exit; }}function backup(){ check_state(1); set_state(2); title('Backup In Progress'); $targetfile=$_SESSION['backupFile']; $stmt=create_backup_stmt($targetfile); $dir=$stmt['dir']; if (is_file($dir . '/mysqladmin') || is_file($dir . '/mysqladmin.exe')) { ob_flush(); flush();?> The backup is now underway. Please wait till it completes.<?php ob_flush(); flush(); $curdir=getcwd(); chdir($dir); ob_flush(); flush(); $handle = popen($stmt['cmd'], 'r'); $read = fread($handle, 10240); pclose($handle); $_SESSION['backupOutput']=$read; $dir=resolveTempDir(); $_SESSION['backupFile'] = $stmt['target']; if (OS_UNIX) { chmod($stmt['target'],0600); } if (is_file($stmt['target']) && filesize($stmt['target']) > 0) { $_SESSION['backupStatus'] = true; } else { $_SESSION['backupStatus'] = false; }?> <script> document.location="?go=BackupDone"; </script><?php } else {?><P> The <i>mysqldump</i> utility was not found in the <?php echo $dir;?> subdirectory. <input type=button value="back" onclick="javascript:do_start('welcome')"><?php }}function restore(){ check_state(1); set_state(5); title('Restore In Progress'); $status = $_SESSION['backupStatus']; $filename=$_SESSION['backupFile']; $stmt=create_restore_stmt($filename); $dir=$stmt['dir']; if (is_file($dir . '/mysql') || is_file($dir . '/mysql.exe')) {?> The restore is now underway. Please wait till it completes.<?php print "\n"; $curdir=getcwd(); chdir($dir); $ok=true; $stmts=explode("\n",$stmt['cmd']); foreach($stmts as $stmt) { $handle = popen($stmt, 'r'); if ($handle=='false') { $ok=false; break; } $read = fread($handle, 10240); pclose($handle); $_SESSION['restoreOutput']=$read; } $_SESSION['restoreStatus'] = $ok;?> <script> document.location="?go=RestoreDone"; </script><?php } else {?><P> The <i>mysql</i> utility was not found in the <?php echo $dir;?> subdirectory. <input type=button value="back" onclick="javascript:do_start('welcome')"><?php }}function welcome(){ set_state(1);?><br>Welcome to the <?php echo APP_NAME;?> Database Upgrade Wizard.<P> If you have just updatedyour <?php echo APP_NAME;?> code base, you will need to complete the upgrade process in order to ensure your system is fully operational with the new version.<P>You will not be able to log into <?php echo APP_NAME;?> until your the database upgrade process is completed.<P><font color=orange>!!NB!! You are advised to backup the database before attempting the upgrade. !!NB!!</font><P>If you have already done this, you may skip this step can continue directly to the upgrade.<P> <input type=button value="cancel" onclick="document.location='..';"> <input type=button value="backup now" onclick="javascript:do_start('BackupConfirm');"> <input type=button value="next" onclick="javascript:do_start('UpgradeConfirm');"> <input type=button value="restore database" onclick="javascript:do_start('RestoreConfirm');"><?php}function UpgradePreview(){ title('Preview Upgrade'); global $default;?> <p>The table below describes the upgrades that need to occur to upgrade your <?php echo APP_NAME;?> installation to <strong><?php echo $default->systemVersion;?></strong>. Click on the button below the table to perform the upgrades.</p> <?php $upgradeTable = generateUpgradeTable(); print $upgradeTable; ?> <br> <input type=button value="back" onclick="javascript:do_start('home')"> <input type=button value="next" onclick="javascript:do_start('Upgrade')"> <?php}function Upgrade(){ title('Upgrade In Progress'); global $default;?> <p>The table below describes the upgrades that have occurred to upgrade your <?php echo APP_NAME;?> installation to <strong><?php echo $default->systemVersion;?></strong>. <?php $pre_res = performPreUpgradeActions(); if (PEAR::isError($pre_res)) {?><font color="red">Pre-Upgrade actions failed.</font><br><?php } else {?><p><font color="green">Pre-Upgrade actions succeeded.</font><br><?php }?><p> <?php $res = performAllUpgrades(); if (PEAR::isError($res) || PEAR::isError($pres)) {?><font color="red">Upgrade failed.</font><?php } else {?><p><font color="green">Upgrade succeeded.</font><?php }?><p> <?php $post_pres = performPostUpgradeActions(); if (PEAR::isError($post_res)) {?><font color="red">Post-Upgrade actions failed.</font><br><br><?php } else {?><p><font color="green">Post-Upgrade actions succeeded.</font><br><br><script> alert("To complete the upgrade please do the following before continuing:\n\n1. Restart the services as appropriate for your environment.\n\n\nOn first run of your upgraded installaton please do the following:\n\n1. Hard refresh your bowser (CTRL-F5) on first view of the Dashboard.\n2. Enable the new plugins you wish to use.\n\n\nSelect 'next' at the bottom of this page to continue.")</script><?php }?> <input type=button value="back" onclick="javascript:do_start('home')"> <input type=button value="next" onclick="javascript:document.location='..';"><?php}?><tr><td height=80 <?php if($oKTConfig->get('ui/poweredByDisabled') == '0'){ ?> align="right"><img src="<?php echo $oKTConfig->get('ui/powerLogo');?>"></td> <?php }else{ ?> background="../resources/graphics/ktbg.png"> </td> <?php }?></table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -