Changeset 888 for trunk/Application


Ignore:
Timestamp:
Dec 27, 2022, 7:50:23 PM (17 months ago)
Author:
chronos
Message:
  • Modified: Updated Common package to latest version.
  • Modified: Fixes related to PHP 8.x.
Location:
trunk/Application
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Core.php

    r884 r888  
    11<?php
    22
    3 class Core extends Application
     3class Core extends System
    44{
    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;
    1614
    1715  function __construct()
     
    103101  }
    104102
    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
    106113  {
    107114    global $ScriptStartTime, $StopAfterUpdateManager,
     
    126133    $this->Init();
    127134
    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();
    136136
    137137    $this->BaseView = new BaseView($this);
     
    142142  }
    143143
     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
    144159  function GetMicrotime()
    145160  {
     
    148163  }
    149164
    150   function Link($Target)
     165  function Link(string $Target): string
    151166  {
    152167    if (substr($Target, 0, strlen($this->BaseURL)) == $this->BaseURL)
     
    235250      return $this->BaseURL.$Target;
    236251    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;
    252252  }
    253253
  • trunk/Application/UpdateTrace.php

    r880 r888  
    29672967}
    29682968
     2969function 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
    29692974class Updates
    29702975{
     
    30063011      867 => array('Revision' => 872, 'Function' => 'UpdateTo872'),
    30073012      872 => array('Revision' => 873, 'Function' => 'UpdateTo873'),
     3013      873 => array('Revision' => 887, 'Function' => 'UpdateTo887'),
    30083014    );
    30093015  }
  • trunk/Application/Version.php

    r884 r888  
    77
    88$Version = '1.0';
    9 $Revision = 884; // Subversion revision
    10 $DatabaseRevision = 873; // Database structure revision
    11 $ReleaseDate = strtotime('2020-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  
    1616      if ($Locale['Code'] == $this->System->LocaleManager->CurrentLocale->Texts->Code) $Selected = ' selected="selected"';
    1717        else $Selected = '';
    18       $Remaining = $this->System->TranslateReverseURL($Remaining, $this->System->LocaleManager->LangCode);
     18      $Remaining = Core::Cast($this->System)->TranslateReverseURL($Remaining, $this->System->LocaleManager->LangCode);
    1919
    20       $URL = $this->System->LinkLocale($Remaining, $Locale['Code']);
     20      $URL = Core::Cast($this->System)->LinkLocale($Remaining, $Locale['Code']);
    2121      $Output .= '<option title="" value="'.$URL.'"'.$Selected.' onchange="this.form.submit()">'.$Locale['Title'].'</option>';
    2222    }
     
    126126    $Output .= '</td>';
    127127    $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).')'.
    129129      ' &nbsp; <a href="https://app.zdechov.net/wowpreklad/browser/trunk">'.T('Source code').'</a> &nbsp; '.
    130130      '<a href="https://app.zdechov.net/wowpreklad/log/trunk?verbose=on">'.T('Changelog').'</a> &nbsp; '.
Note: See TracChangeset for help on using the changeset viewer.