Changeset 737 for trunk/Common/Setup/Setup.php
- Timestamp:
- Apr 14, 2015, 10:16:16 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Setup/Setup.php
r731 r737 15 15 var $Updates; 16 16 var $ConfigDir; 17 17 18 18 function __construct($System) 19 19 { … … 24 24 $this->ConfigDir = dirname(__FILE__).'/../..'; 25 25 } 26 26 27 27 function LoginPanel() 28 28 { … … 36 36 return($Output); 37 37 } 38 38 39 39 function ControlPanel() 40 40 { 41 41 global $YesNo; 42 42 $Output = ''; 43 43 44 44 $Output .= 'Je připojení k databázi: '.$YesNo[$this->UpdateManager->Database->Connected()].'<br/>'; 45 45 if($this->UpdateManager->Database->Connected()) … … 58 58 $Output .= '<a href="?action=uninstall">Odinstalovat</a> '; 59 59 $Output .= '<a href="?action=modules">Správa modulů</a> '; 60 $Output .= '<a href="?action=models">Přegenerovat modely</a> '; 60 61 } else $Output .= '<a href="?action=install">Instalovat</a> '; 61 62 } … … 65 66 return($Output); 66 67 } 67 68 68 69 function Show() 69 70 { 70 71 global $ConfigDefinition, $DatabaseRevision, $Config, $Updates; 71 72 72 73 $this->UpdateManager = $this->System->Setup->UpdateManager; 73 74 $DefaultConfig = new DefaultConfig(); 74 75 $this->ConfigDefinition = $DefaultConfig->Get(); 75 76 $this->DatabaseRevision = $DatabaseRevision; 76 $this->Config = &$Config; 77 $this->Config = &$Config; 77 78 78 79 $Output = ''; … … 85 86 $Output .= $this->LoginPanel(); 86 87 } else 87 { 88 { 88 89 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 89 90 else $Action = ''; … … 94 95 $Output .= $this->LoginPanel(); 95 96 } else 97 if($Action == 'models') 98 { 99 $this->System->FormManager->UpdateSQLMeta(); 100 } else 96 101 if($Action == 'upgrade') 97 102 { 98 103 $Output .= '<h3>Povýšení</h3>'; 99 try { 104 try { 100 105 $Output .= $this->System->Setup->Upgrade(); 101 106 } catch (Exception $E) { … … 134 139 if($Action == 'modules') 135 140 { 136 $Output .= $this->ShowModules(); 141 $Output .= $this->ShowModules(); 137 142 } else 138 143 if($Action == 'configure_save') … … 161 166 return($Output); 162 167 } 163 168 164 169 function ShowModules() 165 170 { … … 201 206 return($Output); 202 207 } 203 208 204 209 function ShowList() 205 210 { 206 211 global $YesNo; 207 212 208 213 $Output = ''; 209 214 210 215 $Pageing = new Paging(); 211 216 $Pageing->TotalCount = count($this->System->ModuleManager->Modules); … … 227 232 else $Dependencies = ' '; 228 233 $Actions = ''; 229 if($Module->Installed == true) 234 if($Module->Installed == true) 230 235 { 231 236 $Actions .= ' <a href="?action=modules&op=uninstall&name='.$Module->Name.'">Odinstalovat</a>'; … … 234 239 if($Module->InstalledVersion != $Module->Version) $Actions .= ' <a href="?action=modules&op=upgrade&name='.$Module->Name.'">Povýšit</a>'; 235 240 } else $Actions .= ' <a href="?action=modules&op=install&name='.$Module->Name.'">Instalovat</a>'; 236 241 237 242 $Table->Table->Cells[] = array($Module->Name, 238 $Module->Creator, $Module->Version, 243 $Module->Creator, $Module->Version, 239 244 $Module->License, $YesNo[$Module->Installed], 240 245 $YesNo[$Module->Enabled], $Module->Description, 241 246 $Dependencies, $Actions); 242 247 } 243 $Output .= $Pageing->Show(); 248 $Output .= $Pageing->Show(); 244 249 $Output .= $Table->Show(); 245 $Output .= $Pageing->Show(); 250 $Output .= $Pageing->Show(); 246 251 //$Output .= '<p><a href="?A=SaveToDb">Uložit do databáze</a></p>'; 247 252 return($Output); 248 253 } 249 254 250 255 function PrepareConfig($Config) 251 256 { … … 283 288 return($Output); 284 289 } 285 290 286 291 function ConfigSave($DefaultConfig) 287 292 { … … 319 324 return($Output); 320 325 } 321 326 322 327 function CreateConfig($Config) 323 328 { 324 329 $Output = "<?php\n\n". 325 330 "\$IsDeveloper = in_array(\$_SERVER['REMOTE_ADDR'], array('127.0.0.1'));\n\n"; 326 331 327 332 foreach($this->ConfigDefinition as $Def) 328 333 { … … 353 358 if(!$this->Database->Connected()) $Output .= 'Nelze se připojit k databázi.<br>'; 354 359 else { 355 if(!$this->System->Setup->UpdateManager->IsInstalled()) 360 if(!$this->System->Setup->UpdateManager->IsInstalled()) 356 361 $Output .= 'Systém vyžaduje instalaci databáze.<br>'; 357 362 else 358 if(!$this->System->Setup->UpdateManager->IsUpToDate()) 363 if(!$this->System->Setup->UpdateManager->IsUpToDate()) 359 364 $Output .= 'Systém vyžaduje aktualizaci databáze.<br>'; 360 365 } … … 367 372 { 368 373 var $UpdateManager; 369 374 370 375 function Start() 371 376 { 372 377 global $DatabaseRevision; 373 378 374 379 $this->System->RegisterPage('', 'PageSetupRedirect'); 375 380 $this->System->RegisterPage('setup', 'PageSetup'); … … 382 387 $this->UpdateManager->Trace = $Updates->Get(); 383 388 $this->UpdateManager->InstallMethod = 'FullInstall'; 384 } 385 389 } 390 386 391 function Stop() 387 392 { … … 390 395 $this->System->UnregisterPage('setup'); 391 396 } 392 397 393 398 function CheckState() 394 399 { … … 396 401 $this->UpdateManager->IsUpToDate()); 397 402 } 398 403 399 404 function Install() 400 405 { 401 406 global $DatabaseRevision; 402 407 403 408 $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemVersion` ( 404 409 `Id` int(11) NOT NULL AUTO_INCREMENT, … … 415 420 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;"); 416 421 } 417 422 418 423 function Uninstall() 419 424 { … … 422 427 $this->Database->query('DROP TABLE `SystemVersion`'); 423 428 } 424 429 425 430 function IsInstalled() 426 431 { … … 428 433 return($DbResult->num_rows > 0); 429 434 } 430 435 431 436 function Upgrade() 432 437 {
Note:
See TracChangeset
for help on using the changeset viewer.