Changeset 593


Ignore:
Timestamp:
Nov 2, 2013, 11:00:41 PM (10 years ago)
Author:
chronos
Message:
  • Upraveno: Nastavení modulů je uloženo v adresáři Config, který musí povolen být pro zápis.
  • Upraveno: Instalace modulů nebude probíhat složitě z repozitáře, ale bude se udržovat jeden seznam modulů a nastavovat přímo příznak Installed.
  • Přidáno: Zprovozněno ruční ovládání instalace, odinstalace, povolení, zákázání a povýšení jednotlivých modulů.
Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/System.php

    r592 r593  
    2626    $this->Pages = array();
    2727    $this->ModuleManager = new AppModuleManager($this);
     28    $this->ModuleManager->FileName = dirname(__FILE__).'/../Config/ModulesConfig.php';
    2829    $this->Database = new Database();
    2930    $this->FormManager = new FormManager($this->Database);
  • trunk/Application/Version.php

    r592 r593  
    11<?php
    22
    3 $Revision = 592; // Subversion revision
     3$Revision = 593; // Subversion revision
    44$DatabaseRevision = 591; // SQL structure revision
    55$ReleaseTime = '2013-11-02';
  • trunk/Common/AppModule.php

    r592 r593  
    11<?php
     2
     3/* This implementation will not support installation from remote source. Just
     4 * installation of already presented modules mainly to persistence preparation.
     5 */
    26
    37class ModuleType
     
    3741  var $License;
    3842  var $Creator;
     43  var $HomePage;
    3944  var $Description;
     45  var $Running;
     46  var $Enabled;
    4047  var $Installed;
    4148  var $InstalledVersion;
    42   var $Running;
    43   var $Enabled;
    4449  /** @var ModuleType */
    4550  var $Type;
     
    4954  /** @var System */
    5055  var $System;
    51   /** @var ModularSystem */
     56  /** @var AppModuleManager */
    5257  var $Manager;
    5358  var $OnChange;
    5459 
    55   function __construct($System)
     60  function __construct(System $System)
    5661  {
    5762    $this->System = &$System;
    5863    $this->Database = &$System->Database;
    5964    $this->Installed = false;
     65    $this->Enabled = false;
     66    $this->Running = false;
    6067    $this->Dependencies = array();
    6168    $this->Type = ModuleType::Normal;
     
    7077    $this->DoInstall();
    7178        $this->Installed = true;
     79        $this->InstalledVersion = $this->Version;
    7280        $this->Manager->Modules[$this->Name] = $this;
    7381  }
     
    7886    $this->Stop();
    7987    $this->Installed = false;
    80     unset($this->Manager->Modules[$this->Name]);
    8188    $List = array();
    8289    $this->Manager->EnumSuperiorDependenciesCascade($this, $List, array(ModuleCondition::Installed));
    8390    $this->Manager->Perform($List, array(ModuleAction::Uninstall), array(ModuleCondition::Installed));
    8491    $this->DoUninstall();
     92  }
     93 
     94  function Upgrade()
     95  {
     96    if(!$this->Installed) return;
     97    $List = array();
     98    $this->Manager->EnumSuperiorDependenciesCascade($this, $List, array(ModuleCondition::Installed));
     99    $this->Manager->Perform($List, array(ModuleAction::Upgrade), array(ModuleCondition::Installed));
     100    $this->DoUpgrade();
    85101  }
    86102 
     
    161177  var $Modules;
    162178  var $System;
    163   var $Repository;
    164179  var $FileName;
    165  
    166   function __construct($System)
     180  var $OnLoadModules;
     181 
     182  function __construct(System $System)
    167183  {
    168184    $this->Modules = array();
    169185    $this->System = &$System;
    170     $this->Repository = new AppModuleRepository($System);
    171     $this->Repository->Manager = $this;
    172     $this->FileName = 'Config.php';     
     186    $this->FileName = 'Config/Modules.php';     
    173187  }
    174188 
     
    203217    {
    204218      $DepModule = $this->Modules[$Dependency];
    205        if(in_array(ModuleCondition::All, $Conditions) or
     219      if(in_array(ModuleCondition::All, $Conditions) or
    206220        ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or
    207221        (!$Module->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or
     222        ($Module->Enabled and in_array(ModuleCondition::Enabled, $Conditions)) or
     223        (!$Module->Enabled and in_array(ModuleCondition::NotEnabled, $Conditions)) or
    208224        ($Module->Installed and in_array(ModuleCondition::Installed, $Conditions)) or
    209225        (!$Module->Installed and in_array(ModuleCondition::NotInstalled, $Conditions)))
     
    224240          ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or
    225241          (!$Module->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or
     242          ($Module->Enabled and in_array(ModuleCondition::Enabled, $Conditions)) or
     243          (!$Module->Enabled and in_array(ModuleCondition::NotEnabled, $Conditions)) or
    226244          ($Module->Installed and in_array(ModuleCondition::Installed, $Conditions)) or
    227245          (!$Module->Installed and in_array(ModuleCondition::NotInstalled, $Conditions))))
     
    235253  function Start()
    236254  {
    237     $this->Repository->LoadModules();
    238     $this->Load();
     255    $this->LoadModules();
     256    if(file_exists($this->FileName)) $this->LoadState();
    239257    $this->StartEnabled();
    240258  }
     
    271289  }
    272290 
    273   function Load()
     291  function LoadState()
    274292  {
    275293    include($this->FileName);
    276     $this->Modules = array();
    277294    foreach($ConfigModules as $Mod)
    278295    {
    279       if(array_key_exists($Mod['Name'], $this->Repository->Modules))
    280       {
    281         $this->Modules[$Mod['Name']] = $this->Repository->Modules[$Mod['Name']];
     296      if(array_key_exists($Mod['Name'], $this->Modules))
     297      {
     298        $this->Modules[$Mod['Name']] = $this->Modules[$Mod['Name']];
    282299        $this->Modules[$Mod['Name']]->Enabled = $Mod['Enabled'];
    283         $this->Modules[$Mod['Name']]->Version = $Mod['Version'];
     300        $this->Modules[$Mod['Name']]->Installed = $Mod['Installed'];
     301        $this->Modules[$Mod['Name']]->InstalledVersion = $Mod['Version'];
    284302      } 
    285303    }
    286304  }
    287305 
    288   function Save()
     306  function SaveState()
    289307  {
    290308    $Data = array();
     
    292310    {
    293311      $Data[] = array('Name' => $Module->Name, 'Enabled' => $Module->Enabled,
    294         'Version' => $Module->Version);
    295     }
    296     file_put_contents($this->FileName, "<?php \n\n\$ConfigModules = ".var_export($Data).";\n");
    297   }
    298 }
    299 
    300 /* Manager available modules for installation */
    301 class AppModuleRepository
    302 {
    303   var $Modules;
    304   var $System;
    305   var $Manager;
    306   var $OnLoadModules;
    307  
    308   function __construct($System)
    309   {
    310     $this->Modules = array();
    311     $this->System = &$System;     
     312        'Version' => $Module->Version, 'Installed' => $Module->Installed);
     313    }
     314    file_put_contents($this->FileName, "<?php \n\n\$ConfigModules = ".var_export($Data, true).";\n");
    312315  }
    313316 
    314317  function RegisterModule(AppModule $Module)
    315318  {
    316     $this->Modules[$Module->Name] = &$Module; 
    317     $Module->Manager = &$this->Manager;
     319    $this->Modules[$Module->Name] = &$Module;
     320    $Module->Manager = &$this;
    318321    $Module->OnChange = &$this->OnModuleChange;
    319322  }
     
    321324  function UnregisterModule($Module)
    322325  {
    323     unset($this->Modules[array_search($Module, $this->Modules)]); 
    324   }
    325 
     326    unset($this->Modules[array_search($Module, $this->Modules)]);
     327  }
     328 
    326329  function LoadModulesFromDir($Directory)
    327330  {
     
    331334      if(is_dir($Directory.'/'.$Item) and ($Item != '.') and ($Item != '..') and ($Item != '.svn'))
    332335      {
    333           include_once($Directory.'/'.$Item.'/'.$Item.'.php');
    334           $ModuleName = 'Module'.$Item;
    335           $this->RegisterModule(new $ModuleName($this->System));
     336        include_once($Directory.'/'.$Item.'/'.$Item.'.php');
     337        $ModuleName = 'Module'.$Item;
     338        $this->RegisterModule(new $ModuleName($this->System));
    336339      }
    337340    }
     
    341344  {
    342345    if(method_exists($this->OnLoadModules[0], $this->OnLoadModules[1]))
    343                 $this->OnLoadModules();
     346      $this->OnLoadModules();
    344347    else $this->LoadModulesFromDir(dirname(__FILE__).'/../Modules');
    345348  }
  • trunk/Common/Config.php

    r592 r593  
    4747  function SaveToFile($FileName)
    4848  {
    49     file_put_contents($FileName, "<?php \n\n\$ConfigData = ".var_export($this->Data).";\n");
     49    file_put_contents($FileName, "<?php \n\n\$ConfigData = ".var_export($this->Data, true).";\n");
    5050  }
    5151 
  • trunk/Common/Global.php

    r592 r593  
    2323
    2424$UnitNames = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB');
     25$YesNo = array(false => 'Ne', true => 'Ano');
    2526 
    2627function HumanSize($Value)
  • trunk/Common/Setup/Setup.php

    r592 r593  
    2828  {
    2929    $Output = '<h3>Přihlášení k instalaci</h3>'.
    30       '<form action="" method="post">'.
     30      '<form action="?" method="post">'.
    3131      '<table>'.
    3232      '<tr><td>Systémové heslo:</td><td> <input type="password" name="SystemPassword" value=""/></td></tr>'.
     
    3939  function ControlPanel()
    4040  {
    41     $YesNo = array(false => 'Ne', true => 'Ano');
    42     $Output = '<form action="" method="post">';
     41    global $YesNo;
     42    $Output = '';
    4343 
    4444    $Output .= 'Je připojení k databázi: '.$YesNo[$this->UpdateManager->Database->Connected()].'<br/>';
     
    5353      {
    5454        if(!$this->UpdateManager->IsUpToDate())
    55           $Output .= '<input type="submit" name="update" value="Aktualizovat"/> ';
    56         $Output .= '<input type="submit" name="insert_sample_data" value="Vložit vzorová data"/> ';
    57         $Output .= '<input type="submit" name="uninstall" value="Odinstalovat"/><br/><br/>';
    58         $Output .= 'Nainstalované moduly'.$this->ShowList();
    59         $Output .= 'Dostupné moduly<br>'.$this->ShowListAvail();
    60       } else $Output .= '<input type="submit" name="install" value="Instalovat"/> ';
    61     }
    62     $Output .= '<input type="submit" name="configure" value="Nastavit"/> ';
    63     $Output .= '<input type="submit" name="logout" value="Odhlásit"/> ';
    64     $Output .= '</form>';
     55          $Output .= '<a href="?action=upgrade">Povýšit</a> ';
     56        $Output .= '<a href="?action=insert_sample_data">Vložit vzorová data</a> ';
     57        $Output .= '<a href="?action=uninstall">Odinstalovat</a> ';
     58        $Output .= '<a href="?action=modules">Správa modulů</a> ';
     59      } else $Output .= '<a href="?action=install">Instalovat</a> ';
     60    }
     61    $Output .= '<a href="?action=configure">Nastavit</a> ';
     62    $Output .= '<a href="?action=logout">Odhlásit</a> ';
     63    $Output .= '';
    6564    return($Output);
    6665  }
     
    9392        $this->UpdateManager->InstallMethod = 'FullInstall';
    9493 
    95         if(array_key_exists('logout', $_POST))
     94        if(array_key_exists('action', $_GET)) $Action = $_GET['action'];
     95          else $Action = '';
     96        if($Action == 'logout')
    9697        {
    9798          $_SESSION['SystemPassword'] = '';
     
    99100          $Output .= $this->LoginPanel();
    100101        } else
    101           if(array_key_exists('update', $_POST))
    102           {
    103             $Output .= '<h3>Aktualizace</h3>';
    104             $Output .= $this->UpdateManager->Update();
    105             $Output .= $this->ControlPanel();
    106           } else
    107             if(array_key_exists('install', $_POST))
    108             {
    109               $Output .= '<h3>Instalace</h3>';
    110               $this->UpdateManager->Install();
    111               $Output .= $this->UpdateManager->Update();
    112               $Output .= $this->ControlPanel();
    113             } else
    114               if(array_key_exists('uninstall', $_POST))
    115               {
    116                 $Output .= '<h3>Odinstalace</h3>';
    117                 $this->UpdateManager->Uninstall();
    118                 $Output .= $this->ControlPanel();
    119               } else
    120                 if(array_key_exists('insert_sample_data', $_POST))
    121                 {
    122                   $Output .= '<h3>Vložení vzorových dat</h3>';
    123                   $this->UpdateManager->InsertSampleData();
    124                   $Output .= $this->ControlPanel();
    125                 } else
    126                   if(array_key_exists('configure_save', $_POST))
    127                   {
    128                     $Output .= $this->ConfigSave($this->Config);
    129                     $Output .= $this->ControlPanel();
    130                   } else
    131                     if(array_key_exists('configure', $_POST))
    132                     {
    133                       $Output .= $this->PrepareConfig($this->Config);
    134                     } else
    135                     {
    136                       $Output .= $this->ControlPanel();
    137                     }
     102        if($Action == 'upgrade')
     103        {
     104          $Output .= '<h3>Povýšení</h3>';
     105          $Output .= $this->System->Setup->Upgrade();
     106          $Output .= $this->ControlPanel();
     107        } else
     108        if($Action == 'install')
     109        {
     110          $Output .= '<h3>Instalace</h3>';
     111          $this->System->Setup->Install();
     112          $Output .= $this->System->Setup->Upgrade();
     113          $Output .= $this->ControlPanel();
     114        } else
     115        if($Action == 'uninstall')
     116        {
     117          $Output .= '<h3>Odinstalace</h3>';
     118          $this->System->Setup->Uninstall();
     119          $Output .= $this->ControlPanel();
     120        } else
     121        if($Action == 'insert_sample_data')
     122        {
     123          $Output .= '<h3>Vložení vzorových dat</h3>';
     124          $this->System->Setup->InsertSampleData();
     125          $Output .= $this->ControlPanel();
     126        } else
     127        if($Action == 'modules')
     128        {
     129          $Output .= $this->ShowModules(); 
     130        } else
     131        if($Action == 'configure_save')
     132        {
     133           $Output .= $this->ConfigSave($this->Config);
     134           $Output .= $this->ControlPanel();
     135        } else
     136        if($Action == 'configure')
     137        {
     138          $Output .= $this->PrepareConfig($this->Config);
     139        } else
     140        {
     141          $Output .= $this->ControlPanel();
     142        }
    138143      }
    139144    } else
     
    150155  }
    151156 
     157  function ShowModules()
     158  {
     159    $Output = '';
     160    if(array_key_exists('op', $_GET)) $Operation = $_GET['op'];
     161      else $Operation = '';
     162    if($Operation == 'install')
     163    {
     164      $this->System->ModuleManager->Modules[$_GET['name']]->Install();
     165      $this->System->ModuleManager->SaveState();
     166      $Output .= 'Modul '.$_GET['name'].' instalován<br/>';
     167    } else
     168    if($Operation == 'uninstall')
     169    {
     170      $this->System->ModuleManager->Modules[$_GET['name']]->Uninstall();
     171      $this->System->ModuleManager->SaveState();
     172      $Output .= 'Modul '.$_GET['name'].' odinstalován<br/>';
     173    } else
     174    if($Operation == 'enable')
     175    {
     176      $this->System->ModuleManager->Modules[$_GET['name']]->Enable();
     177      $this->System->ModuleManager->SaveState();
     178      $Output .= 'Modul '.$_GET['name'].' povolen<br/>';
     179    } else
     180    if($Operation == 'disable')
     181    {
     182      $this->System->ModuleManager->Modules[$_GET['name']]->Disable();
     183      $this->System->ModuleManager->SaveState();
     184      $Output .= 'Modul '.$_GET['name'].' zakázán<br/>';
     185    } else
     186    if($Operation == 'upgrade')
     187    {
     188      $this->System->ModuleManager->Modules[$_GET['name']]->Upgrade();
     189      $this->System->ModuleManager->SaveState();
     190      $Output .= 'Modul '.$_GET['name'].' povýšen<br/>';
     191    }
     192    $Output .= '<h3>Správa modulů</h3>';
     193    $Output .= $this->ShowList();
     194    return($Output);
     195  }
     196 
    152197  function ShowList()
    153198  {
     199    global $YesNo;
     200   
    154201    $Output = '';
    155202    $PageList = GetPageList(count($this->System->ModuleManager->Modules));
    156  
    157     $Output .= $PageList['Output'];
    158     $Output .= '<table class="WideTable" style="font-size: small;">';
    159      
    160     $TableColumns = array(
    161         array('Name' => 'Name', 'Title' => 'Jméno'),
    162         array('Name' => 'Creator', 'Title' => 'Tvůrce'),
    163         array('Name' => 'Version', 'Title' => 'Verze'),
    164         array('Name' => 'License', 'Title' => 'Licence'),
    165         array('Name' => 'Enabled', 'Title' => 'Povoleno'),
    166         array('Name' => 'Description', 'Title' => 'Popis'),
    167         array('Name' => 'Dependencies', 'Title' => 'Závislosti'),
    168         array('Name' => '', 'Title' => 'Akce'),
    169     );
    170     $Order = GetOrderTableHeader($TableColumns, 'Name', 0);
    171     $Output .= $Order['Output'];
    172  
    173     foreach($this->System->ModuleManager->Modules as $Module)
    174     {
    175       if(($Module->Dependencies) > 0) $Dependencies = implode(',', $Module->Dependencies);
    176        else $Dependencies = '&nbsp;';
    177       if($Module->Enabled == true) $Enabled = 'Ano';
    178         else $Enabled = 'Ne';
    179       $Actions = '<a href="?A=Uninstall&amp;Name='.$Module->Name.'">Odinstalovat</a>';
    180       if($Module->Enabled == true) $Actions .= ' <a href="?A=Disable&amp;Name='.$Module->Name.'">Zakázat</a>';
    181         else $Actions .= ' <a href="?A=Enable&amp;Name='.$Module->Name.'">Povolit</a>';
    182       $Output .= '<tr><td>'.$Module->Name.'</td>'.
    183           '<td>'.$Module->Creator.'</td>'.
    184           '<td>'.$Module->Version.'</td>'.
    185           '<td>'.$Module->License.'</td>'.
    186           '<td>'.$Enabled.'</td>'.
    187           '<td>'.$Module->Description.'</td>'.
    188           '<td>'.$Dependencies.'</td>'.
    189           '<td>'.$Actions.'</td></tr>';
    190     }
    191     $Output .= '</table>';
    192     $Output .= $PageList['Output'];
    193     //$Output .= '<p><a href="?A=SaveToDb">Uložit do databáze</a></p>';
    194     return($Output);
    195   }
    196  
    197   function ShowListAvail()
    198   {
    199     $Output = '';
    200     $PageList = GetPageList(count($this->System->ModuleManager->Repository->Modules));
    201203 
    202204    $Output .= $PageList['Output'];
     
    209211        array('Name' => 'License', 'Title' => 'Licence'),
    210212        array('Name' => 'Installed', 'Title' => 'Instalováno'),
     213        array('Name' => 'Enabled', 'Title' => 'Povoleno'),
    211214        array('Name' => 'Description', 'Title' => 'Popis'),
    212215        array('Name' => 'Dependencies', 'Title' => 'Závislosti'),
     
    216219    $Output .= $Order['Output'];
    217220 
    218     foreach($this->System->ModuleManager->Repository->Modules as $Module)
     221    foreach($this->System->ModuleManager->Modules as $Module)
    219222    {
    220223      if(($Module->Dependencies) > 0) $Dependencies = implode(',', $Module->Dependencies);
    221       else $Dependencies = '&nbsp;';
    222       if($Module->Installed == true) $Installed = 'Ano';
    223       else $Installed = 'Ne';
    224       if($Module->Installed == true) $Actions = '<a href="?A=Uninstall&amp;Name='.$Module->Name.'">Odinstalovat</a>';
    225       else $Actions = '<a href="?A=Install&amp;Name='.$Module->Name.'">Instalovat</a>';
     224       else $Dependencies = '&nbsp;';
     225      $Actions = '';
     226      if($Module->Installed == true)
     227      {
     228        $Actions .= ' <a href="?action=modules&amp;op=uninstall&amp;name='.$Module->Name.'">Odinstalovat</a>';
     229        if($Module->Enabled == true) $Actions .= ' <a href="?action=modules&amp;op=disable&amp;name='.$Module->Name.'">Zakázat</a>';
     230        else $Actions .= ' <a href="?action=modules&amp;op=enable&amp;name='.$Module->Name.'">Povolit</a>';
     231        if($Module->InstalledVersion != $Module->Version) $Actions .= ' <a href="?action=modules&amp;op=upgrade&amp;name='.$Module->Name.'">Povýšit</a>';
     232      } else $Actions .= ' <a href="?action=modules&amp;op=install&amp;name='.$Module->Name.'">Instalovat</a>';
     233   
    226234      $Output .= '<tr><td>'.$Module->Name.'</td>'.
    227235          '<td>'.$Module->Creator.'</td>'.
    228236          '<td>'.$Module->Version.'</td>'.
    229237          '<td>'.$Module->License.'</td>'.
    230           '<td>'.$Installed.'</td>'.
     238          '<td>'.$YesNo[$Module->Installed].'</td>'.
     239          '<td>'.$YesNo[$Module->Enabled].'</td>'.
    231240          '<td>'.$Module->Description.'</td>'.
    232241          '<td>'.$Dependencies.'</td>'.
     
    247256      $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože soubor config.php není povolen pro zápis!';
    248257    $Output .= '<h3>Nastavení systému</h3>'.
    249         '<form action="" method="post">'.
     258        '<form action="?action=configure_save" method="post">'.
    250259        '<table>';
    251260    foreach($this->ConfigDefinition as $Def)
     
    385394      $this->UpdateManager->IsUpToDate());
    386395  }
     396 
     397  function Install()
     398  {
     399    $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemVersion` (
     400  `Id` int(11) NOT NULL AUTO_INCREMENT,
     401  `Revision` int(11) NOT NULL,
     402  PRIMARY KEY (`Id`)
     403) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     404    $this->Database->query("INSERT INTO `SystemVersion` (`Id`, `Revision`) VALUES
     405      (1, 591);");
     406  }
     407 
     408  function Uninstall()
     409  {
     410    $this->Database->query('DROP TABLE `SystemVersion`');
     411  }
     412 
     413  function IsInstalled()
     414  {
     415    $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"');
     416    return($DbResult->num_rows > 0);
     417  }
     418 
     419  function Upgrade()
     420  {
     421    $Output = $this->ModuleManager->Update();
     422    return($Output);
     423  }
    387424}
  • trunk/Modules/EmailQueue/EmailQueue.php

    r586 r593  
    3232  }
    3333
    34   function UnInstall()
     34  function DoUninstall()
    3535  {
    3636  }
  • trunk/Modules/User/User.php

    r586 r593  
    401401  function DoInstall()
    402402  {
     403    $this->Database->query("CREATE TABLE IF NOT EXISTS `User` (
     404  `Id` int(11) NOT NULL AUTO_INCREMENT,
     405  `Login` varchar(64) NOT NULL,
     406  `Name` varchar(128) NOT NULL,
     407  `Password` varchar(255) NOT NULL,
     408  `Salt` varchar(255) NOT NULL,
     409  `Email` varchar(128) NOT NULL DEFAULT '',
     410  `LastIpAddress` varchar(16) NOT NULL DEFAULT '',
     411  `LastLoginTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     412  `RegistrationTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     413  `Locked` tinyint(1) NOT NULL DEFAULT '0',
     414  `ICQ` int(11) NOT NULL DEFAULT '0',
     415  `PhoneNumber` varchar(32) NOT NULL DEFAULT '',
     416  `InitPassword` varchar(255) NOT NULL,
     417  PRIMARY KEY (`Id`),
     418  UNIQUE KEY `Name` (`Login`),
     419  UNIQUE KEY `Nick` (`Name`)
     420) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     421    $this->Database->query("CREATE TABLE IF NOT EXISTS `UserOnline` (
     422  `Id` int(11) NOT NULL AUTO_INCREMENT,
     423  `User` int(11) DEFAULT NULL COMMENT 'User.Id',
     424  `ActivityTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     425  `LoginTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     426  `SessionId` varchar(255) NOT NULL DEFAULT '',
     427  `IpAddress` varchar(16) NOT NULL DEFAULT '',
     428  `HostName` varchar(255) NOT NULL DEFAULT '',
     429  `ScriptName` varchar(255) NOT NULL,
     430  PRIMARY KEY (`Id`),
     431  KEY `User` (`User`)
     432) ENGINE=MEMORY  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
    403433  }
    404434 
    405435  function DoUninstall()
    406436  {     
     437    $this->Database->query('DROP TABLE `UserOnline`');
     438    $this->Database->query('DROP TABLE `User`');
    407439  }
    408440 
Note: See TracChangeset for help on using the changeset viewer.