Changeset 64
- Timestamp:
- Aug 5, 2009, 2:44:29 PM (15 years ago)
- Location:
- trunk/www
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/index.php
r62 r64 261 261 $RealmView = new RealmView($this->Database, $this->System); 262 262 $Output .= $RealmView->Create(); 263 } else 264 if($_GET['Action'] == 'RealmInitDatabase') 265 { 266 $RealmView = new RealmView($this->Database, $this->System); 267 $Output .= $RealmView->InitDatabase(); 263 268 } else 264 269 if($_GET['Action'] == 'RealmEdit') -
trunk/www/model/realm.php
r63 r64 76 76 'php www/shell.php RealmLock '.$this->Id, 77 77 ); 78 79 // Empty all tables 78 80 if($Delete == true) 79 81 { … … 84 86 )); 85 87 } 88 86 89 // Lookup nearest database with full import 87 90 $DbResult = $this->Database->query('SELECT * FROM `Database` WHERE (`Emulator` <> 0) AND (`Revision` <= '.$this->Data['Database']['Revision'].') AND (`SourceFileName` <> "") ORDER BY `Revision` DESC'); … … 93 96 'mysql --user=server'.$this->Data['Server'].' --password=server'.$this->Data['Server'].' realm'.$this->Id.'_scriptdev2 < emulator/'.$Database['Emulator'].'/source/src/bindings/ScriptDev2/sql/scriptdev2_script_full.sql', 94 97 'mysql --user=server'.$this->Data['Server'].' --password=server'.$this->Data['Server'].' realm'.$this->Id.'_mangos < emulator/'.$Database['Emulator'].'/source/src/bindings/ScriptDev2/sql/mangos_scriptname_full.sql', 95 'mysql --user=server'.$this->Data['Server'].' --password=server'.$this->Data['Server'].' realm'.$this->Id.'_characters < emulator/'.$Database['Emulator'].'/share/mangos/sql/characters.sql', 96 'php www/shell.php RealmDatabaseChange '.$this->Id.' '.$Database['Id'], 97 'php www/shell.php RealmUnLock '.$this->Id, 98 )); 98 'mysql --user=server'.$this->Data['Server'].' --password=server'.$this->Data['Server'].' realm'.$this->Id.'_characters < emulator/'.$Database['Emulator'].'/share/mangos/sql/characters.sql')); 99 if($Database['ACIDSourceFileName'] != '') 100 $CommandList[] = 'mysql --user=server'.$this->Data['Server'].' --password=server'.$this->Data['Server'].' realm'.$this->Id.'_mangos < database/'.$Database['Id'].'/'.$Database['ACIDSourceFileName']; 101 $CommandList[] = 'php www/shell.php RealmDatabaseChange '.$this->Id.' '.$Database['Id']; 102 $commandList[] = 'php www/shell.php RealmUnLock '.$this->Id; 99 103 $this->Task->Add('Inicializace databáze', $CommandList); 100 104 -
trunk/www/sql/full.sql
r49 r64 1 1 -- phpMyAdmin SQL Dump 2 -- version 3. 1.52 -- version 3.2.0.1 3 3 -- http://www.phpmyadmin.net 4 4 -- 5 5 -- Počítač: localhost 6 -- Vygenerováno: S obota 20. června 2009, 13:496 -- Vygenerováno: Středa 05. srpna 2009, 08:37 7 7 -- Verze MySQL: 5.0.77 8 8 -- Verze PHP: 5.2.9 … … 20 20 -- 21 21 22 DROP TABLE IF EXISTS `Backup`;23 22 CREATE TABLE IF NOT EXISTS `Backup` ( 24 23 `Id` int(11) NOT NULL auto_increment, … … 39 38 -- 40 39 41 DROP TABLE IF EXISTS `Client`;42 40 CREATE TABLE IF NOT EXISTS `Client` ( 43 41 `Id` int(11) NOT NULL auto_increment, … … 46 44 `ReleaseDate` date NOT NULL, 47 45 `Title` varchar(255) NOT NULL, 46 `Patch` varchar(255) NOT NULL, 48 47 PRIMARY KEY (`Id`) 49 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 4;48 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=75 ; 50 49 51 50 -- -------------------------------------------------------- … … 55 54 -- 56 55 57 DROP TABLE IF EXISTS `Database`;58 56 CREATE TABLE IF NOT EXISTS `Database` ( 59 57 `Id` int(11) NOT NULL auto_increment, … … 67 65 `Emulator` int(11) default NULL, 68 66 `Update` text NOT NULL, 67 `ACIDSourceFileName` varchar(255) NOT NULL, 69 68 PRIMARY KEY (`Id`), 70 69 KEY `Emulator` (`Emulator`) 71 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 3;70 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ; 72 71 73 72 -- -------------------------------------------------------- … … 77 76 -- 78 77 79 DROP TABLE IF EXISTS `Debug`;80 78 CREATE TABLE IF NOT EXISTS `Debug` ( 81 79 `Id` int(11) NOT NULL auto_increment, 82 80 `Time` datetime NOT NULL, 83 ` Server` int(11) NOT NULL,81 `Realm` int(11) NOT NULL, 84 82 `Backtrace` mediumtext NOT NULL, 85 83 `Log` text NOT NULL, … … 92 90 `Configuration` text NOT NULL, 93 91 PRIMARY KEY (`Id`), 94 KEY `Server` (` Server`)92 KEY `Server` (`Realm`) 95 93 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; 96 94 … … 101 99 -- 102 100 103 DROP TABLE IF EXISTS `Emulator`;104 101 CREATE TABLE IF NOT EXISTS `Emulator` ( 105 102 `Id` int(11) NOT NULL auto_increment, … … 115 112 PRIMARY KEY (`Id`), 116 113 KEY `Client` (`Client`) 117 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT= 6;114 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ; 118 115 119 116 -- -------------------------------------------------------- … … 123 120 -- 124 121 125 DROP TABLE IF EXISTS `History`;126 122 CREATE TABLE IF NOT EXISTS `History` ( 127 123 `Time` int(11) NOT NULL, … … 145 141 -- 146 142 147 DROP TABLE IF EXISTS `Log`;148 143 CREATE TABLE IF NOT EXISTS `Log` ( 149 144 `Time` datetime NOT NULL default '0000-00-00 00:00:00', … … 162 157 -- 163 158 164 DROP TABLE IF EXISTS `News`;165 159 CREATE TABLE IF NOT EXISTS `News` ( 166 160 `Id` int(11) NOT NULL auto_increment, … … 171 165 PRIMARY KEY (`Id`), 172 166 KEY `User` (`User`) 173 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; 174 175 -- -------------------------------------------------------- 176 177 -- 178 -- Struktura tabulky `Server` 179 -- 180 181 DROP TABLE IF EXISTS `Server`; 182 CREATE TABLE IF NOT EXISTS `Server` ( 183 `Id` int(11) NOT NULL auto_increment, 184 `Name` varchar(255) NOT NULL, 185 `NetworkPortRealmd` int(11) NOT NULL, 167 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; 168 169 -- -------------------------------------------------------- 170 171 -- 172 -- Struktura tabulky `Realm` 173 -- 174 175 CREATE TABLE IF NOT EXISTS `Realm` ( 176 `Id` int(11) NOT NULL auto_increment, 177 `Name` varchar(255) NOT NULL, 178 `Server` int(11) NOT NULL, 186 179 `NetworkPortWorldd` int(11) NOT NULL, 187 `User` int(11) NOT NULL,188 180 `Database` int(11) NOT NULL, 189 181 `Motd` varchar(255) NOT NULL, … … 198 190 `Lock` int(11) NOT NULL, 199 191 PRIMARY KEY (`Id`), 192 KEY `Database` (`Database`), 193 KEY `Server` (`Server`) 194 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ; 195 196 -- -------------------------------------------------------- 197 198 -- 199 -- Struktura tabulky `RealmLog` 200 -- 201 202 CREATE TABLE IF NOT EXISTS `RealmLog` ( 203 `Id` int(11) NOT NULL auto_increment, 204 `Realm` int(11) NOT NULL, 205 `Time` datetime NOT NULL, 206 `Text` text NOT NULL, 207 PRIMARY KEY (`Id`), 208 KEY `Server` (`Realm`), 209 KEY `Time` (`Time`) 210 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 211 212 -- -------------------------------------------------------- 213 214 -- 215 -- Struktura tabulky `Server` 216 -- 217 218 CREATE TABLE IF NOT EXISTS `Server` ( 219 `Id` int(11) NOT NULL auto_increment, 220 `Name` varchar(255) NOT NULL, 221 `NetworkPortRealmd` int(11) NOT NULL, 222 `User` int(11) NOT NULL, 223 `Database` int(11) NOT NULL, 224 `Description` text NOT NULL, 225 `Homepage` varchar(255) NOT NULL, 226 `TimeCreate` datetime NOT NULL, 227 `Online` int(11) NOT NULL, 228 `CharacterOnlineCount` int(11) NOT NULL, 229 `CharacterCount` int(11) NOT NULL, 230 `AccountCount` int(11) NOT NULL, 231 `Lock` int(11) NOT NULL, 232 `Started` int(11) NOT NULL, 233 PRIMARY KEY (`Id`), 200 234 KEY `User` (`User`), 201 235 KEY `Database` (`Database`) 202 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 2;236 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=23 ; 203 237 204 238 -- -------------------------------------------------------- … … 208 242 -- 209 243 210 DROP TABLE IF EXISTS `Task`;211 244 CREATE TABLE IF NOT EXISTS `Task` ( 212 245 `Id` int(11) NOT NULL auto_increment, … … 222 255 PRIMARY KEY (`Id`), 223 256 KEY `User` (`User`) 224 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT= 4 ;257 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ; 225 258 226 259 -- -------------------------------------------------------- … … 230 263 -- 231 264 232 DROP TABLE IF EXISTS `User`;233 265 CREATE TABLE IF NOT EXISTS `User` ( 234 266 `Id` int(11) NOT NULL auto_increment, … … 251 283 -- 252 284 253 DROP TABLE IF EXISTS `UserOnline`;254 285 CREATE TABLE IF NOT EXISTS `UserOnline` ( 255 286 `Id` int(11) NOT NULL auto_increment, … … 263 294 PRIMARY KEY (`Id`), 264 295 KEY `User` (`User`) 265 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT= 19;296 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=27 ; 266 297 267 298 -- … … 279 310 -- 280 311 ALTER TABLE `Debug` 281 ADD CONSTRAINT `Debug_ibfk_2` FOREIGN KEY (`Server`) REFERENCES `Server` (`Id`), 282 ADD CONSTRAINT `Debug_ibfk_1` FOREIGN KEY (`Server`) REFERENCES `Server` (`Id`); 312 ADD CONSTRAINT `Debug_ibfk_1` FOREIGN KEY (`Realm`) REFERENCES `Realm` (`Id`); 283 313 284 314 -- … … 307 337 308 338 -- 339 -- Omezení pro tabulku `Realm` 340 -- 341 ALTER TABLE `Realm` 342 ADD CONSTRAINT `Realm_ibfk_1` FOREIGN KEY (`Server`) REFERENCES `Server` (`Id`), 343 ADD CONSTRAINT `Realm_ibfk_2` FOREIGN KEY (`Database`) REFERENCES `Database` (`Id`); 344 345 -- 346 -- Omezení pro tabulku `RealmLog` 347 -- 348 ALTER TABLE `RealmLog` 349 ADD CONSTRAINT `RealmLog_ibfk_1` FOREIGN KEY (`Realm`) REFERENCES `Realm` (`Id`); 350 351 -- 309 352 -- Omezení pro tabulku `Server` 310 353 -- 311 354 ALTER TABLE `Server` 312 ADD CONSTRAINT `Server_ibfk_ 2` FOREIGN KEY (`Database`) REFERENCES `Database` (`Id`),313 ADD CONSTRAINT `Server_ibfk_ 1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);355 ADD CONSTRAINT `Server_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`), 356 ADD CONSTRAINT `Server_ibfk_2` FOREIGN KEY (`Database`) REFERENCES `Database` (`Id`); 314 357 315 358 -- -
trunk/www/view/base.php
r57 r64 12 12 '<li><a href="http://www.udbforums.org/">UDB</a> - databáze pro MaNGOS</li>'. 13 13 '<li><a href="http://www.scriptdev2.com/">ScriptDev2</a> - doplňkový skriptovací systém pro MaNGOS</li>'. 14 '<li><a href="http://cia.vc/stats/project/ACID"> ACID</a> - databáze pro skriptování NPC</li>'. 14 15 '</ul>'; 15 16 return($Output); -
trunk/www/view/realm.php
r62 r64 156 156 $Output .= ' <a href="?Action=RealmEdit&Id='.$Realm->Id.'">Upravit základní nastavení</a>'; 157 157 $Output .= ' <a href="?Action=RealmEditDetailed&Id='.$Realm->Id.'">Upravit podrobné nastavení</a>'; 158 $Output .= ' <a href="?Action=RealmInitDatabase&Id='.$Realm->Id.'">Vynulovat databázi</a>'; 158 159 } 159 160 $Output .= ' <a href="?Action=DebugList&Id='.$Realm->Id.'">Ladící informace</a>'; … … 342 343 return($Output); 343 344 } 345 346 function InitDatabase() 347 { 348 global $Config; 349 350 if(array_key_exists('Id', $_GET)) 351 { 352 $RealmId = $_GET['Id']; 353 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 354 { 355 $Realm = new Realm($this->Database, $RealmId); 356 if($Realm->GetUser() == $this->System->Modules['User']->User['Id']) 357 { 358 $Output = $this->System->SystemMessage('Vynulování databáze', $Realm->ImportDatabase(true)); 359 $TaskView = new TaskView($this->Database, $this->System); 360 $Output .= $TaskView->ItemList(); 361 //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']); 362 //$Form->OnSubmit = '?Action=ServerCreate'; 363 //$Output .= $Form->ShowEditForm(); 364 } else $Output = $this->System->SystemMessage('Vynulování databáze', 'Nemáte oprávnění'); 365 } else $Output = USER_BAD_ROLE; 366 } else $Output = $this->System->SystemMessage('Vynulování databáze', 'Nezadáno Id serveru'); 367 return($Output); 368 } 344 369 } 345 370 -
trunk/www/view/task.php
r59 r64 48 48 function ErrorLog() 49 49 { 50 $DbResult = $this->Database->select('Task', 'Title, Error ', 'Id='.$_GET['Id']);51 $DbRow = $DbResult->fetch_assoc(); 50 $DbResult = $this->Database->select('Task', 'Title, Error, State', 'Id='.$_GET['Id']); 51 $DbRow = $DbResult->fetch_assoc(); 52 52 $Output = '<h4>Chybový výpis úlohy: '.$DbRow['Title'].'</h4>'; 53 $Output .= '<pre>'.$DbRow['Error'].'</pre>'; 53 if($DbRow['State'] == 1) $Output .= '<pre>'.file_get_contents('../temp/wowhosting_script.sh.err').'</pre>'; 54 else $Output .= '<pre>'.$DbRow['Error'].'</pre>'; 54 55 return($Output); 55 56 } … … 57 58 function StandardLog() 58 59 { 59 $DbResult = $this->Database->select('Task', 'Title, Output ', 'Id='.$_GET['Id']);60 $DbResult = $this->Database->select('Task', 'Title, Output, State', 'Id='.$_GET['Id']); 60 61 $DbRow = $DbResult->fetch_assoc(); 61 62 $Output = '<h4>Výpis výstupu úlohy: '.$DbRow['Title'].'</h4>'; 63 if($DbRow['State'] == 1) $Output .= '<pre>'.file_get_contents('../temp/wowhosting_script.sh.log').'</pre>'; 62 64 $Output .= '<pre>'.$DbRow['Output'].'</pre>'; 63 65 return($Output);
Note:
See TracChangeset
for help on using the changeset viewer.