Ignore:
Timestamp:
Dec 6, 2021, 11:33:48 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
  • Added: Explicit types for better type checking.
  • Fixed: Support for php 8.0.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Update.php

    r92 r95  
    33class UpdateManager
    44{
    5   var $Revision;
    6   var $Trace;
    7   var $VersionTable;
    8   /* @var Database */
    9   var $Database;
    10   var $InstallMethod;
     5  public int $Revision;
     6  public array $Trace;
     7  public string $VersionTable;
     8  public Database $Database;
     9  public string $InstallMethod;
    1110
    1211  function __construct()
     
    1918  }
    2019
    21   function GetDbVersion()
     20  function GetDbVersion(): ?int
    2221  {
    2322    $DbResult = $this->Database->select($this->VersionTable, '*', 'Id=1');
     
    2625  }
    2726
    28   function IsInstalled()
     27  function IsInstalled(): bool
    2928  {
    3029    $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"');
     
    3231  }
    3332
    34   function IsUpToDate()
     33  function IsUpToDate(): bool
    3534  {
    3635    return $this->Revision <= $this->GetDbVersion();
    3736  }
    3837
    39   function Upgrade()
     38  function Upgrade(): string
    4039  {
    4140    $DbRevision = $this->GetDbVersion();
     
    5958  }
    6059
    61   function Install()
     60  function Install(): void
    6261  {
    6362    $InstallMethod = $this->InstallMethod;
    6463    $InstallMethod($this);
    65     $this->Update();
    6664  }
    6765
    68   function Uninstall()
     66  function Uninstall(): void
    6967  {
    70 
    7168  }
    7269
    73   function InsertSampleData()
     70  function InsertSampleData(): void
    7471  {
    7572    $InstallMethod = $this->InsertSampleDataMethod;
     
    7774  }
    7875
    79   function Execute($Query)
     76  function Execute(string $Query): DatabaseResult
    8077  {
    8178    echo($Query.';<br/>');
Note: See TracChangeset for help on using the changeset viewer.