Changeset 594


Ignore:
Timestamp:
Nov 2, 2013, 11:23:19 PM (11 years ago)
Author:
chronos
Message:
  • Upraveno: Vylepšena instalace modulu User.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

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

    r593 r594  
    235235    foreach($this->Modules as $RefModule)
    236236    {
    237       $DepModule = $this->Modules[$Dependency];
    238237      if(in_array($Module->Name, $RefModule->Dependencies) and
    239238          (in_array(ModuleCondition::All, $Conditions) or
     
    273272  }
    274273 
     274  function UninstallAll()
     275  {
     276    $this->Perform($this->Modules, array(ModuleAction::Uninstall));
     277    $this->SaveState();
     278  }
     279 
    275280  function ModulePresent($Name)
    276281  {
  • trunk/Common/Page.php

    r590 r594  
    8787      $Output .= '<div id="Title">'.$Title.'</div>
    8888      <div class="Navigation"><span class="MenuItem"><strong>Navigace :: </strong> '.$Navigation.'</span><div class="MenuItem2">';
    89       if($this->System->Config['Web']['UserSupport'] == 1)
     89      if(isset($this->System->User) and ($this->System->Config['Web']['UserSupport'] == 1))
    9090      {
    91         if(isset($this->System->User) and ($this->System->User->User['Id'] == null))
     91        if($this->System->User->User['Id'] == null)
    9292          $Output .= '<a href="'.$this->System->Link('/?Action=LoginForm').'">Přihlášení</a> '.
    9393            '<a href="'.$this->System->Link('/?Action=UserRegister').'">Registrace</a>';
  • trunk/Common/Setup/Setup.php

    r593 r594  
    404404    $this->Database->query("INSERT INTO `SystemVersion` (`Id`, `Revision`) VALUES
    405405      (1, 591);");
     406    $this->Database->query("CREATE TABLE IF NOT EXISTS `Module` (
     407  `Id` int(11) NOT NULL AUTO_INCREMENT,
     408  `Name` varchar(255) NOT NULL,
     409  `Title` varchar(255) NOT NULL,
     410  PRIMARY KEY (`Id`)
     411) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
    406412  }
    407413 
    408414  function Uninstall()
    409415  {
     416    $this->System->ModuleManager->UninstallAll();
     417    $this->Database->query('DROP TABLE `Module`');
    410418    $this->Database->query('DROP TABLE `SystemVersion`');
    411419  }
     
    419427  function Upgrade()
    420428  {
    421     $Output = $this->ModuleManager->Update();
     429    $Output = $this->UpdateManager->Upgrade();
    422430    return($Output);
    423431  }
  • trunk/Common/Setup/Update.php

    r592 r594  
    3838  }
    3939 
    40   function Update()
     40  function Upgrade()
    4141  {
    4242          $DbRevision = $this->GetDbVersion();
  • trunk/Modules/User/User.php

    r593 r594  
    431431  KEY `User` (`User`)
    432432) ENGINE=MEMORY  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     433    $this->Database->query("CREATE TABLE IF NOT EXISTS `PermissionGroup` (
     434        `Id` int(11) NOT NULL AUTO_INCREMENT,
     435        `Description` varchar(255) NOT NULL DEFAULT '',
     436        PRIMARY KEY (`Id`)
     437    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     438   
     439    $this->Database->query("CREATE TABLE IF NOT EXISTS `PermissionGroupAssignment` (
     440        `Id` int(11) NOT NULL AUTO_INCREMENT,
     441        `Group` int(11) NOT NULL DEFAULT '0',
     442        `AssignedGroup` int(11) DEFAULT NULL,
     443        `AssignedOperation` int(11) DEFAULT NULL,
     444        PRIMARY KEY (`Id`),
     445        KEY `Group` (`Group`),
     446        KEY `AssignedGroup` (`AssignedGroup`),
     447        KEY `AssignedOperation` (`AssignedOperation`)
     448        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     449   
     450    $this->Database->query("CREATE TABLE IF NOT EXISTS `PermissionOperation` (
     451            `Id` int(11) NOT NULL AUTO_INCREMENT,
     452        `Module` int(11) NOT NULL,
     453            `Operation` varchar(128) NOT NULL DEFAULT '',
     454            `Item` varchar(64) NOT NULL DEFAULT '',
     455                `ItemId` int(11) NOT NULL DEFAULT '0',
     456                PRIMARY KEY (`Id`),
     457                    KEY `Module` (`Module`),
     458                    KEY `Operation` (`Operation`),
     459                    KEY `Item` (`Item`),
     460                    KEY `ItemId` (`ItemId`)
     461                    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     462   
     463    $this->Database->query("CREATE TABLE IF NOT EXISTS `PermissionUserAssignment` (
     464                    `Id` int(11) NOT NULL AUTO_INCREMENT,
     465                    `User` int(11) DEFAULT NULL,
     466                    `AssignedGroup` int(11) DEFAULT NULL,
     467                    `AssignedOperation` int(11) DEFAULT NULL,
     468                    PRIMARY KEY (`Id`),
     469                        KEY `User` (`User`),
     470                        KEY `AssignedGroup` (`AssignedGroup`),
     471                            KEY `AssignedOperation` (`AssignedOperation`)
     472                    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     473   
     474    $this->Database->query("ALTER TABLE `PermissionGroupAssignment`
     475      ADD CONSTRAINT `PermissionGroupAssignment_ibfk_1` FOREIGN KEY (`Group`) REFERENCES `PermissionGroup` (`Id`),
     476      ADD CONSTRAINT `PermissionGroupAssignment_ibfk_2` FOREIGN KEY (`AssignedGroup`) REFERENCES `PermissionGroup` (`Id`),
     477      ADD CONSTRAINT `PermissionGroupAssignment_ibfk_3` FOREIGN KEY (`AssignedOperation`) REFERENCES `PermissionOperation` (`Id`);");
     478   
     479    $this->Database->query("ALTER TABLE `PermissionOperation`
     480      ADD CONSTRAINT `PermissionOperation_ibfk_1` FOREIGN KEY (`Module`) REFERENCES `Module` (`Id`);");
     481   
     482    $this->Database->query("ALTER TABLE `PermissionUserAssignment`
     483      ADD CONSTRAINT `PermissionUserAssignment_ibfk_2` FOREIGN KEY (`AssignedGroup`) REFERENCES `PermissionGroup` (`Id`),
     484      ADD CONSTRAINT `PermissionUserAssignment_ibfk_3` FOREIGN KEY (`AssignedOperation`) REFERENCES `PermissionOperation` (`Id`),
     485      ADD CONSTRAINT `PermissionUserAssignment_ibfk_4` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);");
    433486  }
    434487 
    435488  function DoUninstall()
    436489  {     
     490    $this->Database->query('DROP TABLE `PermissionUserAssignment`');
     491    $this->Database->query('DROP TABLE `PermissionGroupAssignment`');
     492    $this->Database->query('DROP TABLE `PermissionGroup`');
     493    $this->Database->query('DROP TABLE `PermissionOperation`');
    437494    $this->Database->query('DROP TABLE `UserOnline`');
    438495    $this->Database->query('DROP TABLE `User`');
Note: See TracChangeset for help on using the changeset viewer.