Commit 6726e93db58859a7efd9feb621068bde85f3057f

Authored by unknown
1 parent f5c0c01c

Fixed bug in DB Upgrade Wizard restore step - selection table of backups was empty.

Story ID:124469. 3.7 Database Upgrade Script

Committed by: Paul Barrett
setup/upgrade/steps/upgradeRestore.php
@@ -105,7 +105,7 @@ class upgradeRestore extends Step { @@ -105,7 +105,7 @@ class upgradeRestore extends Step {
105 */ 105 */
106 private function storeSilent() { 106 private function storeSilent() {
107 } 107 }
108 - 108 + /*
109 // these belong in a shared lib 109 // these belong in a shared lib
110 function set_state($value) 110 function set_state($value)
111 { 111 {
@@ -123,19 +123,16 @@ function check_state($value, $state='Home') @@ -123,19 +123,16 @@ function check_state($value, $state='Home')
123 exit; 123 exit;
124 } 124 }
125 } 125 }
126 - 126 +*/
127 function restore() 127 function restore()
128 { 128 {
129 - check_state(1);  
130 - set_state(5); 129 +// check_state(1);
  130 +// set_state(5);
131 // title('Restore In Progress'); 131 // title('Restore In Progress');
132 $status = $_SESSION['backupStatus']; 132 $status = $_SESSION['backupStatus'];
133 - $filename=$_SESSION['backupFile'];  
134 - $stmt=create_restore_stmt($filename);  
135 - $dir=$stmt['dir'];  
136 -  
137 -  
138 - 133 + $filename = $_SESSION['backupFile'];
  134 + $stmt = $this->util->create_restore_stmt($filename);
  135 + $dir = $stmt['dir'];
139 136
140 if (is_file($dir . '/mysql') || is_file($dir . '/mysql.exe')) 137 if (is_file($dir . '/mysql') || is_file($dir . '/mysql.exe'))
141 { 138 {
@@ -166,20 +163,8 @@ function check_state($value, $state='Home') @@ -166,20 +163,8 @@ function check_state($value, $state='Home')
166 $_SESSION['restoreOutput']=$read; 163 $_SESSION['restoreOutput']=$read;
167 } 164 }
168 165
169 -  
170 -  
171 -  
172 -  
173 $_SESSION['restoreStatus'] = $ok; 166 $_SESSION['restoreStatus'] = $ok;
174 167
175 -  
176 -?>  
177 - <script type="text/javascript">  
178 - document.location="?go=RestoreDone";  
179 - </script>  
180 -<?php  
181 -  
182 -  
183 } 168 }
184 else 169 else
185 { 170 {
@@ -191,18 +176,16 @@ function check_state($value, $state=&#39;Home&#39;) @@ -191,18 +176,16 @@ function check_state($value, $state=&#39;Home&#39;)
191 <?php 176 <?php
192 } 177 }
193 178
194 -  
195 -  
196 } 179 }
197 180
198 181
199 function restoreDone() 182 function restoreDone()
200 { 183 {
201 - check_state(5);  
202 - set_state(6); 184 +// check_state(5);
  185 +// set_state(6);
203 // title('Restore Status'); 186 // title('Restore Status');
204 $status = $_SESSION['restoreStatus']; 187 $status = $_SESSION['restoreStatus'];
205 - $filename=$_SESSION['backupFile']; 188 + $filename = $_SESSION['backupFile'];
206 189
207 if ($status) 190 if ($status)
208 { 191 {
@@ -246,9 +229,9 @@ We appologise for the inconvenience. @@ -246,9 +229,9 @@ We appologise for the inconvenience.
246 229
247 function restoreSelect() 230 function restoreSelect()
248 { 231 {
  232 + $this->temp_variables['availableBackups'] = false;
249 // title('Select Backup to Restore'); 233 // title('Select Backup to Restore');
250 -  
251 - $dir = $this->resolveTempDir(); 234 + $dir = $this->util->resolveTempDir();
252 235
253 $files = array(); 236 $files = array();
254 if ($dh = opendir($dir)) 237 if ($dh = opendir($dir))
@@ -263,10 +246,10 @@ function restoreSelect() @@ -263,10 +246,10 @@ function restoreSelect()
263 closedir($dh); 246 closedir($dh);
264 } 247 }
265 248
266 - $this->temp_variables['availableBackups'] = false;  
267 $this->temp_variables['dir'] = $dir; 249 $this->temp_variables['dir'] = $dir;
268 if (count($files) != 0) { 250 if (count($files) != 0) {
269 $this->temp_variables['availableBackups'] = true; 251 $this->temp_variables['availableBackups'] = true;
  252 + $this->temp_variables['files'] = $files;
270 } 253 }
271 } 254 }
272 255
@@ -274,7 +257,7 @@ function restoreSelected() @@ -274,7 +257,7 @@ function restoreSelected()
274 { 257 {
275 $file=$_REQUEST['file']; 258 $file=$_REQUEST['file'];
276 259
277 - $dir = $this->resolveTempDir(); 260 + $dir = $this->util->resolveTempDir();
278 $_SESSION['backupFile'] = $dir . '/' . $file; 261 $_SESSION['backupFile'] = $dir . '/' . $file;
279 ?> 262 ?>
280 <?php 263 <?php
@@ -290,8 +273,8 @@ function restoreConfirm() @@ -290,8 +273,8 @@ function restoreConfirm()
290 } 273 }
291 274
292 $status = $_SESSION['backupStatus']; 275 $status = $_SESSION['backupStatus'];
293 - $filename=$_SESSION['backupFile'];  
294 - $stmt = $this->create_restore_stmt($filename); 276 + $filename = $_SESSION['backupFile'];
  277 + $stmt = $this->util->create_restore_stmt($filename);
295 278
296 $this->temp_variables['dir'] = $stmt['dir']; 279 $this->temp_variables['dir'] = $stmt['dir'];
297 $this->temp_variables['display'] = $stmt['display']; 280 $this->temp_variables['display'] = $stmt['display'];
setup/upgrade/upgradeUtil.php
@@ -39,6 +39,9 @@ @@ -39,6 +39,9 @@
39 * @package Upgrader 39 * @package Upgrader
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
  42 +
  43 +require '../../config/dmsDefaults.php';
  44 +
42 class UpgradeUtil { 45 class UpgradeUtil {
43 /** 46 /**
44 * Constructs upgradeation object 47 * Constructs upgradeation object