Changeset 28 for trunk/www/backup.php
- Timestamp:
- Jun 13, 2009, 9:01:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/backup.php
r16 r28 12 12 $this->Id = $Id; 13 13 $DbResult = $this->Database->query('SELECT * FROM `Backup` WHERE `Id`='.$Id); 14 $this->Backup = $DbResult->fetch_assoc(); 14 if($DbResult->num_rows > 0) $this->Backup = $DbResult->fetch_assoc(); 15 else $this->Backup = array(); 15 16 } 16 17 … … 22 23 '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 24 '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',25 'mkdir temp/wowhosting', 26 'tar -xjf backup/wowhosting-'.$ServerId.'.tar.bz2 -C temp/wowhosting', 27 'mysql --user server'.$ServerId.' --password server'.$ServerId.' server'.$ServerId.'_characters < temp/wowhosting/characters.sql', 28 'mysql --user server'.$ServerId.' --password server'.$ServerId.' server'.$ServerId.'_realmd < temp/wowhosting/realmd.sql', 29 'mysql --user server'.$ServerId.' --password server'.$ServerId.' server'.$ServerId.'_mangos < temp/wowhosting/mangos.sql', 30 'mysql --user server'.$ServerId.' --password server'.$ServerId.' server'.$ServerId.'_scriptdev2 < temp/wowhosting/scriptdev2.sql', 31 'rm -f temp/wowhosting', 31 32 )); 32 33 } … … 34 35 function Create($ServerId) 35 36 { 37 $Server = new Server($this->Database, $ServerId); 38 $Description = 'MaNGOS r'.$Server->Server['Database']['Emulator']['Revision'].', UDB r'.$Server->Server['Database']['Revision'].', SD2 r'.$Server->Server['Database']['ScriptDev2Revision'].', Client '.$Server->Server['Database']['Emulator']['Client']['Version']; 39 $this->Database->insert('Backup', array('Server' => $ServerId, 'Time' => 'NOW()', 'Description' => $Description)); 40 $this->Id = $this->Database->insert_id; 36 41 $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', 42 'mkdir temp/wowhosting', 43 'mysqldump --user=server'.$ServerId.' --password=server'.$ServerId.' --opt server'.$ServerId.'_characters > temp/wowhosting/characters.sql', 44 'mysqldump --user=server'.$ServerId.' --password=server'.$ServerId.' --opt server'.$ServerId.'_realmd > temp/wowhosting/realmd.sql', 45 'mysqldump --user=server'.$ServerId.' --password=server'.$ServerId.' --opt server'.$ServerId.'_mangos > temp/wowhosting/mangos.sql', 46 'mysqldump --user=server'.$ServerId.' --password=server'.$ServerId.' --opt server'.$ServerId.'_scriptdev2 > temp/wowhosting/scriptdev2.sql', 47 'cd temp', 48 'tar -c -j wowhosting > ../backup/wowhosting-'.$this->Id.'.tar.bz2', 49 'rm -rf wowhosting', 44 50 )); 51 return('Úloha zálohování byla zařazena do fronty'); 45 52 } 46 53 }
Note:
See TracChangeset
for help on using the changeset viewer.