From 59ac7beaa56f2b43310b88bceca6c68a685f19e6 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sat, 8 Mar 2014 11:27:28 +0100 Subject: Extension manager: Fix cache extension to be .repo The dot was missing i.e. the cache files had no real extension at all. --- lib/plugins/extension/helper/repository.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/plugins/extension/helper') diff --git a/lib/plugins/extension/helper/repository.php b/lib/plugins/extension/helper/repository.php index 1f603a866..6ffe89eb7 100644 --- a/lib/plugins/extension/helper/repository.php +++ b/lib/plugins/extension/helper/repository.php @@ -31,7 +31,7 @@ class helper_plugin_extension_repository extends DokuWiki_Plugin { $request_data = array('fmt' => 'php'); $request_needed = false; foreach ($list as $name) { - $cache = new cache('##extension_manager##'.$name, 'repo'); + $cache = new cache('##extension_manager##'.$name, '.repo'); $result = null; if (!isset($this->loaded_extensions[$name]) && $this->hasAccess() && !$cache->useCache(array('age' => 3600 * 24))) { $this->loaded_extensions[$name] = true; @@ -46,7 +46,7 @@ class helper_plugin_extension_repository extends DokuWiki_Plugin { if ($data !== false) { $extensions = unserialize($data); foreach ($extensions as $extension) { - $cache = new cache('##extension_manager##'.$extension['plugin'], 'repo'); + $cache = new cache('##extension_manager##'.$extension['plugin'], '.repo'); $cache->storeCache(serialize($extension)); } } else { @@ -63,7 +63,7 @@ class helper_plugin_extension_repository extends DokuWiki_Plugin { */ public function hasAccess() { if ($this->has_access === null) { - $cache = new cache('##extension_manager###hasAccess', 'repo'); + $cache = new cache('##extension_manager###hasAccess', '.repo'); $result = null; if (!$cache->useCache(array('age' => 3600 * 24, 'purge'=>1))) { $httpclient = new DokuHTTPClient(); @@ -90,7 +90,7 @@ class helper_plugin_extension_repository extends DokuWiki_Plugin { * @return array The data or null if nothing was found (possibly no repository access) */ public function getData($name) { - $cache = new cache('##extension_manager##'.$name, 'repo'); + $cache = new cache('##extension_manager##'.$name, '.repo'); $result = null; if (!isset($this->loaded_extensions[$name]) && $this->hasAccess() && !$cache->useCache(array('age' => 3600 * 24))) { $this->loaded_extensions[$name] = true; @@ -130,7 +130,7 @@ class helper_plugin_extension_repository extends DokuWiki_Plugin { // store cache info for each extension foreach($result as $ext){ $name = $ext['plugin']; - $cache = new cache('##extension_manager##'.$name, 'repo'); + $cache = new cache('##extension_manager##'.$name, '.repo'); $cache->storeCache(serialize($ext)); $ids[] = $name; } -- cgit v1.2.3 From 0b1e74a3a483dfda1906c0f636b27e4a15bd7a0f Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 8 Mar 2014 19:14:16 +0100 Subject: avoid HTTP image screenshot urls. closes #595 --- lib/plugins/extension/helper/list.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/plugins/extension/helper') diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php index 01a5c516a..47edca8c1 100644 --- a/lib/plugins/extension/helper/list.php +++ b/lib/plugins/extension/helper/list.php @@ -188,10 +188,17 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @return string The HTML code */ function make_screenshot(helper_plugin_extension_extension $extension) { - if($extension->getScreenshotURL()) { + $screen = $extension->getScreenshotURL(); + $thumb = $extension->getThumbnailURL(); + + if($screen) { + // use protocol independent URLs for images coming from us #595 + $screen = str_replace('http://www.dokuwiki.org', '//www.dokuwiki.org', $screen); + $thumb = str_replace('http://www.dokuwiki.org', '//www.dokuwiki.org', $thumb); + $title = sprintf($this->getLang('screenshot'), hsc($extension->getDisplayName())); - $img = ''. - ''.$title.''. + $img = ''. + ''.$title.''. ''; } elseif($extension->isTemplate()) { $img = ''; -- cgit v1.2.3 From 811653d71565cce94ca1b27f4cdebc60769e2d11 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 10 May 2014 15:18:20 +0200 Subject: fix icon for plugins following templates in extension manager --- lib/plugins/extension/helper/extension.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/plugins/extension/helper') diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index 7958cd2da..43e4452c0 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -57,6 +57,8 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { if(substr($id, 0 , 9) == 'template:'){ $this->base = substr($id, 9); $this->is_template = true; + } else { + $this->is_template = false; } $this->localInfo = array(); -- cgit v1.2.3 From c0d17c851c1bf4371e550a105c91a17644de6b29 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 13 May 2014 18:39:04 +0200 Subject: removed another case of superflous multiple cache invalidation --- lib/plugins/extension/helper/extension.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/plugins/extension/helper') diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index 43e4452c0..a4736a850 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -597,11 +597,8 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { $path = $this->download($url); $installed = $this->installArchive($path, true); - // purge caches - foreach($installed as $ext => $info){ - $this->setExtension($ext); - $this->purgeCache(); - } + // purge cache + $this->purgeCache(); }catch (Exception $e){ throw $e; } -- cgit v1.2.3 From 59d6be95449db272ee0a6b6d437f535246f795c9 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 13 May 2014 19:42:05 +0200 Subject: update manager.dat correctly on install. closes #704 --- lib/plugins/extension/helper/extension.php | 39 ++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'lib/plugins/extension/helper') diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index a4736a850..2aca0e218 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -292,7 +292,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { */ public function getUpdateDate() { if (!empty($this->managerData['updated'])) return $this->managerData['updated']; - return false; + return $this->getInstallDate(); } /** @@ -577,6 +577,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { try { $installed = $this->installArchive("$tmp/upload.archive", true, $basename); + $this->updateManagerData('', $installed); // purge cache $this->purgeCache(); }catch (Exception $e){ @@ -596,6 +597,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { try { $path = $this->download($url); $installed = $this->installArchive($path, true); + $this->updateManagerData($url, $installed); // purge cache $this->purgeCache(); @@ -612,8 +614,10 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { * @return array The list of installed extensions */ public function installOrUpdate() { - $path = $this->download($this->getDownloadURL()); + $url = $this->getDownloadURL(); + $path = $this->download($url); $installed = $this->installArchive($path, $this->isInstalled(), $this->getBase()); + $this->updateManagerData($url, $installed); // refresh extension information if (!isset($installed[$this->getID()])) { @@ -727,6 +731,37 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { } } + /** + * Save the given URL and current datetime in the manager.dat file of all installed extensions + * + * @param string $url Where the extension was downloaded from. (empty for manual installs via upload) + * @param array $installed Optional list of installed plugins + */ + protected function updateManagerData($url = '', $installed = null) { + $origID = $this->getID(); + + if(is_null($installed)) { + $installed = array($origID); + } + + foreach($installed as $ext => $info) { + if($this->getID() != $ext) $this->setExtension($ext); + if($url) { + $this->managerData['downloadurl'] = $url; + } elseif(isset($this->managerData['downloadurl'])) { + unset($this->managerData['downloadurl']); + } + if(isset($this->managerData['installed'])) { + $this->managerData['updated'] = date('r'); + } else { + $this->managerData['installed'] = date('r'); + } + $this->writeManagerData(); + } + + if($this->getID() != $origID) $this->setExtension($origID); + } + /** * Read the manager.dat file */ -- cgit v1.2.3 From 3e217a362fe66ee0dba6351d0c748290cdbb992e Mon Sep 17 00:00:00 2001 From: Satoshi Sahara Date: Wed, 6 Aug 2014 21:41:02 +0900 Subject: Last Update Date info of extension fix This request makes "Your last update" of the extension info shown when clicking more info triangle mark. The first installed date of the extension may not be necessary for local site admin work. --- lib/plugins/extension/helper/list.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'lib/plugins/extension/helper') diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php index 47edca8c1..9b1988d84 100644 --- a/lib/plugins/extension/helper/list.php +++ b/lib/plugins/extension/helper/list.php @@ -387,7 +387,8 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { $return .= '
'; $return .= hsc($extension->getInstalledVersion()); $return .= '
'; - } else { + } + if (!$extension->isBundled()) { $return .= '
'.$this->getLang('install_date').'
'; $return .= '
'; $return .= ($extension->getUpdateDate() ? hsc($extension->getUpdateDate()) : $this->getLang('unknown')); @@ -401,13 +402,6 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { $return .= '
'; } - if($extension->getInstallDate()) { - $return .= '
'.$this->getLang('installed').'
'; - $return .= '
'; - $return .= hsc($extension->getInstallDate()); - $return .= '
'; - } - $return .= '
'.$this->getLang('provides').'
'; $return .= '
'; $return .= ($extension->getTypes() ? hsc(implode(', ', $extension->getTypes())) : $default); -- cgit v1.2.3