Changeset 46 for trunk/www/server.php
- Timestamp:
- Jun 19, 2009, 9:41:07 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/server.php
r45 r46 69 69 )); 70 70 } 71 // Lookup nearest database with full import 72 $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE (`Emulator` <> 0) AND (`Revision` <= '.$this->Server['Database']['Revision'].') AND (`SourceFileName` <> "") ORDER BY `Revision` DESC'); 73 $Database = $DbResult->fetch_assoc(); 74 71 75 $CommandList = array_merge($CommandList, array( 72 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < database/'.$ this->Server['Database']['Id'].'/'.$this->Server['Database']['SourceFileName'],73 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emulator/'.$ this->Server['Database']['Emulator']['Id'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_create_structure.sql',74 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emulator/'.$ this->Server['Database']['Emulator']['Id'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_script_full.sql',75 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < emulator/'.$ this->Server['Database']['Emulator']['Id'].'/source/src/bindings/ScriptDev2/sql/mangos_scriptname_full.sql',76 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_realmd < emulator/'.$ this->Server['Database']['Emulator']['Id'].'/share/mangos/sql/realmd.sql',77 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_characters < emulator/'.$ this->Server['Database']['Emulator']['Id'].'/share/mangos/sql/characters.sql',78 'php www/shell.php ServerDatabaseChange '.$this->Id.' '.$ this->Server['Database']['Id'],76 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < database/'.$Database['Id'].'/'.$Database['SourceFileName'], 77 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emulator/'.$Database['Emulator']['Id'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_create_structure.sql', 78 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emulator/'.$Database['Emulator']['Id'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_script_full.sql', 79 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < emulator/'.$Database['Emulator']['Id'].'/source/src/bindings/ScriptDev2/sql/mangos_scriptname_full.sql', 80 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_realmd < emulator/'.$Database['Emulator']['Id'].'/share/mangos/sql/realmd.sql', 81 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_characters < emulator/'.$Database['Emulator']['Id'].'/share/mangos/sql/characters.sql', 82 'php www/shell.php ServerDatabaseChange '.$this->Id.' '.$Database['Id'], 79 83 'php www/shell.php ServerUnLock '.$this->Id, 80 84 )); 81 85 $this->Task->Add('Inicializace databáze', $CommandList); 86 87 if($Database['Id'] != $this->Server['Database']['Id']) 88 { 89 $NewDatabaseId = $this->Server['Database']['Id']; 90 $this->Server['Database']['Id'] = $Database['Id']; 91 $this->Update($NewDatabaseId, false, false); 92 } 82 93 return('Úloha načtení nové databáze zařazena do fronty.'); 83 94 } … … 297 308 } 298 309 299 function Update($DatabaseId )310 function Update($DatabaseId, $DoBackup = true, $DoStop = true) 300 311 { 301 312 $this->Lock(); 313 $Output = ''; 302 314 303 315 // Stop server before update 304 $Output = $this->Stop(); 316 if($DoStop) 317 { 318 $Output .= $this->Stop(); 319 } 305 320 306 321 // Backup current 307 $Backup = new Backup($this->Database, 0); 308 $Output .= '<br />'.$Backup->Create($this->Id); 322 if($DoBackup) 323 { 324 $Backup = new Backup($this->Database, 0); 325 $Output .= '<br />'.$Backup->Create($this->Id); 326 } 309 327 310 328 // Do update … … 326 344 { 327 345 $Parts = explode('|', $Update); 328 $Command = 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_'.$Parts[0].' < database/'.$DbRow[' Database'].'/update/'.$Parts[1];346 $Command = 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_'.$Parts[0].' < database/'.$DbRow['Id'].'/'.$Parts[1]; 329 347 $Commands[] = $Command; 330 348 }
Note:
See TracChangeset
for help on using the changeset viewer.