Changeset 815 for trunk/includes/Update.php
- Timestamp:
- Feb 22, 2015, 11:05:49 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/Update.php
r805 r815 8 8 var $Database; 9 9 var $InstallMethod; 10 10 11 11 function __construct() 12 12 { … … 15 15 $this->VersionTable = 'DbVersion'; 16 16 } 17 17 18 18 function GetDbVersion() 19 19 { 20 20 $DbResult = $this->Database->select('DbVersion', '*', 'Id=1'); 21 $Version = $DbResult->fetch_assoc(); 21 $Version = $DbResult->fetch_assoc(); 22 22 return($Version['Revision']); 23 23 } 24 24 25 25 function IsInstalled() 26 { 26 { 27 27 $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"'); 28 28 return($DbResult->num_rows > 0); … … 33 33 return($this->Revision <= $this->GetDbVersion()); 34 34 } 35 35 36 36 function Update() 37 37 { 38 38 $DbRevision = $this->GetDbVersion(); 39 $Output = 'Počáteční revize databáze: '.$DbRevision.'<br/>'; 39 $Output = 'Počáteční revize databáze: '.$DbRevision.'<br/>'; 40 40 while($this->Revision > $DbRevision) 41 41 { 42 42 $TraceItem = $this->Trace[$DbRevision]; 43 $Output .= 'Aktualizace na verzi: '.$TraceItem['Revision'].'<br/>'; 44 $RevUpdate = $TraceItem['Function']; 43 $Output .= 'Aktualizace na verzi: '.$TraceItem['Revision'].'<br/>'; 44 $RevUpdate = $TraceItem['Function']; 45 45 $RevUpdate($this); 46 46 $DbRevision = $TraceItem['Revision']; 47 47 $this->Database->query('UPDATE `DbVersion` SET `Revision`= '.$TraceItem['Revision'].' WHERE `Id`=1'); 48 48 } 49 return($Output); 49 return($Output); 50 50 } 51 51 52 52 function Install() 53 { 54 $InstallMethod = $this->InstallMethod; 53 { 54 $InstallMethod = $this->InstallMethod; 55 55 $InstallMethod($this); 56 56 $this->Update(); 57 57 } 58 58 59 59 function Uninstall() 60 60 { 61 61 62 62 } 63 63 64 64 function Execute($Query) 65 65 {
Note:
See TracChangeset
for help on using the changeset viewer.