Changeset 377 for trunk/Common/Module.php
- Timestamp:
- Jan 20, 2012, 3:05:24 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Module.php
r374 r377 27 27 function Install() 28 28 { 29 if($this->Installed) return; 29 30 DebugLog('Installing module '.$this->Name.'...'); 31 $this->Installed = true; 32 foreach($this->Dependencies as $Dependency) 33 $this->System->Modules[$Dependency]->Install(); 34 $this->LoadModels(); 30 35 foreach($this->Models as $ModelName) 31 36 { 32 $Model = new $ModelName($this->Database, $this->System); 33 $Model->Module = &$this; 34 $Model->Install(); 35 unset($Model); 37 $this->System->Models[$ModelName]->Install(); 36 38 } 37 39 $this->Database->query('UPDATE SystemModule SET Installed=1 WHERE Name="'.$this->Name.'"'); … … 52 54 function Init() 53 55 { 56 if($this->Initialized) return; 54 57 $this->Initialized = true; 55 58 foreach($this->Dependencies as $Dependency) 56 if(!$this->System->Modules[$Dependency]->Initialized) 57 $this->System->Modules[$Dependency]->Init(); 59 $this->System->Modules[$Dependency]->Init(); 60 } 61 62 function LoadModels() 63 { 64 foreach($this->Models as $ModelName) 65 { 66 $this->System->Models[$ModelName] = new $ModelName($this->Database, $this->System); 67 $this->System->Models[$ModelName]->Module = &$this; 68 } 58 69 } 59 70 } … … 75 86 } 76 87 77 function Init($Installed = true)88 function LoadModules($Installed = true) 78 89 { 79 90 $Query = 'SELECT `Id`, `Name` FROM `SystemModule`'; … … 88 99 $this->Modules[$Module['Name']]->Id = $Module['Id']; 89 100 } 101 } 102 103 function Init() 104 { 90 105 foreach($this->Modules as $Index => $Module) 91 106 $this->Modules[$Index]->Init(); … … 103 118 `Installed` int(11) NOT NULL, 104 119 `Description` text COLLATE utf8_czech_ci NOT NULL, 105 `Depende cies` varchar(255) COLLATE utf8_czech_ci NOT NULL,120 `Dependencies` varchar(255) COLLATE utf8_czech_ci NOT NULL, 106 121 PRIMARY KEY (`Id`) 107 122 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;'); … … 122 137 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;'); 123 138 $this->ReloadList(); 124 $this-> Init(false);139 $this->LoadModules(false); 125 140 foreach($this->Modules as $Index => $Module) 126 141 {
Note:
See TracChangeset
for help on using the changeset viewer.