Changeset 16 for trunk/www/backup.php
- Timestamp:
- Jun 12, 2009, 8:47:16 AM (15 years ago)
- File:
-
- 1 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 }
Note:
See TracChangeset
for help on using the changeset viewer.