Changeset 897 for trunk/Modules/System/System.php
- Timestamp:
- Jan 22, 2021, 12:04:30 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/System/System.php
r896 r897 2 2 3 3 include_once(dirname(__FILE__).'/SystemModels.php'); 4 5 class PageModules extends Page6 {7 function __construct(System $System)8 {9 parent::__construct($System);10 $this->FullTitle = 'Správa modulů';11 $this->ShortTitle = 'Moduly';12 $this->ParentClass = 'PagePortal';13 }14 15 function ShowList(): string16 {17 $Output = '';18 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Module`');19 $DbRow = $DbResult->fetch_row();20 $PageList = GetPageList('Modules', $DbRow[0]);21 22 $Output .= $PageList['Output'];23 $Output .= '<table class="WideTable" style="font-size: small;">';24 25 $TableColumns = array(26 array('Name' => 'Name', 'Title' => 'Jméno'),27 array('Name' => 'Creator', 'Title' => 'Tvůrce'),28 array('Name' => 'Version', 'Title' => 'Verze'),29 array('Name' => 'License', 'Title' => 'Licence'),30 array('Name' => 'Installed', 'Title' => 'Instalováno'),31 array('Name' => 'Description', 'Title' => 'Popis'),32 array('Name' => 'Dependencies', 'Title' => 'Závislosti'),33 array('Name' => '', 'Title' => 'Akce'),34 );35 $Order = GetOrderTableHeader('Modules', $TableColumns, 'Name', 0);36 $Output .= $Order['Output'];37 $Query = 'SELECT *, (SELECT GROUP_CONCAT(`T1`.`Name` SEPARATOR ", ") FROM `ModuleLink` '.38 'LEFT JOIN `Module` AS `T1` ON `T1`.`Id` = `ModuleLink`.`LinkedModule` '.39 'WHERE `ModuleLink`.`Module` = `Module`.`Id`) AS `Dependencies` '.40 'FROM `Module` '.$Order['SQL'].$PageList['SQLLimit'];41 42 $DbResult = $this->Database->query($Query);43 while ($Module = $DbResult->fetch_assoc())44 {45 if ($Module['Dependencies'] != '') $Dependencies = $Module['Dependencies'];46 else $Dependencies = ' ';47 if ($Module['Installed'] == 1) $Installed = 'Ano';48 else $Installed = 'Ne';49 if ($Module['Installed'] == 1) $Actions = '<a href="?A=Uninstall&Id='.$Module['Id'].'">Odinstalovat</a>';50 else $Actions = '<a href="?A=Install&Id='.$Module['Id'].'">Instalovat</a>';51 $Output .= '<tr><td>'.$Module['Name'].'</td>'.52 '<td>'.$Module['Creator'].'</td>'.53 '<td>'.$Module['Version'].'</td>'.54 '<td>'.$Module['License'].'</td>'.55 '<td>'.$Installed.'</td>'.56 '<td>'.$Module['Description'].'</td>'.57 '<td>'.$Dependencies.'</td>'.58 '<td>'.$Actions.'</td></tr>';59 }60 $Output .= '</table>';61 $Output .= $PageList['Output'];62 $Output .= '<p><a href="?A=SaveToDb">Uložit do databáze</a></p>';63 return $Output;64 }65 66 function Show(): string67 {68 $Output = '';69 if (array_key_exists('A', $_GET))70 {71 if ($_GET['A'] == 'SaveToDb')72 {73 $Output .= ModuleSystem::Cast($this->System->GetModule('System'))->SaveToDatabase();74 $Output .= $this->SystemMessage('Načtení modulů', 'Seznam modulů v databázi zaktualizován');75 } else76 if ($_GET['A'] == 'Install')77 {78 $this->System->ModuleManager->LoadModules(false);79 $ModuleName = $this->System->ModuleManager->SearchModuleById($_GET['Id']);80 if ($ModuleName != '')81 {82 $this->System->ModuleManager->GetModule($ModuleName)->Install();83 } else $Output .= 'Modul id '.$_GET['Id'].' nenalezen';84 85 } else86 if ($_GET['A'] == 'Uninstall')87 {88 $ModuleName = $this->System->ModuleManager->SearchModuleById($_GET['Id']);89 if ($ModuleName != '')90 {91 $this->System->ModuleManager->GetModule($ModuleName)->UnInstall();92 } else $Output .= 'Modul id '.$_GET['Id'].' nenalezen';93 } else $Output .= 'Neplatná akce';94 }95 $Output .= $this->ShowList();96 return $Output;97 }98 }99 4 100 5 class ModuleSystem extends AppModule … … 111 16 $this->Description = 'Base system module'; 112 17 $this->Dependencies = array(); 113 $this-> SystemModule = true;18 $this->Type = ModuleType::System; 114 19 } 115 20 … … 120 25 } 121 26 122 function DoBeforeInstall(): void123 {124 $this->Manager->OnInstallModel = array($this, 'InstallModel');125 $this->Manager->OnUninstallModel = array($this, 'UninstallModel');126 }127 128 function DoAfterUninstall(): void129 {130 $this->Manager->OnInstallModel = null;131 $this->Manager->OnUninstallModel = null;132 }133 134 function DoInstall(): void135 {136 $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemVersion` (137 `Id` int(11) NOT NULL AUTO_INCREMENT,138 `Version` varchar(255) COLLATE utf8_czech_ci NOT NULL,139 `Description` datetime NOT NULL,140 PRIMARY KEY (`Id`)141 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;');142 $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModule` (143 `Id` int(11) NOT NULL AUTO_INCREMENT,144 `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,145 `Creator` varchar(255) COLLATE utf8_czech_ci NOT NULL,146 `Version` varchar(255) COLLATE utf8_czech_ci NOT NULL,147 `License` varchar(255) COLLATE utf8_czech_ci NOT NULL,148 `Installed` int(11) NOT NULL,149 `Description` text COLLATE utf8_czech_ci NOT NULL,150 PRIMARY KEY (`Id`)151 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;');152 153 $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModuleDependency` (154 `Id` int(11) NOT NULL AUTO_INCREMENT,155 `Module` int(11) NOT NULL,156 `DependencyModule` int(11) NOT NULL,157 PRIMARY KEY (`Id`),158 KEY (`Module`),159 KEY (`DependencyModule`),160 UNIQUE (`Module` , `DependencyModule`)161 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;');162 $this->Database->query('ALTER TABLE `SystemModuleDependency` ADD CONSTRAINT `SystemModuleDependency_ibfk_1` FOREIGN KEY ( `Module` ) REFERENCES `SystemModule` (`Id`)');163 $this->Database->query('ALTER TABLE `SystemModuleDependency` ADD CONSTRAINT `SystemModuleDependency_ibfk_2` FOREIGN KEY ( `DependencyModule` ) REFERENCES `SystemModule` (`Id`)');164 165 $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModel` (166 `Id` int(11) NOT NULL AUTO_INCREMENT,167 `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,168 `Module` int(11) NOT NULL,169 KEY (`Module`),170 PRIMARY KEY (`Id`)171 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;');172 $this->Database->query('ALTER TABLE `SystemModel` ADD CONSTRAINT `SystemModel_ibfk_1` FOREIGN KEY ( `Module` ) REFERENCES `SystemModule` (`Id`)');173 174 $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModelProperty` (175 `Id` int(11) NOT NULL AUTO_INCREMENT,176 `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,177 `Type` varchar(255) COLLATE utf8_czech_ci NOT NULL,178 `Model` int(11) NOT NULL,179 KEY (`Model`),180 PRIMARY KEY (`Id`)181 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;');182 $this->Database->query('ALTER TABLE `SystemModelProperty` ADD CONSTRAINT `SystemModelProperty_ibfk_1` FOREIGN KEY ( `Model` ) REFERENCES `SystemModel` (`Id`)');183 }184 185 function DoUnInstall(): void186 {187 // Delete tables with reverse order188 $this->Database->query('ALTER TABLE `SystemModelProperty` DROP FOREIGN KEY `SystemModelProperty_ibfk_1`');189 $this->Database->query('DROP TABLE IF EXISTS `SystemModelProperty`');190 $this->Database->query('ALTER TABLE `SystemModel` DROP FOREIGN KEY `SystemModel_ibfk_1`');191 $this->Database->query('DROP TABLE IF EXISTS `SystemModel`');192 $this->Database->query('ALTER TABLE `SystemModuleDependency` DROP FOREIGN KEY `SystemModuleDependency_ibfk_1`');193 $this->Database->query('ALTER TABLE `SystemModuleDependency` DROP FOREIGN KEY `SystemModuleDependency_ibfk_2`');194 $this->Database->query('DROP TABLE IF EXISTS `SystemModuleDependency`');195 $this->Database->query('DROP TABLE IF EXISTS `SystemModule`');196 $this->Database->query('DROP TABLE IF EXISTS `SystemVersion`');197 }198 199 27 function DoStart(): void 200 28 { 201 $this->Manager->OnInstallModel = array($this, 'InstallModel');202 $this->Manager->OnUninstallModel = array($this, 'UninstallModel');203 204 Core::Cast($this->System)->RegisterPage(['module'], 'PageModules');205 29 $this->System->FormManager->RegisterClass('Action', array( 206 30 'Title' => 'Akce', … … 239 63 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''), 240 64 'Items' => array('Type' => 'TActionListType', 'Caption' => 'Položky', 'Default' => ''), 241 ),242 ));243 $this->System->FormManager->RegisterClass('Module', array(244 'Title' => 'Moduly',245 'Table' => 'Module',246 'Items' => array(247 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),248 'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),249 'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),250 'Version' => array('Type' => 'String', 'Caption' => 'Verze', 'Default' => ''),251 'License' => array('Type' => 'String', 'Caption' => 'Licence', 'Default' => ''),252 'Creator' => array('Type' => 'String', 'Caption' => 'Tvůrce', 'Default' => ''),253 'HomePage' => array('Type' => 'Hyperlink', 'Caption' => 'Domovské stránky', 'Default' => ''),254 'Installed' => array('Type' => 'Boolean', 'Caption' => 'Instalováno', 'Default' => '', 'ReadOnly' => true),255 'Models' => array('Type' => 'TModelListModule', 'Caption' => 'Modely', 'Default' => ''),256 'Links' => array('Type' => 'TModuleLinkListModule', 'Caption' => 'Vazby', 'Default' => ''),257 ),258 'Actions' => array(259 array('Caption' => 'Aktualizovat z disku', 'URL' => '/module/?A=SaveToDb'),260 ),261 ));262 $this->System->FormManager->RegisterFormType('TModule', array(263 'Type' => 'Reference',264 'Table' => 'Module',265 'Id' => 'Id',266 'Name' => 'Title',267 'Filter' => '1',268 ));269 $this->System->FormManager->RegisterFormType('TModelListModule', array(270 'Type' => 'ManyToOne',271 'Table' => 'Model',272 'Id' => 'Id',273 'Ref' => 'Module',274 'Filter' => '1',275 ));276 $this->System->FormManager->RegisterClass('Model', array(277 'Title' => 'Modely',278 'Table' => 'Model',279 'Items' => array(280 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),281 'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),282 'Module' => array('Type' => 'TModule', 'Caption' => 'Module', 'Default' => ''),283 'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''),284 'DefaultSortColumn' => array('Type' => 'String', 'Caption' => 'Výchozí sloupce řazení', 'Default' => ''),285 'DefaultSortOrder' => array('Type' => 'Text', 'Caption' => 'Výchozí směr řazení', 'Default' => ''),286 'Fields' => array('Type' => 'TModelFieldListModel', 'Caption' => 'Pole', 'Default' => ''),287 ),288 ));289 $this->System->FormManager->RegisterFormType('TModel', array(290 'Type' => 'Reference',291 'Table' => 'Model',292 'Id' => 'Id',293 'Name' => 'Title',294 'Filter' => '1',295 ));296 $this->System->FormManager->RegisterFormType('TModelFieldListModel', array(297 'Type' => 'ManyToOne',298 'Table' => 'ModelField',299 'Id' => 'Id',300 'Ref' => 'Model',301 'Filter' => '1',302 ));303 $this->System->FormManager->RegisterClass('ModelField', array(304 'Title' => 'Pole modelu',305 'Table' => 'ModelField',306 'Items' => array(307 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),308 'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),309 'Model' => array('Type' => 'TModel', 'Caption' => 'Model', 'Default' => ''),310 'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''),311 'Type' => array('Type' => 'String', 'Caption' => 'Typ', 'Default' => ''),312 'DefaultValue' => array('Type' => 'String', 'Caption' => 'Výchozí hodnota', 'Default' => ''),313 'IsNull' => array('Type' => 'Boolean', 'Caption' => 'Také nulová hodnota', 'Default' => ''),314 'Suffix' => array('Type' => 'String', 'Caption' => 'Text za', 'Default' => ''),315 ),316 ));317 $this->System->FormManager->RegisterFormType('TModuleLink', array(318 'Type' => 'Reference',319 'Table' => 'ModuleLink',320 'Id' => 'Id',321 'Name' => 'Module',322 'Filter' => '1',323 ));324 $this->System->FormManager->RegisterFormType('TModuleLinkListModule', array(325 'Type' => 'ManyToOne',326 'Table' => 'ModuleLink',327 'Id' => 'Id',328 'Ref' => 'Module',329 'Filter' => '1',330 ));331 $this->System->FormManager->RegisterClass('ModuleLink', array(332 'Title' => 'Vazby modulu',333 'Table' => 'ModuleLink',334 'Items' => array(335 'Module' => array('Type' => 'TModule', 'Caption' => 'Modul', 'Default' => ''),336 'LinkedModule' => array('Type' => 'TModule', 'Caption' => 'Vázaný modul', 'Default' => ''),337 'Type' => array('Type' => 'String', 'Caption' => 'Typ vazby', 'Default' => ''),338 65 ), 339 66 )); … … 412 139 'Filter' => '1', 413 140 )); 414 $this->System->FormManager->RegisterFormType('TModule', array(415 'Type' => 'Reference',416 'Table' => 'Module',417 'Id' => 'Id',418 'Name' => 'Name',419 'Filter' => '1',420 ));421 422 //$this->Manager->OnModuleChange = array($this, 'ModuleChange');423 //$this->LoadFromDatabase();424 }425 426 function InstallModel(ModelDesc $ModelDesc)427 {428 $Query = "CREATE TABLE IF NOT EXISTS `".$ModelDesc->Name."` (\n";429 $Query .= ' `'.$ModelDesc->PrimaryKey.'` int(11) NOT NULL AUTO_INCREMENT,'."\n";430 foreach ($ModelDesc->Columns as $Column)431 {432 $Query .= " `".$Column->Name."` ";433 if ($Column->Type == ModelColumnType::Integer) $Query .= 'int(11)';434 else if ($Column->Type == ModelColumnType::String) $Query .= 'varchar(255)';435 else if ($Column->Type == ModelColumnType::Float) $Query .= 'varchar(255)';436 else if ($Column->Type == ModelColumnType::Text) $Query .= 'text';437 else if ($Column->Type == ModelColumnType::DateTime) $Query .= 'datetime';438 else if ($Column->Type == ModelColumnType::Reference) $Query .= 'int(11)';439 else if ($Column->Type == ModelColumnType::Boolean) $Query .= 'tinyint(1)';440 else if ($Column->Type == ModelColumnType::Date) $Query .= 'date';441 else if ($Column->Type == ModelColumnType::BigInt) $Query .= 'bigint(20)';442 else if ($Column->Type == ModelColumnType::Enum)443 {444 $Query .= 'enum("'.implode('", "', $Column->States).'")';445 }446 447 if ($Column->Nullable) $Query .= '';448 else $Query .= ' NOT NULL';449 450 $Query .= ' COLLATE utf8_general_ci';451 452 if ($Column->HasDefault)453 {454 if ($Column->Default == null)455 $Query .= ' DEFAULT NULL';456 else $Query .= ' DEFAULT '.$Column->GetDefault();457 }458 $Query .= ",\n";459 }460 $Query .= ' PRIMARY KEY (`'.$ModelDesc->PrimaryKey.'`)';461 foreach ($ModelDesc->Columns as $Column)462 {463 if ($Column->Type == ModelColumnType::Reference)464 $Query .= ','."\n".' KEY `'.$Column->Name.'` (`'.$Column->Name.'`)';465 else if ($Column->Unique)466 $Query .= ','."\n".' UNIQUE KEY `'.$Column->Name.'` (`'.$Column->Name.'`)';467 }468 $Query .= "\n";469 470 if ($ModelDesc->Memory) $Engine = 'MEMORY';471 else $Engine = 'InnoDB';472 $Query .= ') ENGINE='.$Engine.' DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;';473 $I = 1;474 foreach ($ModelDesc->Columns as $Column)475 {476 if ($Column->Type == ModelColumnType::Reference)477 $Query .= "ALTER TABLE `".$ModelDesc->Name."` ".478 "ADD CONSTRAINT `".$ModelDesc->Name."_ibfk_".$I."` FOREIGN KEY (`".$Column->Name."`) REFERENCES `".$Column->RefTable."` (`Id`);";479 $I++;480 }481 $this->Database->query($Query);482 }483 484 function UninstallModel(ModelDesc $ModelDesc)485 {486 $this->Database->query('DROP TABLE IF EXISTS `'.$ModelDesc->Name.'`');487 }488 489 function IsInstalled(): bool490 {491 if ($this->InstalledChecked == false)492 {493 $DbResult = $this->Database->query('SELECT table_name FROM information_schema.tables494 WHERE table_schema = "'.$this->Database->Database.'" AND table_name = "SystemVersion";');495 if ($DbResult->num_rows > 0) $this->Installed = true;496 else $this->Installed = false;497 $this->InstalledChecked = true;498 }499 return $this->Installed;500 }501 502 function ModuleChange($Module): void503 {504 //if ($this->IsInstalled())505 {506 507 if ($Module->IsInstalled()) $Installed = 1;508 else $Installed = 0;509 $this->Database->query('UPDATE `Module` SET `Installed`=1 WHERE `Name`="'.$Module->Name.'"');510 }511 }512 513 function LoadFromDatabase(): void514 {515 //DebugLog('Loading modules...');516 $this->Modules = array();517 $Query = 'SELECT `Id`, `Name`,`Installed` FROM `Module`';518 $DbResult = $this->Database->query($Query);519 while ($Module = $DbResult->fetch_array())520 {521 //echo($Module['Name'].',');522 include_once('Modules/'.$Module['Name'].'/'.$Module['Name'].'.php');523 $ModuleClassName = 'Module'.$Module['Name'];524 $NewModule = new $ModuleClassName($this->Database, $this->Manager);525 $NewModule->Id = $Module['Id'];526 $NewModule->Installed = $Module['Installed'];527 $this->Manager->RegisterModule($NewModule);528 }529 }530 531 function SaveToDatabase(): string532 {533 $Output = '';534 $Modules = array();535 $DbResult = $this->Database->query('SELECT * FROM `Module`');536 while ($DbRow = $DbResult->fetch_assoc())537 {538 $Modules[$DbRow['Name']] = $DbRow;539 if ($this->System->ModuleManager->ModulePresent($DbRow['Name']))540 $this->System->ModuleManager->GetModule($DbRow['Name'])->Id = $DbRow['Id'];541 }542 543 // Add missing544 foreach ($this->System->ModuleManager->Modules as $Module)545 {546 if (!array_key_exists($Module->Name, $Modules))547 {548 $this->Database->insert('Module', array('Name' => $Module->Name,549 'Version' => $Module->Version, 'Creator' => $Module->Creator,550 'HomePage' => $Module->HomePage, 'Title' => $Module->Title,551 'Description' => $Module->Description, 'License' => $Module->License,552 'Installed' => $Module->Installed));553 $this->System->ModuleManager->GetModule($Module->Name)->Id = $this->Database->insert_id;554 }555 else $this->Database->update('Module', 'Name = "'.$Module->Name.'"', array(556 'Version' => $Module->Version, 'Creator' => $Module->Creator,557 'HomePage' => $Module->HomePage, 'Title' => $Module->Title,558 'Description' => $Module->Description, 'License' => $Module->License,559 'Installed' => $Module->Installed));560 }561 562 // Remove exceeding563 foreach ($Modules as $Module)564 if (!$this->System->ModuleManager->ModulePresent($Module['Name']))565 {566 $Output .= 'Removing module '.$Module['Name'].' from list</br/>';567 $this->Database->query('DELETE FROM `ModuleLink` WHERE `Module` = '.$Module['Id']);568 $this->Database->query('DELETE FROM `ModuleLink` WHERE `LinkedModule` = '.$Module['Id']);569 $DbResult = $this->Database->query('SELECT Id FROM `PermissionOperation` WHERE `Module` = '.$Module['Id']);570 while ($DbRow = $DbResult->fetch_assoc())571 {572 $this->Database->query('DELETE FROM `PermissionGroupAssignment` WHERE `AssignedOperation` = '.$DbRow['Id']);573 $this->Database->query('DELETE FROM `PermissionUserAssignment` WHERE `AssignedOperation` = '.$DbRow['Id']);574 }575 $this->Database->query('DELETE FROM `PermissionOperation` WHERE `Module` = '.$Module['Id']);576 $this->Database->query('DELETE FROM `Model` WHERE `Module` = '.$Module['Id']);577 $DbResult = $this->Database->query('SELECT Id FROM `Model` WHERE `Module` = '.$Module['Id']);578 while ($DbRow = $DbResult->fetch_assoc())579 $this->Database->query('DELETE FROM `ModelField` WHERE `Model` = '.$DbRow['Id']);580 $this->Database->query('DELETE FROM `Module` WHERE `Id` = '.$Module['Id']);581 }582 583 // Reload dependencies584 $DbDependency = array();585 $DbResult = $this->Database->query('SELECT * FROM `ModuleLink`');586 while ($DbRow = $DbResult->fetch_assoc())587 $DbDependency[$DbRow['Module']][] = $DbRow['LinkedModule'];588 589 foreach ($this->System->ModuleManager->Modules as $Module)590 {591 // Add missing592 foreach ($Module->Dependencies as $Dependency)593 {594 if (!array_key_exists($Module->Id, $DbDependency) or595 !in_array($this->System->ModuleManager->GetModule($Dependency)->Id, $DbDependency[$Module->Id]))596 {597 if ($this->System->ModuleManager->ModulePresent($Dependency))598 $DependencyId = $this->System->ModuleManager->GetModule($Dependency)->Id;599 else throw new Exception('Dependent module '.$Dependency.' not found');600 $this->Database->insert('ModuleLink', array('Module' => $Module->Id,601 'LinkedModule' => $DependencyId, 'Type' => 'DependOn'));602 }603 }604 605 // Remove exceeding606 if (array_key_exists($Module->Id, $DbDependency))607 foreach ($DbDependency[$Module->Id] as $Dep)608 {609 $DepModName = $this->System->ModuleManager->SearchModuleById($Dep);610 if (!in_array($DepModName, $Module->Dependencies))611 $this->Database->query('DELETE FROM `ModuleLink` WHERE `Module` = '.612 $Module->Id.' AND LinkedModule='.$Dep);613 }614 }615 return $Output;616 141 } 617 142
Note:
See TracChangeset
for help on using the changeset viewer.