xref: /dokuwiki/lib/plugins/extension/cli.php (revision 5aaea2b0eea4aee795b1fa2fd46d5290aa0b89cc)
1a8d2f3cbSAndreas Gohr<?php
2a8d2f3cbSAndreas Gohr
3a8d2f3cbSAndreas Gohruse splitbrain\phpcli\Colors;
4a8d2f3cbSAndreas Gohr
5a8d2f3cbSAndreas Gohr/**
6a8d2f3cbSAndreas Gohr * Class cli_plugin_extension
7a8d2f3cbSAndreas Gohr *
8a8d2f3cbSAndreas Gohr * Command Line component for the extension manager
9a8d2f3cbSAndreas Gohr *
10a8d2f3cbSAndreas Gohr * @license GPL2
11a8d2f3cbSAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org>
12a8d2f3cbSAndreas Gohr */
13a8d2f3cbSAndreas Gohrclass cli_plugin_extension extends DokuWiki_CLI_Plugin
14a8d2f3cbSAndreas Gohr{
15a8d2f3cbSAndreas Gohr    /** @inheritdoc */
16a8d2f3cbSAndreas Gohr    protected function setup(\splitbrain\phpcli\Options $options)
17a8d2f3cbSAndreas Gohr    {
18a8d2f3cbSAndreas Gohr        // general setup
19b9daa2f5SAndreas Gohr        $options->setHelp(
20b9daa2f5SAndreas Gohr            "Manage plugins and templates for this DokuWiki instance\n\n" .
21b9daa2f5SAndreas Gohr            "Status codes:\n" .
22b9daa2f5SAndreas Gohr            "   i - installed\n" .
23b9daa2f5SAndreas Gohr            "   b - bundled with DokuWiki\n" .
24b9daa2f5SAndreas Gohr            "   g - installed via git\n" .
25b9daa2f5SAndreas Gohr            "   d - disabled\n" .
26b9daa2f5SAndreas Gohr            "   u - update available\n"
27b9daa2f5SAndreas Gohr        );
28a8d2f3cbSAndreas Gohr
29a8d2f3cbSAndreas Gohr        // search
30a8d2f3cbSAndreas Gohr        $options->registerCommand('search', 'Search for an extension');
31a8d2f3cbSAndreas Gohr        $options->registerOption('max', 'Maximum number of results (default 10)', 'm', 'number', 'search');
32a8d2f3cbSAndreas Gohr        $options->registerOption('verbose', 'Show detailed extension information', 'v', false, 'search');
33a8d2f3cbSAndreas Gohr        $options->registerArgument('query', 'The keyword(s) to search for', true, 'search');
34a8d2f3cbSAndreas Gohr
35a8d2f3cbSAndreas Gohr        // list
36a8d2f3cbSAndreas Gohr        $options->registerCommand('list', 'List installed extensions');
37a8d2f3cbSAndreas Gohr        $options->registerOption('verbose', 'Show detailed extension information', 'v', false, 'list');
38b9daa2f5SAndreas Gohr        $options->registerOption('filter', 'Filter by this status', 'f', 'status', 'list');
39a8d2f3cbSAndreas Gohr
40a8d2f3cbSAndreas Gohr        // upgrade
41a8d2f3cbSAndreas Gohr        $options->registerCommand('upgrade', 'Update all installed extensions to their latest versions');
42a8d2f3cbSAndreas Gohr
43a8d2f3cbSAndreas Gohr        // install
44a8d2f3cbSAndreas Gohr        $options->registerCommand('install', 'Install or upgrade extensions');
45a8d2f3cbSAndreas Gohr        $options->registerArgument('extensions...', 'One or more extensions to install', true, 'install');
46a8d2f3cbSAndreas Gohr
47a8d2f3cbSAndreas Gohr        // uninstall
48a8d2f3cbSAndreas Gohr        $options->registerCommand('uninstall', 'Uninstall a new extension');
49a8d2f3cbSAndreas Gohr        $options->registerArgument('extensions...', 'One or more extensions to install', true, 'uninstall');
50a8d2f3cbSAndreas Gohr
51a8d2f3cbSAndreas Gohr        // enable
52a8d2f3cbSAndreas Gohr        $options->registerCommand('enable', 'Enable installed extensions');
53a8d2f3cbSAndreas Gohr        $options->registerArgument('extensions...', 'One or more extensions to enable', true, 'enable');
54a8d2f3cbSAndreas Gohr
55a8d2f3cbSAndreas Gohr        // disable
56a8d2f3cbSAndreas Gohr        $options->registerCommand('disable', 'Disable installed extensions');
57a8d2f3cbSAndreas Gohr        $options->registerArgument('extensions...', 'One or more extensions to disable', true, 'disable');
58a8d2f3cbSAndreas Gohr
59a8d2f3cbSAndreas Gohr
60a8d2f3cbSAndreas Gohr    }
61a8d2f3cbSAndreas Gohr
62a8d2f3cbSAndreas Gohr    /** @inheritdoc */
63a8d2f3cbSAndreas Gohr    protected function main(\splitbrain\phpcli\Options $options)
64a8d2f3cbSAndreas Gohr    {
65ed3520eeSAndreas Gohr        /** @var helper_plugin_extension_repository $repo */
66ed3520eeSAndreas Gohr        $repo = plugin_load('helper', 'extension_repository');
67ed3520eeSAndreas Gohr        if (!$repo->hasAccess(false)) {
68ed3520eeSAndreas Gohr            $this->warning('Extension Repository API is not accessible, no remote info available!');
69ed3520eeSAndreas Gohr        }
70ed3520eeSAndreas Gohr
71a8d2f3cbSAndreas Gohr        switch ($options->getCmd()) {
72a8d2f3cbSAndreas Gohr            case 'list':
73b9daa2f5SAndreas Gohr                $ret = $this->cmdList($options->getOpt('verbose'), $options->getOpt('filter', ''));
74a8d2f3cbSAndreas Gohr                break;
75a8d2f3cbSAndreas Gohr            case 'search':
76a8d2f3cbSAndreas Gohr                $ret = $this->cmdSearch(
77a8d2f3cbSAndreas Gohr                    implode(' ', $options->getArgs()),
78a8d2f3cbSAndreas Gohr                    $options->getOpt('verbose'),
79a8d2f3cbSAndreas Gohr                    (int)$options->getOpt('max', 10)
80a8d2f3cbSAndreas Gohr                );
81a8d2f3cbSAndreas Gohr                break;
82a8d2f3cbSAndreas Gohr            case 'install':
83a8d2f3cbSAndreas Gohr                $ret = $this->cmdInstall($options->getArgs());
84a8d2f3cbSAndreas Gohr                break;
85a8d2f3cbSAndreas Gohr            case 'uninstall':
86a8d2f3cbSAndreas Gohr                $ret = $this->cmdUnInstall($options->getArgs());
87a8d2f3cbSAndreas Gohr                break;
88a8d2f3cbSAndreas Gohr            case 'enable':
89a8d2f3cbSAndreas Gohr                $ret = $this->cmdEnable(true, $options->getArgs());
90a8d2f3cbSAndreas Gohr                break;
91a8d2f3cbSAndreas Gohr            case 'disable':
92a8d2f3cbSAndreas Gohr                $ret = $this->cmdEnable(false, $options->getArgs());
93a8d2f3cbSAndreas Gohr                break;
94a8d2f3cbSAndreas Gohr            case 'upgrade':
95a8d2f3cbSAndreas Gohr                $ret = $this->cmdUpgrade();
96a8d2f3cbSAndreas Gohr                break;
97a8d2f3cbSAndreas Gohr            default:
98a8d2f3cbSAndreas Gohr                echo $options->help();
99a8d2f3cbSAndreas Gohr                $ret = 0;
100a8d2f3cbSAndreas Gohr        }
101a8d2f3cbSAndreas Gohr
102a8d2f3cbSAndreas Gohr        exit($ret);
103a8d2f3cbSAndreas Gohr    }
104a8d2f3cbSAndreas Gohr
105a8d2f3cbSAndreas Gohr    /**
106a8d2f3cbSAndreas Gohr     * Upgrade all extensions
107a8d2f3cbSAndreas Gohr     *
108a8d2f3cbSAndreas Gohr     * @return int
109a8d2f3cbSAndreas Gohr     */
110a8d2f3cbSAndreas Gohr    protected function cmdUpgrade()
111a8d2f3cbSAndreas Gohr    {
112a8d2f3cbSAndreas Gohr        /* @var helper_plugin_extension_extension $ext */
113a8d2f3cbSAndreas Gohr        $ext = $this->loadHelper('extension_extension');
114a8d2f3cbSAndreas Gohr        $list = $this->getInstalledExtensions();
115a8d2f3cbSAndreas Gohr
116a8d2f3cbSAndreas Gohr        $ok = 0;
117a8d2f3cbSAndreas Gohr        foreach ($list as $extname) {
118a8d2f3cbSAndreas Gohr            $ext->setExtension($extname);
119a8d2f3cbSAndreas Gohr            $date = $ext->getInstalledVersion();
120a8d2f3cbSAndreas Gohr            $avail = $ext->getLastUpdate();
121be15e516SAndreas Gohr            if ($avail && $avail > $date && !$ext->isBundled()) {
122a8d2f3cbSAndreas Gohr                $ok += $this->cmdInstall([$extname]);
123a8d2f3cbSAndreas Gohr            }
124a8d2f3cbSAndreas Gohr        }
125a8d2f3cbSAndreas Gohr
126a8d2f3cbSAndreas Gohr        return $ok;
127a8d2f3cbSAndreas Gohr    }
128a8d2f3cbSAndreas Gohr
129a8d2f3cbSAndreas Gohr    /**
130a8d2f3cbSAndreas Gohr     * Enable or disable one or more extensions
131a8d2f3cbSAndreas Gohr     *
132a8d2f3cbSAndreas Gohr     * @param bool $set
133a8d2f3cbSAndreas Gohr     * @param string[] $extensions
134a8d2f3cbSAndreas Gohr     * @return int
135a8d2f3cbSAndreas Gohr     */
136a8d2f3cbSAndreas Gohr    protected function cmdEnable($set, $extensions)
137a8d2f3cbSAndreas Gohr    {
138a8d2f3cbSAndreas Gohr        /* @var helper_plugin_extension_extension $ext */
139a8d2f3cbSAndreas Gohr        $ext = $this->loadHelper('extension_extension');
140a8d2f3cbSAndreas Gohr
141a8d2f3cbSAndreas Gohr        $ok = 0;
142a8d2f3cbSAndreas Gohr        foreach ($extensions as $extname) {
143a8d2f3cbSAndreas Gohr            $ext->setExtension($extname);
144a8d2f3cbSAndreas Gohr            if (!$ext->isInstalled()) {
145a8d2f3cbSAndreas Gohr                $this->error(sprintf('Extension %s is not installed', $ext->getID()));
146a8d2f3cbSAndreas Gohr                $ok += 1;
147a8d2f3cbSAndreas Gohr                continue;
148a8d2f3cbSAndreas Gohr            }
149a8d2f3cbSAndreas Gohr
150a8d2f3cbSAndreas Gohr            if ($set) {
151a8d2f3cbSAndreas Gohr                $status = $ext->enable();
152a8d2f3cbSAndreas Gohr                $msg = 'msg_enabled';
153a8d2f3cbSAndreas Gohr            } else {
154a8d2f3cbSAndreas Gohr                $status = $ext->disable();
155a8d2f3cbSAndreas Gohr                $msg = 'msg_disabled';
156a8d2f3cbSAndreas Gohr            }
157a8d2f3cbSAndreas Gohr
158a8d2f3cbSAndreas Gohr            if ($status !== true) {
159a8d2f3cbSAndreas Gohr                $this->error($status);
160a8d2f3cbSAndreas Gohr                $ok += 1;
161a8d2f3cbSAndreas Gohr                continue;
162a8d2f3cbSAndreas Gohr            } else {
163a8d2f3cbSAndreas Gohr                $this->success(sprintf($this->getLang($msg), $ext->getID()));
164a8d2f3cbSAndreas Gohr            }
165a8d2f3cbSAndreas Gohr        }
166a8d2f3cbSAndreas Gohr
167a8d2f3cbSAndreas Gohr        return $ok;
168a8d2f3cbSAndreas Gohr    }
169a8d2f3cbSAndreas Gohr
170a8d2f3cbSAndreas Gohr    /**
171a8d2f3cbSAndreas Gohr     * Uninstall one or more extensions
172a8d2f3cbSAndreas Gohr     *
173a8d2f3cbSAndreas Gohr     * @param string[] $extensions
174a8d2f3cbSAndreas Gohr     * @return int
175a8d2f3cbSAndreas Gohr     */
176a8d2f3cbSAndreas Gohr    protected function cmdUnInstall($extensions)
177a8d2f3cbSAndreas Gohr    {
178a8d2f3cbSAndreas Gohr        /* @var helper_plugin_extension_extension $ext */
179a8d2f3cbSAndreas Gohr        $ext = $this->loadHelper('extension_extension');
180a8d2f3cbSAndreas Gohr
181a8d2f3cbSAndreas Gohr        $ok = 0;
182a8d2f3cbSAndreas Gohr        foreach ($extensions as $extname) {
183a8d2f3cbSAndreas Gohr            $ext->setExtension($extname);
184a8d2f3cbSAndreas Gohr            if (!$ext->isInstalled()) {
185a8d2f3cbSAndreas Gohr                $this->error(sprintf('Extension %s is not installed', $ext->getID()));
186a8d2f3cbSAndreas Gohr                $ok += 1;
187a8d2f3cbSAndreas Gohr                continue;
188a8d2f3cbSAndreas Gohr            }
189a8d2f3cbSAndreas Gohr
190a8d2f3cbSAndreas Gohr            $status = $ext->uninstall();
191a8d2f3cbSAndreas Gohr            if ($status) {
192a8d2f3cbSAndreas Gohr                $this->success(sprintf($this->getLang('msg_delete_success'), $ext->getID()));
193a8d2f3cbSAndreas Gohr            } else {
194a8d2f3cbSAndreas Gohr                $this->error(sprintf($this->getLang('msg_delete_failed'), hsc($ext->getID())));
195a8d2f3cbSAndreas Gohr                $ok = 1;
196a8d2f3cbSAndreas Gohr            }
197a8d2f3cbSAndreas Gohr        }
198a8d2f3cbSAndreas Gohr
199a8d2f3cbSAndreas Gohr        return $ok;
200a8d2f3cbSAndreas Gohr    }
201a8d2f3cbSAndreas Gohr
202a8d2f3cbSAndreas Gohr    /**
203a8d2f3cbSAndreas Gohr     * Install one or more extensions
204a8d2f3cbSAndreas Gohr     *
205a8d2f3cbSAndreas Gohr     * @param string[] $extensions
206a8d2f3cbSAndreas Gohr     * @return int
207a8d2f3cbSAndreas Gohr     */
208a8d2f3cbSAndreas Gohr    protected function cmdInstall($extensions)
209a8d2f3cbSAndreas Gohr    {
210a8d2f3cbSAndreas Gohr        /* @var helper_plugin_extension_extension $ext */
211a8d2f3cbSAndreas Gohr        $ext = $this->loadHelper('extension_extension');
212a8d2f3cbSAndreas Gohr
213a8d2f3cbSAndreas Gohr        $ok = 0;
214a8d2f3cbSAndreas Gohr        foreach ($extensions as $extname) {
215*5aaea2b0SLocness            $installed = [];
216*5aaea2b0SLocness
217cc16762dSLocness            if (preg_match("/^https?:\/\//i", $extname)) {
218cc16762dSLocness                try {
219cc16762dSLocness                    $installed = $ext->installFromURL($extname, true);
220cc16762dSLocness                } catch (Exception $e) {
221cc16762dSLocness                    $this->error($e->getMessage());
222cc16762dSLocness                    $ok += 1;
223cc16762dSLocness                }
224cc16762dSLocness            } else {
225a8d2f3cbSAndreas Gohr                $ext->setExtension($extname);
226a8d2f3cbSAndreas Gohr
227a8d2f3cbSAndreas Gohr                if (!$ext->getDownloadURL()) {
228a8d2f3cbSAndreas Gohr                    $ok += 1;
229a8d2f3cbSAndreas Gohr                    $this->error(
230a8d2f3cbSAndreas Gohr                        sprintf('Could not find download for %s', $ext->getID())
231a8d2f3cbSAndreas Gohr                    );
232a8d2f3cbSAndreas Gohr                    continue;
233a8d2f3cbSAndreas Gohr                }
234a8d2f3cbSAndreas Gohr
235a8d2f3cbSAndreas Gohr                try {
236a8d2f3cbSAndreas Gohr                    $installed = $ext->installOrUpdate();
237*5aaea2b0SLocness                } catch (Exception $e) {
238*5aaea2b0SLocness                    $this->error($e->getMessage());
239*5aaea2b0SLocness                    $ok += 1;
240*5aaea2b0SLocness                }
241*5aaea2b0SLocness            }
242*5aaea2b0SLocness
243837f79ebSAndreas Gohr            foreach ($installed as $name => $info) {
244cc16762dSLocness                $this->success(
245cc16762dSLocness                    sprintf(
246a8d2f3cbSAndreas Gohr                        $this->getLang('msg_' . $info['type'] . '_' . $info['action'] . '_success'),
247cc16762dSLocness                        $info['base']
248cc16762dSLocness                    )
249a8d2f3cbSAndreas Gohr                );
250a8d2f3cbSAndreas Gohr            }
251cc16762dSLocness        }
252a8d2f3cbSAndreas Gohr        return $ok;
253a8d2f3cbSAndreas Gohr    }
254a8d2f3cbSAndreas Gohr
255a8d2f3cbSAndreas Gohr    /**
256a8d2f3cbSAndreas Gohr     * Search for an extension
257a8d2f3cbSAndreas Gohr     *
258a8d2f3cbSAndreas Gohr     * @param string $query
259a8d2f3cbSAndreas Gohr     * @param bool $showdetails
260a8d2f3cbSAndreas Gohr     * @param int $max
261a8d2f3cbSAndreas Gohr     * @return int
262a8d2f3cbSAndreas Gohr     * @throws \splitbrain\phpcli\Exception
263a8d2f3cbSAndreas Gohr     */
264a8d2f3cbSAndreas Gohr    protected function cmdSearch($query, $showdetails, $max)
265a8d2f3cbSAndreas Gohr    {
266a8d2f3cbSAndreas Gohr        /** @var helper_plugin_extension_repository $repository */
267a8d2f3cbSAndreas Gohr        $repository = $this->loadHelper('extension_repository');
268a8d2f3cbSAndreas Gohr        $result = $repository->search($query);
269a8d2f3cbSAndreas Gohr        if ($max) {
270a8d2f3cbSAndreas Gohr            $result = array_slice($result, 0, $max);
271a8d2f3cbSAndreas Gohr        }
272a8d2f3cbSAndreas Gohr
273a8d2f3cbSAndreas Gohr        $this->listExtensions($result, $showdetails);
274a8d2f3cbSAndreas Gohr        return 0;
275a8d2f3cbSAndreas Gohr    }
276a8d2f3cbSAndreas Gohr
277a8d2f3cbSAndreas Gohr    /**
278a8d2f3cbSAndreas Gohr     * @param bool $showdetails
279b9daa2f5SAndreas Gohr     * @param string $filter
280a8d2f3cbSAndreas Gohr     * @return int
281a8d2f3cbSAndreas Gohr     * @throws \splitbrain\phpcli\Exception
282a8d2f3cbSAndreas Gohr     */
283b9daa2f5SAndreas Gohr    protected function cmdList($showdetails, $filter)
284a8d2f3cbSAndreas Gohr    {
285a8d2f3cbSAndreas Gohr        $list = $this->getInstalledExtensions();
286b9daa2f5SAndreas Gohr        $this->listExtensions($list, $showdetails, $filter);
287a8d2f3cbSAndreas Gohr
288a8d2f3cbSAndreas Gohr        return 0;
289a8d2f3cbSAndreas Gohr    }
290a8d2f3cbSAndreas Gohr
291a8d2f3cbSAndreas Gohr    /**
292a8d2f3cbSAndreas Gohr     * Get all installed extensions
293a8d2f3cbSAndreas Gohr     *
294a8d2f3cbSAndreas Gohr     * @return array
295a8d2f3cbSAndreas Gohr     */
296a8d2f3cbSAndreas Gohr    protected function getInstalledExtensions()
297a8d2f3cbSAndreas Gohr    {
298a8d2f3cbSAndreas Gohr        /** @var Doku_Plugin_Controller $plugin_controller */
299a8d2f3cbSAndreas Gohr        global $plugin_controller;
300a8d2f3cbSAndreas Gohr        $pluginlist = $plugin_controller->getList('', true);
301a8d2f3cbSAndreas Gohr        $tpllist = glob(DOKU_INC . 'lib/tpl/*', GLOB_ONLYDIR);
302a8d2f3cbSAndreas Gohr        $tpllist = array_map(function ($path) {
303a8d2f3cbSAndreas Gohr            return 'template:' . basename($path);
304a8d2f3cbSAndreas Gohr        }, $tpllist);
305a8d2f3cbSAndreas Gohr        $list = array_merge($pluginlist, $tpllist);
306a8d2f3cbSAndreas Gohr        sort($list);
307a8d2f3cbSAndreas Gohr        return $list;
308a8d2f3cbSAndreas Gohr    }
309a8d2f3cbSAndreas Gohr
310a8d2f3cbSAndreas Gohr    /**
311a8d2f3cbSAndreas Gohr     * List the given extensions
312a8d2f3cbSAndreas Gohr     *
313a8d2f3cbSAndreas Gohr     * @param string[] $list
314a8d2f3cbSAndreas Gohr     * @param bool $details display details
315b9daa2f5SAndreas Gohr     * @param string $filter filter for this status
316a8d2f3cbSAndreas Gohr     * @throws \splitbrain\phpcli\Exception
317a8d2f3cbSAndreas Gohr     */
318b9daa2f5SAndreas Gohr    protected function listExtensions($list, $details, $filter = '')
319a8d2f3cbSAndreas Gohr    {
320a8d2f3cbSAndreas Gohr        /** @var helper_plugin_extension_extension $ext */
321a8d2f3cbSAndreas Gohr        $ext = $this->loadHelper('extension_extension');
322a8d2f3cbSAndreas Gohr        $tr = new \splitbrain\phpcli\TableFormatter($this->colors);
323a8d2f3cbSAndreas Gohr
324a8d2f3cbSAndreas Gohr
325a8d2f3cbSAndreas Gohr        foreach ($list as $name) {
326a8d2f3cbSAndreas Gohr            $ext->setExtension($name);
327a8d2f3cbSAndreas Gohr
328a8d2f3cbSAndreas Gohr            $status = '';
329a8d2f3cbSAndreas Gohr            if ($ext->isInstalled()) {
330a8d2f3cbSAndreas Gohr                $date = $ext->getInstalledVersion();
331a8d2f3cbSAndreas Gohr                $avail = $ext->getLastUpdate();
332a8d2f3cbSAndreas Gohr                $status = 'i';
333a8d2f3cbSAndreas Gohr                if ($avail && $avail > $date) {
334e5688dc7SAndreas Gohr                    $vcolor = Colors::C_RED;
335b9daa2f5SAndreas Gohr                    $status .= 'u';
336a8d2f3cbSAndreas Gohr                } else {
337e5688dc7SAndreas Gohr                    $vcolor = Colors::C_GREEN;
338a8d2f3cbSAndreas Gohr                }
339a8d2f3cbSAndreas Gohr                if ($ext->isGitControlled()) $status = 'g';
340a8d2f3cbSAndreas Gohr                if ($ext->isBundled()) $status = 'b';
341e5688dc7SAndreas Gohr                if ($ext->isEnabled()) {
342e5688dc7SAndreas Gohr                    $ecolor = Colors::C_BROWN;
343e5688dc7SAndreas Gohr                } else {
344e5688dc7SAndreas Gohr                    $ecolor = Colors::C_DARKGRAY;
345e5688dc7SAndreas Gohr                    $status .= 'd';
346e5688dc7SAndreas Gohr                }
347a8d2f3cbSAndreas Gohr            } else {
348d915fa09SAndreas Gohr                $ecolor = null;
349a8d2f3cbSAndreas Gohr                $date = $ext->getLastUpdate();
350e5688dc7SAndreas Gohr                $vcolor = null;
351a8d2f3cbSAndreas Gohr            }
352a8d2f3cbSAndreas Gohr
353b9daa2f5SAndreas Gohr            if ($filter && strpos($status, $filter) === false) {
354b9daa2f5SAndreas Gohr                continue;
355b9daa2f5SAndreas Gohr            }
356a8d2f3cbSAndreas Gohr
357a8d2f3cbSAndreas Gohr            echo $tr->format(
358a8d2f3cbSAndreas Gohr                [20, 3, 12, '*'],
359a8d2f3cbSAndreas Gohr                [
360a8d2f3cbSAndreas Gohr                    $ext->getID(),
361a8d2f3cbSAndreas Gohr                    $status,
362a8d2f3cbSAndreas Gohr                    $date,
363a8d2f3cbSAndreas Gohr                    strip_tags(sprintf(
364a8d2f3cbSAndreas Gohr                            $this->getLang('extensionby'),
365a8d2f3cbSAndreas Gohr                            $ext->getDisplayName(),
366a8d2f3cbSAndreas Gohr                            $this->colors->wrap($ext->getAuthor(), Colors::C_PURPLE))
367a8d2f3cbSAndreas Gohr                    )
368a8d2f3cbSAndreas Gohr                ],
369a8d2f3cbSAndreas Gohr                [
370e5688dc7SAndreas Gohr                    $ecolor,
371a8d2f3cbSAndreas Gohr                    Colors::C_YELLOW,
372e5688dc7SAndreas Gohr                    $vcolor,
373a8d2f3cbSAndreas Gohr                    null,
374a8d2f3cbSAndreas Gohr                ]
375a8d2f3cbSAndreas Gohr            );
376a8d2f3cbSAndreas Gohr
377a8d2f3cbSAndreas Gohr            if (!$details) continue;
378a8d2f3cbSAndreas Gohr
379a8d2f3cbSAndreas Gohr            echo $tr->format(
380a8d2f3cbSAndreas Gohr                [5, '*'],
381a8d2f3cbSAndreas Gohr                ['', $ext->getDescription()],
382a8d2f3cbSAndreas Gohr                [null, Colors::C_CYAN]
383a8d2f3cbSAndreas Gohr            );
384a8d2f3cbSAndreas Gohr        }
385a8d2f3cbSAndreas Gohr    }
386a8d2f3cbSAndreas Gohr}
387