Changeset 31 for trunk/www/server.php
- Timestamp:
- Jun 14, 2009, 12:34:03 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/server.php
r30 r31 272 272 return($Output); 273 273 } 274 275 function Update($DatabaseId) 276 { 277 // Stop server before update 278 $Output = $this->Stop(); 279 280 // Backup current 281 $Backup = new Backup($this->Database, 0); 282 $Output .= '<br />'.$Backup->Create($this->Id); 283 284 // Do update 285 $Commands = array(); 286 $DbResult = $this->Database->query('SELECT `Revision` FROM `Database` WHERE `Id` = '.$this->Server['Database']['Id']); 287 $DbRow = $DbResult->fetch_assoc(); 288 $DatabaseRevisionStart = $DbRow['Revision']; 289 $DbResult = $this->Database->query('SELECT `Revision` FROM `Database` WHERE `Id` = '.$DatabaseId); 290 $DbRow = $DbResult->fetch_assoc(); 291 $DatabaseRevisionEnd = $DbRow['Revision']; 292 $DbResult = $this->Database->query('SELECT * FROM `DatabaseUpdate` WHERE (`Revision` > '.$DatabaseRevisionStart.') AND (`Revision` <= '.$DatabaseRevisionEnd.') ORDER BY `Revision`'); 293 while($DbRow = $DbResult->fetch_assoc()) 294 { 295 $Updates = explode("\n", $DbRow['Updates']); 296 foreach($Updates as $Update) 297 if($Update != '') 298 { 299 $Parts = explode('|', $Update); 300 $Command = 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_'.$Parts[0].' < database/'.$DbRow['Database'].'/update/'.$Parts[1]; 301 $Commands[] = $Command; 302 } 303 } 304 $this->Task->Add('Aktualizace databáze', $Commands); 305 $Output .= '<br />Úloha aktualizace serveru byla přidána do fronty.'; 306 return($Output); 307 } 274 308 } 275 309
Note:
See TracChangeset
for help on using the changeset viewer.