Changeset 888 for trunk/Application
- Timestamp:
- Dec 27, 2022, 7:50:23 PM (2 years ago)
- Location:
- trunk/Application
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Core.php
r884 r888 1 1 <?php 2 2 3 class Core extends Application3 class Core extends System 4 4 { 5 var $Config; 6 var $PathItems; 7 var $Menu; 8 var $DoNotShowPage; 9 var $OnPageNotFound; 10 var $Pages; 11 /* @var LocaleManager */ 12 var $LocaleManager; 13 var $Bars; 14 var $PageHeaders; 15 var $BaseURL; 5 public array $Config; 6 public array $PathItems; 7 public array $Menu; 8 public bool $DoNotShowPage; 9 public array $OnPageNotFound; 10 public LocaleManager $LocaleManager; 11 public array $Bars; 12 public array $PageHeaders; 13 public string $BaseURL; 16 14 17 15 function __construct() … … 103 101 } 104 102 105 function Run() 103 static function Cast(System $System): Core 104 { 105 if ($System instanceof Core) 106 { 107 return $System; 108 } 109 throw new Exception('Expected Core type but '.gettype($System)); 110 } 111 112 function Run(): void 106 113 { 107 114 global $ScriptStartTime, $StopAfterUpdateManager, … … 126 133 $this->Init(); 127 134 128 // Register and start existing modules 129 $this->Setup = new Setup($this); 130 $this->Setup->Start(); 131 $this->Setup->UpdateManager->VersionTable = 'DbVersion'; 132 if ($this->Setup->CheckState()) 133 { 134 $this->ModuleManager->Start(); 135 } 135 $this->StartModules(); 136 136 137 137 $this->BaseView = new BaseView($this); … … 142 142 } 143 143 144 function StartModules(): void 145 { 146 $ModuleSetup = $this->ModuleManager->LoadModule(dirname(__FILE__).'/../Packages/Common/Modules/Setup.php'); 147 ModuleSetup::Cast($ModuleSetup)->UpdateManager->VersionTable = 'DbVersion'; 148 $ModuleSetup->Install(); 149 $ModuleSetup->Start(); 150 $this->ModuleManager->LoadModules(); 151 $this->ModuleManager->LoadModule(dirname(__FILE__).'/../Packages/Common/Modules/ModuleManager.php'); 152 if (file_exists($this->ModuleManager->FileName)) $this->ModuleManager->LoadState(); 153 if (ModuleSetup::Cast($ModuleSetup)->CheckState()) 154 { 155 $this->ModuleManager->StartAll(array(ModuleCondition::Enabled)); 156 } 157 } 158 144 159 function GetMicrotime() 145 160 { … … 148 163 } 149 164 150 function Link( $Target)165 function Link(string $Target): string 151 166 { 152 167 if (substr($Target, 0, strlen($this->BaseURL)) == $this->BaseURL) … … 235 250 return $this->BaseURL.$Target; 236 251 return $this->BaseURL.'/'.$Locale.$Target; 237 }238 239 function RegisterPage($Path, $Handler)240 {241 if (is_array($Path))242 {243 $Page = &$this->Pages;244 $LastKey = array_pop($Path);245 foreach ($Path as $PathItem)246 {247 $Page = &$Page[$PathItem];248 }249 if (!is_array($Page)) $Page = array('' => $Page);250 $Page[$LastKey] = $Handler;251 } else $this->Pages[$Path] = $Handler;252 252 } 253 253 -
trunk/Application/UpdateTrace.php
r880 r888 2967 2967 } 2968 2968 2969 function UpdateTo887($Manager) 2970 { 2971 $Manager->Execute('ALTER TABLE `Referrer` CHANGE `LastIP` `LastIP` VARCHAR(46) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL;'); 2972 } 2973 2969 2974 class Updates 2970 2975 { … … 3006 3011 867 => array('Revision' => 872, 'Function' => 'UpdateTo872'), 3007 3012 872 => array('Revision' => 873, 'Function' => 'UpdateTo873'), 3013 873 => array('Revision' => 887, 'Function' => 'UpdateTo887'), 3008 3014 ); 3009 3015 } -
trunk/Application/Version.php
r884 r888 7 7 8 8 $Version = '1.0'; 9 $Revision = 88 4; // Subversion revision10 $DatabaseRevision = 8 73; // Database structure revision11 $ReleaseDate = strtotime('202 0-04-08');9 $Revision = 887; // Subversion revision 10 $DatabaseRevision = 887; // Database structure revision 11 $ReleaseDate = strtotime('2022-12-27'); -
trunk/Application/View.php
r884 r888 16 16 if ($Locale['Code'] == $this->System->LocaleManager->CurrentLocale->Texts->Code) $Selected = ' selected="selected"'; 17 17 else $Selected = ''; 18 $Remaining = $this->System->TranslateReverseURL($Remaining, $this->System->LocaleManager->LangCode);18 $Remaining = Core::Cast($this->System)->TranslateReverseURL($Remaining, $this->System->LocaleManager->LangCode); 19 19 20 $URL = $this->System->LinkLocale($Remaining, $Locale['Code']);20 $URL = Core::Cast($this->System)->LinkLocale($Remaining, $Locale['Code']); 21 21 $Output .= '<option title="" value="'.$URL.'"'.$Selected.' onchange="this.form.submit()">'.$Locale['Title'].'</option>'; 22 22 } … … 126 126 $Output .= '</td>'; 127 127 $Output .= '</tr><tr>'. 128 '<td colspan="4" class="page-bottom">'.T('Version').': '.$Version.' '.T('Revision').': '.$Revision.' ('. $this->System->HumanDate($ReleaseDate).')'.128 '<td colspan="4" class="page-bottom">'.T('Version').': '.$Version.' '.T('Revision').': '.$Revision.' ('.Core::Cast($this->System)->HumanDate($ReleaseDate).')'. 129 129 ' <a href="https://app.zdechov.net/wowpreklad/browser/trunk">'.T('Source code').'</a> '. 130 130 '<a href="https://app.zdechov.net/wowpreklad/log/trunk?verbose=on">'.T('Changelog').'</a> '.
Note:
See TracChangeset
for help on using the changeset viewer.