Changeset 4 for trunk/www/server.php
- Timestamp:
- Jun 8, 2009, 9:50:59 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/server.php
r3 r4 12 12 $DbResult = $this->Database->query('SELECT * FROM `Server` WHERE `Id`='.$Id); 13 13 $this->Server = $DbResult->fetch_assoc(); 14 $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE `Id`='.$this->Server['Database']); 15 $this->Server['Database'] = $DbResult->fetch_assoc(); 16 $DbResult = $this->Database->query('SELECT * FROM `Emulator` WHERE `Id`='.$this->Server['Database']['Emulator']); 17 $this->Server['Database']['Emulator'] = $DbResult->fetch_assoc(); 14 18 } 15 19 16 function AddTask($T ask)20 function AddTask($Title, $Task) 17 21 { 18 $this->Database->insert('Task', array('Server' => $this->Server['Id'], 'Ti me' => 'NOW()', 'Command' => $Task));22 $this->Database->insert('Task', array('Server' => $this->Server['Id'], 'Title' => $Title, 'Time' => 'NOW()', 'CommandList' => implode("\n", $Task))); 19 23 } 20 24 … … 25 29 $DbResult = $this->Database->query('SELECT `Revision` FROM `Emulator` WHERE `Id`='.$Database['Emulator']); 26 30 $Emulator = $DbResult->fetch_assoc(); 27 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < emu/mangos/'.$Emulator['Revision'].'/udb/'.$Database['SourceFileName']); 28 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_create_structure.sql'); 29 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_script_full.sql'); 30 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/mangos_scriptname_full.sql'); 31 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_realmd < emu/mangos/'.$Emulator['Revision'].'/mangos/sql/realmd.sql'); 32 $this->AddTask('mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_characters < emu/mangos/'.$Emulator['Revision'].'/mangos/sql/characters.sql'); 31 $this->AddTask('Inicializace databáze', array( 32 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < emu/mangos/'.$Emulator['Revision'].'/udb/'.$Database['SourceFileName'], 33 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_create_structure.sql', 34 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_scriptdev2 < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_script_full.sql', 35 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_mangos < emu/mangos/'.$Emulator['Revision'].'/source/src/bindings/ScriptDev2/sql/mangos_scriptname_full.sql', 36 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_realmd < emu/mangos/'.$Emulator['Revision'].'/mangos/sql/realmd.sql', 37 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_characters < emu/mangos/'.$Emulator['Revision'].'/mangos/sql/characters.sql')); 33 38 } 34 39 … … 40 45 function Start() 41 46 { 47 AddTask('Start emulátoru', array( 48 'screen -A -m -d -S server'.$this->Id.'-realmd emu/mangos/'.$this->Server['Database']['Emulator']['Revision'].'/bin/mangos-realmd -c server/'.$this->Id.'/etc/realmd.conf', 49 'screen -A -m -d -S server'.$this->Id.'-realmd emu/mangos/'.$this->Server['Database']['Emulator']['Revision'].'/bin/mangos-worldd -c server/'.$this->Id.'/etc/mangosd.conf', 50 )); 42 51 } 43 52 44 53 function Stop() 45 54 { 55 AddTask('Zastavení emulátoru', array( 56 'ps -ef | grep \'SCREEN -A -m -d -S server'.$this->Id.'-realmd\' | grep -v grep | awk \'{print $2}\' | xargs -i kill {}', 57 'ps -ef | grep \'SCREEN -A -m -d -S server'.$this->Id.'-worldd\' | grep -v grep | awk \'{print $2}\' | xargs -i kill {}', 58 )); 46 59 } 47 60 }
Note:
See TracChangeset
for help on using the changeset viewer.