Changeset 16
- Timestamp:
- Jun 12, 2009, 8:47:16 AM (15 years ago)
- Location:
- trunk/www
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/backup.php
r15 r16 4 4 { 5 5 var $Id; 6 var $Tash; 6 7 7 8 function __construct($Database, $Id) 8 9 { 9 10 $this->Database = $Database; 11 $this->Task = new Task($Database); 10 12 $this->Id = $Id; 11 13 $DbResult = $this->Database->query('SELECT * FROM `Backup` WHERE `Id`='.$Id); … … 13 15 } 14 16 15 function Restore( $Id)17 function Restore() 16 18 { 17 19 $this->Task->Add('Obnovení databáze', array( 20 'mysql --silent --skip-column-names -u server'.$ServerId.' -pserver'.$ServerId.' server'.$ServerId.'_mangos -e "show tables" | gawk \'{print "drop table " $1 ";"}\' | mysql -u server'.$ServerId.' -pserver'.$ServerId.' server'.$ServerId.'_mangos', 21 'mysql --silent --skip-column-names -u server'.$ServerId.' -pserver'.$ServerId.' server'.$ServerId.'_characters -e "show tables" | gawk \'{print "drop table " $1 ";"}\' | mysql -u server'.$ServerId.' -pserver'.$ServerId.' server'.$ServerId.'_characters', 22 'mysql --silent --skip-column-names -u server'.$ServerId.' -pserver'.$ServerId.' server'.$ServerId.'_realmd -e "show tables" | gawk \'{print "drop table " $1 ";"}\' | mysql -u server'.$ServerId.' -pserver'.$ServerId.' server'.$ServerId.'_realmd', 23 'mysql --silent --skip-column-names -u server'.$ServerId.' -pserver'.$ServerId.' server'.$ServerId.'_scriptdev2 -e "show tables" | gawk \'{print "drop table " $1 ";"}\' | mysql -u server'.$ServerId.' -pserver'.$ServerId.' server'.$ServerId.'_scriptdev2', 24 'mkdir /tmp/wowhosting', 25 'tar -xjf backup/'.$ServerId.'/backup.tar.bz2 -C /tmp/wowhosting', 26 'mysql --user server'.$ServerId.' --password server'.$ServerId.' server'.$ServerId.'_characters < /tmp/wowhosting/characters.sql', 27 'mysql --user server'.$ServerId.' --password server'.$ServerId.' server'.$ServerId.'_realmd < /tmp/wowhosting/realmd.sql', 28 'mysql --user server'.$ServerId.' --password server'.$ServerId.' server'.$ServerId.'_mangos < /tmp/wowhosting/mangos.sql', 29 'mysql --user server'.$ServerId.' --password server'.$ServerId.' server'.$ServerId.'_scriptdev2 < /tmp/wowhosting/scriptdev2.sql', 30 'rm -f /tmp/wowhosting', 31 )); 18 32 } 19 33 20 function Save($Id)34 function Create($ServerId) 21 35 { 22 36 $this->Task->Add('Záloha databáze serveru', array( 37 'mkdir /tmp/wowhosting', 38 'mysqldump --user server'.$ServerId.' --password server'.$ServerId.' --opt server'.$ServerId.'_characters > /tmp/wowhosting/characters.sql', 39 'mysqldump --user server'.$ServerId.' --password server'.$ServerId.' --opt server'.$ServerId.'_realmd > /tmp/wowhosting/realmd.sql', 40 'mysqldump --user server'.$ServerId.' --password server'.$ServerId.' --opt server'.$ServerId.'_mangos > /tmp/wowhosting/mangos.sql', 41 'mysqldump --user server'.$ServerId.' --password server'.$ServerId.' --opt server'.$ServerId.'_scriptdev2 > /tmp/wowhosting/scriptdev2.sql', 42 'tar -c -j /tmp/wowhosting > backup/'.$ServerId.'/backup.tar.bz2', 43 'rm -f /tmp/wowhosting', 44 )); 23 45 } 24 46 } -
trunk/www/emulator.php
r15 r16 5 5 var $Id; 6 6 var $Emulator; 7 var $Task; 7 8 8 9 function __construct($Database, $Id) 9 10 { 10 11 $this->Database = $Database; 12 $this->Task = new Task(&$Database); 11 13 $this->Id = $Id; 12 14 $DbResult = $this->Database->query('SELECT * FROM `Emulator` WHERE `Id`='.$Id); … … 14 16 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Emulator['ClientVersion']); 15 17 $this->Emulator['ClientVersion'] = $DbResult->fetch_assoc(); 16 }17 18 function AddTask($Title, $Task)19 {20 global $System;21 22 $this->Database->insert('Task', array('User' => $System->Modules['User']->User['Id'], 'Title' => $Title, 'Time' => 'NOW()', 'CommandList' => implode("\n", $Task)."\n"));23 18 } 24 19 … … 40 35 global $Config; 41 36 42 $this-> AddTask('Stažení emulátoru', array(37 $this->Task->Add('Stažení emulátoru', array( 43 38 'cd '.$Config['BaseDir'].'emulator/'.$this->Id.'/', 44 39 'git clone git://github.com/mangos/mangos.git source', … … 55 50 global $Config; 56 51 57 $this-> AddTask('Překlad emulátoru', array(52 $this->Task->Add('Překlad emulátoru', array( 58 53 'cd '.$Config['BaseDir'].'emulator/'.$this->Id.'/source', 59 54 'autoreconf -ifv', -
trunk/www/form.php
r15 r16 78 78 foreach($this->Definition['Items'] as $Index => $Item) 79 79 { 80 $this->Values[$I tem['Name']] = $DbRow[$Item['Name']];80 $this->Values[$Index] = $DbRow[$Index]; 81 81 } 82 82 } -
trunk/www/form_classes.php
r14 r16 76 76 'ServerList' => array( 77 77 'Title' => 'Server', 78 'Table' => '(SELECT `ClientVersion`.`Version`, `Server`.`Name`, `Server`.`Id`, `Server`.`NetworkPortRealmd`, `User`.`Name` AS `UserName` FROM `Server` JOIN `User` ON `User`.`Id` = `Server`.`User` JOIN `Database` ON `Database`.`Id` = `Server`.`Database` JOIN `Emulator` ON `Emulator`.`Id` = `Database`.`Emulator` JOIN `ClientVersion` ON `ClientVersion`.`Id` = `Emulator`.`ClientVersion`) AS T',78 'Table' => '(SELECT `ClientVersion`.`Version`, `Server`.`Name`, `Server`.`Id`, `Server`.`NetworkPortRealmd`, `User`.`Name` AS `UserName`, Server.Online, Server.CharacterOnlineCount, Server.CharacterCount, Server.AccountCount FROM `Server` JOIN `User` ON `User`.`Id` = `Server`.`User` JOIN `Database` ON `Database`.`Id` = `Server`.`Database` JOIN `Emulator` ON `Emulator`.`Id` = `Database`.`Emulator` JOIN `ClientVersion` ON `ClientVersion`.`Id` = `Emulator`.`ClientVersion`) AS T', 79 79 'Items' => array( 80 80 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''), … … 83 83 'Version' => array('Type' => 'Integer', 'Caption' => 'Verze', 'Default' => 0), 84 84 'Online' => array('Type' => 'OnlineState', 'Caption' => 'Stav', 'Default' => 0), 85 'Character Count' => array('Type' => 'Integer', 'Caption' => 'Hráčů online', 'Default' => 0),85 'CharacterOnlineCount' => array('Type' => 'Integer', 'Caption' => 'Hráčů online', 'Default' => 0), 86 86 'AccountCount' => array('Type' => 'Integer', 'Caption' => 'Účtů', 'Default' => 0), 87 87 'CharacterCount' => array('Type' => 'Integer', 'Caption' => 'Postav', 0), -
trunk/www/server.php
r15 r16 9 9 var $Id; 10 10 var $Server; 11 var $Task; 11 12 var $WorlddBaseNetworkPort = 8085; 12 13 var $RealmdBaseNetworkPort = 3724; … … 16 17 { 17 18 $this->Database = $Database; 19 $this->Task = new Task(&$Database); 18 20 $this->Id = $Id; 19 21 $DbResult = $this->Database->query('SELECT * FROM `Server` WHERE `Id`='.$Id); … … 31 33 else $this->Server['Database']['Emulator']['ClientVersion'] = array(); 32 34 } 33 } 34 35 function AddTask($Title, $Task) 36 { 37 global $System; 38 39 $this->Database->insert('Task', array('User' => $System->Modules['User']->User['Id'], 'Title' => $Title, 'Time' => 'NOW()', 'CommandList' => implode("\n", $Task)."\n")); 40 } 35 } 41 36 42 37 function CreateDatabase() … … 79 74 array_unshift($CommandList, 'mysql --silent --skip-column-names -u server'.$this->Id.' -pserver'.$this->Id.' server'.$this->Id.'_scriptdev2 -e "show tables" | gawk \'{print "drop table " $1 ";"}\' | mysql -u server'.$this->Id.' -pserver'.$this->Id.' server'.$this->Id.'_scriptdev2'); 80 75 } 81 $this-> AddTask('Inicializace databáze', $CommandList);82 } 76 $this->Task->Add('Inicializace databáze', $CommandList); 77 } 83 78 84 79 function AddServer($Version) … … 89 84 function Start() 90 85 { 91 $this-> AddTask('Start emulátoru', array(86 $this->Task->Add('Start emulátoru', array( 92 87 'screen -A -m -d -S server'.$this->Id.'-realmd emulator/'.$this->Server['Database']['Emulator']['Id'].'/bin/mangos-realmd -c server/'.$this->Id.'/etc/realmd.conf', 93 88 'screen -A -m -d -S server'.$this->Id.'-worldd server/'.$this->Id.'/bin/start.sh', … … 98 93 function Stop() 99 94 { 100 $this-> AddTask('Zastavení emulátoru', array(95 $this->Task->Add('Zastavení emulátoru', array( 101 96 'server/'.$this->Id.'/bin/stop.sh', 102 97 )); -
trunk/www/table.php
r15 r16 26 26 foreach($QueryParts as $Part) 27 27 { 28 $Part2 = explode('=', $Part); 29 $QueryItems[$Part2[0]] = $Part2[1]; 28 if($Part != '') 29 { 30 $Part2 = explode('=', $Part); 31 $QueryItems[$Part2[0]] = $Part2[1]; 32 } 30 33 } 31 34 $QueryItems['Order'] = $_GET['Order']; -
trunk/www/task.php
r11 r16 8 8 { 9 9 $this->Database = $Database; 10 } 10 } 11 12 function Add($Title, $Task) 13 { 14 global $System; 15 16 $this->Database->insert('Task', array('User' => $System->Modules['User']->User['Id'], 'Title' => $Title, 'Time' => 'NOW()', 'CommandList' => implode("\n", $Task)."\n")); 17 } 11 18 12 19 function ProcessAll()
Note:
See TracChangeset
for help on using the changeset viewer.