summaryrefslogtreecommitdiff
path: root/lib/plugins/extension/helper/extension.php
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2013-08-02 12:29:34 +0200
committerMichael Hamann <michael@content-space.de>2013-08-02 12:29:34 +0200
commit7c30f5ced5496bbc22c78497011da33d121aeb56 (patch)
tree6951f58402d304e359fce93735f622748ea77ced /lib/plugins/extension/helper/extension.php
parent9c0a72696a95f03deea27243cb67a497ed3d6993 (diff)
downloadrpg-7c30f5ced5496bbc22c78497011da33d121aeb56.tar.gz
rpg-7c30f5ced5496bbc22c78497011da33d121aeb56.tar.bz2
Extension manager: Use getInfo() when no info.txt is available
Diffstat (limited to 'lib/plugins/extension/helper/extension.php')
-rw-r--r--lib/plugins/extension/helper/extension.php52
1 files changed, 43 insertions, 9 deletions
diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php
index 05f64efeb..4243afb69 100644
--- a/lib/plugins/extension/helper/extension.php
+++ b/lib/plugins/extension/helper/extension.php
@@ -44,15 +44,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin {
$this->remoteInfo = array();
if ($this->isInstalled()) {
- if ($this->isTemplate()) {
- $infopath = $this->getInstallDir().'/template.info.txt';
- } else {
- $infopath = $this->getInstallDir().'/plugin.info.txt';
- }
- if (is_readable($infopath)) {
- $this->localInfo = confToHash($infopath);
- }
-
+ $this->readLocalData();
$this->readManagerData();
}
@@ -427,6 +419,48 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin {
}
/**
+ * Read local extension data either from info.txt or getInfo()
+ */
+ protected function readLocalData() {
+ if ($this->isTemplate()) {
+ $infopath = $this->getInstallDir().'/template.info.txt';
+ } else {
+ $infopath = $this->getInstallDir().'/plugin.info.txt';
+ }
+
+ if (is_readable($infopath)) {
+ $this->localInfo = confToHash($infopath);
+ } elseif (!$this->isTemplate() && $this->isEnabled()) {
+ global $plugin_types;
+ $path = $this->getInstallDir().'/';
+ $plugin = null;
+
+ foreach($plugin_types as $type) {
+ if(@file_exists($path.$type.'.php')) {
+ $plugin = plugin_load($type, $this->getBase());
+ if ($plugin) break;
+ }
+
+ if($dh = @opendir($path.$type.'/')) {
+ while(false !== ($cp = readdir($dh))) {
+ if($cp == '.' || $cp == '..' || strtolower(substr($cp, -4)) != '.php') continue;
+
+ $plugin = plugin_load($type, $this->getBase().'_'.substr($cp, 0, -4));
+ if ($plugin) break;
+ }
+ if ($plugin) break;
+ closedir($dh);
+ }
+ }
+
+ if ($plugin) {
+ /* @var DokuWiki_Plugin $plugin */
+ $this->localInfo = $plugin->getInfo();
+ }
+ }
+ }
+
+ /**
* Read the manager.dat file
*/
protected function readManagerData() {