aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins')
-rw-r--r--lib/plugins/extension/cli.php54
1 files changed, 35 insertions, 19 deletions
diff --git a/lib/plugins/extension/cli.php b/lib/plugins/extension/cli.php
index f75a0f66b..0e1bf83d5 100644
--- a/lib/plugins/extension/cli.php
+++ b/lib/plugins/extension/cli.php
@@ -42,7 +42,9 @@ class cli_plugin_extension extends DokuWiki_CLI_Plugin
// install
$options->registerCommand('install', 'Install or upgrade extensions');
- $options->registerArgument('extensions...', 'One or more extensions to install', true, 'install');
+ $options->registerArgument('extensions...',
+ 'One or more extensions to install. Either by name or download URL', true, 'install'
+ );
// uninstall
$options->registerCommand('uninstall', 'Uninstall a new extension');
@@ -212,27 +214,41 @@ class cli_plugin_extension extends DokuWiki_CLI_Plugin
$ok = 0;
foreach ($extensions as $extname) {
- $ext->setExtension($extname);
-
- if (!$ext->getDownloadURL()) {
- $ok += 1;
- $this->error(
- sprintf('Could not find download for %s', $ext->getID())
- );
- continue;
- }
+ $installed = [];
+
+ if (preg_match("/^https?:\/\//i", $extname)) {
+ try {
+ $installed = $ext->installFromURL($extname, true);
+ } catch (Exception $e) {
+ $this->error($e->getMessage());
+ $ok += 1;
+ }
+ } else {
+ $ext->setExtension($extname);
- try {
- $installed = $ext->installOrUpdate();
- foreach ($installed as $name => $info) {
- $this->success(sprintf(
- $this->getLang('msg_' . $info['type'] . '_' . $info['action'] . '_success'),
- $info['base'])
+ if (!$ext->getDownloadURL()) {
+ $ok += 1;
+ $this->error(
+ sprintf('Could not find download for %s', $ext->getID())
);
+ continue;
}
- } catch (Exception $e) {
- $this->error($e->getMessage());
- $ok += 1;
+
+ try {
+ $installed = $ext->installOrUpdate();
+ } catch (Exception $e) {
+ $this->error($e->getMessage());
+ $ok += 1;
+ }
+ }
+
+ foreach ($installed as $name => $info) {
+ $this->success(
+ sprintf(
+ $this->getLang('msg_' . $info['type'] . '_' . $info['action'] . '_success'),
+ $info['base']
+ )
+ );
}
}
return $ok;