Changeset 2997:8f7c065a8639 for inc/core/class.dc.modules.php
- Timestamp:
- 04/21/15 20:01:46 (10 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.modules.php
r2954 r2997 26 26 protected $errors = array(); 27 27 protected $modules_names = array(); 28 protected $all_modules = array(); 28 29 protected $disabled_mode = false; 29 30 protected $disabled_meta = array(); … … 49 50 { 50 51 $this->core =& $core; 52 } 53 54 55 public function checkDependencies() { 56 $to_disable = array(); 57 foreach ($this->all_modules as $k => &$m) { 58 if (isset($m['requires'])) { 59 foreach ($m['requires'] as &$dep) { 60 $missing = array(); 61 if (!is_array($dep)) { 62 $dep = array($dep); 63 } 64 if (!isset($this->all_modules[$dep[0]])) { 65 // module not present 66 $missing[$dep[0]] = true; 67 } elseif (count($dep)>1 && version_compare($m['version'],$dep[1],'<')) { 68 // module present, but version missing 69 $missing[$dep[0]] = $dep[1]; 70 } 71 if (count($missing)) { 72 $m['errors']=$missing; 73 $to_disable[]=$k; 74 } else { 75 $this->all_modules[$dep[0]]['disable_also'][]=$k; 76 $m['require_enable'][]=$dep[0]; 77 if (!$this->all_modules[$dep[0]]['enabled']) { 78 $to_disable[]=$k; 79 } 80 } 81 } 82 } 83 } 51 84 } 52 85 … … 100 133 $this->mroot = $full_entry; 101 134 require $full_entry.'/_define.php'; 135 $this->all_modules[$entry] =& $this->modules[$entry]; 102 136 $this->id = null; 103 137 $this->mroot = null; … … 106 140 { 107 141 if (file_exists($full_entry.'/_define.php')) { 142 $this->id = $entry; 143 $this->mroot = $full_entry; 108 144 $this->disabled_mode=true; 109 145 require $full_entry.'/_define.php'; 110 146 $this->disabled_mode=false; 111 147 $this->disabled[$entry] = $this->disabled_meta; 148 $this->all_modules[$entry] =& $this->disabled[$entry]; 149 $this->id = null; 150 $this->mroot = null; 112 151 } 113 152 } … … 116 155 $d->close(); 117 156 } 118 157 $this->checkDependencies(); 119 158 # Sort plugins 120 159 uasort($this->modules,array($this,'sortModules')); … … 190 229 'author' => $author, 191 230 'version' => $version, 231 'enabled' => false, 192 232 'root_writable' => is_writable($this->mroot) 193 233 ) … … 214 254 'standalone_config' => false, 215 255 'type' => null, 256 'enabled' => true, 216 257 'requires' => array() 217 258 ), $properties
Note: See TracChangeset
for help on using the changeset viewer.