Changeset 378 for trunk/Common/Module.php
- Timestamp:
- Jan 20, 2012, 3:32:02 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Module.php
r377 r378 12 12 var $Dependencies; 13 13 var $Models = array(); 14 var $SupportedModels = array(); 14 15 var $Database; 15 16 var $Installed; … … 33 34 $this->System->Modules[$Dependency]->Install(); 34 35 $this->LoadModels(); 35 foreach($this->Models as $ ModelName)36 { 37 $this-> System->Models[$ModelName]->Install();36 foreach($this->Models as $Index => $Module) 37 { 38 $this->Models[$Index]->Install(); 38 39 } 39 40 $this->Database->query('UPDATE SystemModule SET Installed=1 WHERE Name="'.$this->Name.'"'); … … 43 44 { 44 45 DebugLog('Uninstalling module '.$this->Name.'...'); 45 foreach($this->Models as $ModelName) 46 { 47 $Model = new $ModelName($this->Database, $this->System); 48 $Model->UnInstall(); 49 unset($Model); 46 foreach($this->Models as $Index => $Model) 47 { 48 $this->Models[$Index]->UnInstall(); 50 49 } 51 50 $this->Database->query('UPDATE SystemModule SET Installed=0 WHERE Name="'.$this->Name.'"'); 51 $this->Installed = false; 52 52 } 53 53 … … 62 62 function LoadModels() 63 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; 64 $this->Models = array(); 65 foreach($this->SupportedModels as $ModelName) 66 { 67 $NewModel = new $ModelName($this->Database, $this->System); 68 $NewModel->Module = &$this; 69 $this->Models[$ModelName] = $NewModel; 68 70 } 69 71 }
Note:
See TracChangeset
for help on using the changeset viewer.