aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/plugins/extension/GuiAdmin.php2
-rw-r--r--lib/plugins/extension/Repository.php2
-rw-r--r--lib/plugins/extension/admin.php32
-rw-r--r--lib/plugins/extension/cli.php2
4 files changed, 17 insertions, 21 deletions
diff --git a/lib/plugins/extension/GuiAdmin.php b/lib/plugins/extension/GuiAdmin.php
index 940fde589..16f6e542d 100644
--- a/lib/plugins/extension/GuiAdmin.php
+++ b/lib/plugins/extension/GuiAdmin.php
@@ -61,7 +61,7 @@ class GuiAdmin extends Gui
$html .= $this->helper->locale_xhtml('intro_plugins');
$html .= '</div>';
- $plugins = (new Local())->getTemplates();
+ $plugins = (new Local())->getPlugins();
$html .= '<div id="extension__list">';
$html .= '<form action="' . $this->tabURL('plugins') . '" method="post">';
diff --git a/lib/plugins/extension/Repository.php b/lib/plugins/extension/Repository.php
index ca1584cdc..03efcbe30 100644
--- a/lib/plugins/extension/Repository.php
+++ b/lib/plugins/extension/Repository.php
@@ -18,7 +18,9 @@ class Repository
protected $hasAccess;
/**
+ * Protected Constructor
*
+ * Use Repository::getInstance() to get an instance
*/
protected function __construct()
{
diff --git a/lib/plugins/extension/admin.php b/lib/plugins/extension/admin.php
index 4e0ab9340..a4962b6e5 100644
--- a/lib/plugins/extension/admin.php
+++ b/lib/plugins/extension/admin.php
@@ -1,9 +1,11 @@
<?php
use dokuwiki\Extension\AdminPlugin;
+use dokuwiki\plugin\extension\Exception as RepoException;
use dokuwiki\plugin\extension\Extension;
use dokuwiki\plugin\extension\Gui;
use dokuwiki\plugin\extension\Installer;
+use dokuwiki\plugin\extension\Repository;
/**
* DokuWiki Plugin extension (Admin Component)
@@ -49,18 +51,26 @@ class admin_plugin_extension extends AdminPlugin
/**
* Execute the requested action(s) and initialize the plugin repository
- *
- * @todo repo init and ssl check still missing
*/
public function handle()
{
global $INPUT;
+ // check access to the repository and SSL support
+ $repo = Repository::getInstance();
+ try {
+ $repo->checkAccess();
+ } catch (RepoException $e) {
+ msg($e->getMessage(), -1);
+ }
+
+ // Only continue if there is something to do
if (!$INPUT->post->has('fn') && !$INPUT->post->str('installurl') && !isset($_FILES['installfile'])) {
return; // nothing to do
}
if (!checkSecurityToken()) return;
+ // Run actions on the installer
$installer = new Installer($INPUT->post->bool('overwrite'));
try {
foreach ($INPUT->post->arr('fn') as $action => $extensions) {
@@ -94,6 +104,7 @@ class admin_plugin_extension extends AdminPlugin
msg(hsc($e->getMessage()), -1);
}
+ // Report results of the installer
$processed = $installer->getProcessed();
foreach ($processed as $id => $status) {
if ($status == Installer::STATUS_INSTALLED) {
@@ -108,23 +119,6 @@ class admin_plugin_extension extends AdminPlugin
}
send_redirect((new Gui())->tabURL('', [], '&', true));
- return;
-
- // FIXME old stuff below
-
- // initialize the remote repository
- /* @var helper_plugin_extension_repository $repository */
- $repository = $this->loadHelper('extension_repository');
-
- if (!$repository->hasAccess(!$INPUT->bool('purge'))) {
- $url = $this->gui->tabURL('', ['purge' => 1], '&');
- msg($this->getLang('repo_error') .
- ' [<a href="' . $url . '" rel="noreferrer">' . $this->getLang('repo_retry') . '</a>]', -1);
- }
-
- if (!in_array('ssl', stream_get_transports())) {
- msg($this->getLang('nossl'), -1);
- }
}
/**
diff --git a/lib/plugins/extension/cli.php b/lib/plugins/extension/cli.php
index 51dcfd070..bd1c57e00 100644
--- a/lib/plugins/extension/cli.php
+++ b/lib/plugins/extension/cli.php
@@ -81,7 +81,7 @@ class cli_plugin_extension extends CLIPlugin
try {
$repo->checkAccess();
} catch (ExtensionException $e) {
- $this->warning('Extension Repository API is not accessible, no remote info available!');
+ $this->warning($e->getMessage());
}
switch ($options->getCmd()) {