Changeset 62 for trunk/www/model/server.php
- Timestamp:
- Aug 5, 2009, 7:30:23 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/model/server.php
r57 r62 40 40 $this->Database->query('DROP USER "server'.$this->Id.'"@"localhost"'); 41 41 } 42 43 function ImportDatabase($Delete = false)44 {45 $this->Lock();46 $CommandList = array(47 'php www/shell.php ServerLock '.$this->Id,48 );49 if($Delete == true)50 {51 $CommandList = array_merge($CommandList, array(52 'mysql --silent --skip-column-names -u server'.$this->Id.' -pserver'.$this->Id.' server'.$this->Id.'_realmd -e "show tables" | gawk \'{print "drop table " $1 ";"}\' | mysql -u server'.$this->Id.' -pserver'.$this->Id.' server'.$this->Id.'_realmd',53 ));54 }55 // Lookup nearest database with full import56 $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE (`Emulator` <> 0) AND (`Revision` <= '.$this->Server['Database']['Revision'].') AND (`SourceFileName` <> "") ORDER BY `Revision` DESC');57 $Database = $DbResult->fetch_assoc();58 59 $CommandList = array_merge($CommandList, array(60 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_realmd < emulator/'.$Database['Emulator']['Id'].'/share/mangos/sql/realmd.sql',61 'php www/shell.php ServerDatabaseChange '.$this->Id.' '.$Database['Id'],62 'php www/shell.php ServerUnLock '.$this->Id,63 ));64 $this->Task->Add('Inicializace databáze', $CommandList);65 66 if($Database['Id'] != $this->Server['Database']['Id'])67 {68 $NewDatabaseId = $this->Server['Database']['Id'];69 $this->Server['Database']['Id'] = $Database['Id'];70 $this->Update($NewDatabaseId, false, false);71 }72 return('Úloha načtení nové databáze zařazena do fronty.');73 }74 42 75 43 function Start() … … 228 196 } 229 197 198 function ImportDatabase($Delete = false) 199 { 200 $this->Lock(); 201 $CommandList = array( 202 'php www/shell.php ServerLock '.$this->Id, 203 ); 204 if($Delete == true) 205 { 206 $CommandList = array_merge($CommandList, array( 207 'mysql --silent --skip-column-names -u server'.$this->Id.' -pserver'.$this->Id.' server'.$this->Id.'_realmd -e "show tables" | gawk \'{print "drop table " $1 ";"}\' | mysql -u server'.$this->Id.' -pserver'.$this->Id.' server'.$this->Id.'_realmd', 208 )); 209 } 210 // Lookup nearest database with full import 211 $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE (`Emulator` <> 0) AND (`Revision` <= '.$this->Server['Database']['Revision'].') AND (`SourceFileName` <> "") ORDER BY `Revision` DESC'); 212 $Database = $DbResult->fetch_assoc(); 213 214 $CommandList = array_merge($CommandList, array( 215 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_realmd < emulator/'.$Database['Emulator']['Id'].'/share/mangos/sql/realmd.sql', 216 'php www/shell.php ServerDatabaseChange '.$this->Id.' '.$Database['Id'], 217 'php www/shell.php ServerUnLock '.$this->Id, 218 )); 219 $this->Task->Add('Inicializace databáze', $CommandList); 220 221 if($Database['Id'] != $this->Server['Database']['Id']) 222 { 223 $NewDatabaseId = $this->Server['Database']['Id']; 224 $this->Server['Database']['Id'] = $Database['Id']; 225 $this->Update($NewDatabaseId, false, false); 226 } 227 return('Úloha načtení nové databáze zařazena do fronty.'); 228 } 229 230 230 function Update($DatabaseId, $DoBackup = true, $DoStop = true) 231 231 { … … 264 264 { 265 265 $Parts = explode('|', $Update); 266 $Command = 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_'.$Parts[0].' < database/'.$DbRow['Id'].'/'.$Parts[1]; 266 if($Parts[0] == 'realmd') 267 $Command = 'mysql --user=server'.$this->Id.' --password=server'.$this->Id.' server'.$this->Id.'_'.$Parts[0].' < database/'.$DbRow['Id'].'/'.$Parts[1]; 267 268 $Commands[] = $Command; 268 269 }
Note:
See TracChangeset
for help on using the changeset viewer.