xref: /dokuwiki/lib/plugins/extension/cli.php (revision 837f79eba0191fb11ad8b9c2999c106202d00e3b)
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();
121a8d2f3cbSAndreas Gohr            if ($avail && $avail > $date) {
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) {
215a8d2f3cbSAndreas Gohr            $ext->setExtension($extname);
216a8d2f3cbSAndreas Gohr
217a8d2f3cbSAndreas Gohr            if (!$ext->getDownloadURL()) {
218a8d2f3cbSAndreas Gohr                $ok += 1;
219a8d2f3cbSAndreas Gohr                $this->error(
220a8d2f3cbSAndreas Gohr                    sprintf('Could not find download for %s', $ext->getID())
221a8d2f3cbSAndreas Gohr                );
222a8d2f3cbSAndreas Gohr                continue;
223a8d2f3cbSAndreas Gohr            }
224a8d2f3cbSAndreas Gohr
225a8d2f3cbSAndreas Gohr            try {
226a8d2f3cbSAndreas Gohr                $installed = $ext->installOrUpdate();
227*837f79ebSAndreas Gohr                foreach ($installed as $name => $info) {
228a8d2f3cbSAndreas Gohr                    $this->success(sprintf(
229a8d2f3cbSAndreas Gohr                            $this->getLang('msg_' . $info['type'] . '_' . $info['action'] . '_success'),
230a8d2f3cbSAndreas Gohr                            $info['base'])
231a8d2f3cbSAndreas Gohr                    );
232a8d2f3cbSAndreas Gohr                }
233a8d2f3cbSAndreas Gohr            } catch (Exception $e) {
234a8d2f3cbSAndreas Gohr                $this->error($e->getMessage());
235a8d2f3cbSAndreas Gohr                $ok += 1;
236a8d2f3cbSAndreas Gohr            }
237a8d2f3cbSAndreas Gohr        }
238a8d2f3cbSAndreas Gohr        return $ok;
239a8d2f3cbSAndreas Gohr    }
240a8d2f3cbSAndreas Gohr
241a8d2f3cbSAndreas Gohr    /**
242a8d2f3cbSAndreas Gohr     * Search for an extension
243a8d2f3cbSAndreas Gohr     *
244a8d2f3cbSAndreas Gohr     * @param string $query
245a8d2f3cbSAndreas Gohr     * @param bool $showdetails
246a8d2f3cbSAndreas Gohr     * @param int $max
247a8d2f3cbSAndreas Gohr     * @return int
248a8d2f3cbSAndreas Gohr     * @throws \splitbrain\phpcli\Exception
249a8d2f3cbSAndreas Gohr     */
250a8d2f3cbSAndreas Gohr    protected function cmdSearch($query, $showdetails, $max)
251a8d2f3cbSAndreas Gohr    {
252a8d2f3cbSAndreas Gohr        /** @var helper_plugin_extension_repository $repository */
253a8d2f3cbSAndreas Gohr        $repository = $this->loadHelper('extension_repository');
254a8d2f3cbSAndreas Gohr        $result = $repository->search($query);
255a8d2f3cbSAndreas Gohr        if ($max) {
256a8d2f3cbSAndreas Gohr            $result = array_slice($result, 0, $max);
257a8d2f3cbSAndreas Gohr        }
258a8d2f3cbSAndreas Gohr
259a8d2f3cbSAndreas Gohr        $this->listExtensions($result, $showdetails);
260a8d2f3cbSAndreas Gohr        return 0;
261a8d2f3cbSAndreas Gohr    }
262a8d2f3cbSAndreas Gohr
263a8d2f3cbSAndreas Gohr    /**
264a8d2f3cbSAndreas Gohr     * @param bool $showdetails
265b9daa2f5SAndreas Gohr     * @param string $filter
266a8d2f3cbSAndreas Gohr     * @return int
267a8d2f3cbSAndreas Gohr     * @throws \splitbrain\phpcli\Exception
268a8d2f3cbSAndreas Gohr     */
269b9daa2f5SAndreas Gohr    protected function cmdList($showdetails, $filter)
270a8d2f3cbSAndreas Gohr    {
271a8d2f3cbSAndreas Gohr        $list = $this->getInstalledExtensions();
272b9daa2f5SAndreas Gohr        $this->listExtensions($list, $showdetails, $filter);
273a8d2f3cbSAndreas Gohr
274a8d2f3cbSAndreas Gohr        return 0;
275a8d2f3cbSAndreas Gohr    }
276a8d2f3cbSAndreas Gohr
277a8d2f3cbSAndreas Gohr    /**
278a8d2f3cbSAndreas Gohr     * Get all installed extensions
279a8d2f3cbSAndreas Gohr     *
280a8d2f3cbSAndreas Gohr     * @return array
281a8d2f3cbSAndreas Gohr     */
282a8d2f3cbSAndreas Gohr    protected function getInstalledExtensions()
283a8d2f3cbSAndreas Gohr    {
284a8d2f3cbSAndreas Gohr        /** @var Doku_Plugin_Controller $plugin_controller */
285a8d2f3cbSAndreas Gohr        global $plugin_controller;
286a8d2f3cbSAndreas Gohr        $pluginlist = $plugin_controller->getList('', true);
287a8d2f3cbSAndreas Gohr        $tpllist = glob(DOKU_INC . 'lib/tpl/*', GLOB_ONLYDIR);
288a8d2f3cbSAndreas Gohr        $tpllist = array_map(function ($path) {
289a8d2f3cbSAndreas Gohr            return 'template:' . basename($path);
290a8d2f3cbSAndreas Gohr        }, $tpllist);
291a8d2f3cbSAndreas Gohr        $list = array_merge($pluginlist, $tpllist);
292a8d2f3cbSAndreas Gohr        sort($list);
293a8d2f3cbSAndreas Gohr        return $list;
294a8d2f3cbSAndreas Gohr    }
295a8d2f3cbSAndreas Gohr
296a8d2f3cbSAndreas Gohr    /**
297a8d2f3cbSAndreas Gohr     * List the given extensions
298a8d2f3cbSAndreas Gohr     *
299a8d2f3cbSAndreas Gohr     * @param string[] $list
300a8d2f3cbSAndreas Gohr     * @param bool $details display details
301b9daa2f5SAndreas Gohr     * @param string $filter filter for this status
302a8d2f3cbSAndreas Gohr     * @throws \splitbrain\phpcli\Exception
303a8d2f3cbSAndreas Gohr     */
304b9daa2f5SAndreas Gohr    protected function listExtensions($list, $details, $filter = '')
305a8d2f3cbSAndreas Gohr    {
306a8d2f3cbSAndreas Gohr        /** @var helper_plugin_extension_extension $ext */
307a8d2f3cbSAndreas Gohr        $ext = $this->loadHelper('extension_extension');
308a8d2f3cbSAndreas Gohr        $tr = new \splitbrain\phpcli\TableFormatter($this->colors);
309a8d2f3cbSAndreas Gohr
310a8d2f3cbSAndreas Gohr
311a8d2f3cbSAndreas Gohr        foreach ($list as $name) {
312a8d2f3cbSAndreas Gohr            $ext->setExtension($name);
313a8d2f3cbSAndreas Gohr
314a8d2f3cbSAndreas Gohr            $status = '';
315a8d2f3cbSAndreas Gohr            if ($ext->isInstalled()) {
316a8d2f3cbSAndreas Gohr                $date = $ext->getInstalledVersion();
317a8d2f3cbSAndreas Gohr                $avail = $ext->getLastUpdate();
318a8d2f3cbSAndreas Gohr                $status = 'i';
319a8d2f3cbSAndreas Gohr                if ($avail && $avail > $date) {
320e5688dc7SAndreas Gohr                    $vcolor = Colors::C_RED;
321b9daa2f5SAndreas Gohr                    $status .= 'u';
322a8d2f3cbSAndreas Gohr                } else {
323e5688dc7SAndreas Gohr                    $vcolor = Colors::C_GREEN;
324a8d2f3cbSAndreas Gohr                }
325a8d2f3cbSAndreas Gohr                if ($ext->isGitControlled()) $status = 'g';
326a8d2f3cbSAndreas Gohr                if ($ext->isBundled()) $status = 'b';
327e5688dc7SAndreas Gohr                if ($ext->isEnabled()) {
328e5688dc7SAndreas Gohr                    $ecolor = Colors::C_BROWN;
329e5688dc7SAndreas Gohr                } else {
330e5688dc7SAndreas Gohr                    $ecolor = Colors::C_DARKGRAY;
331e5688dc7SAndreas Gohr                    $status .= 'd';
332e5688dc7SAndreas Gohr                }
333a8d2f3cbSAndreas Gohr            } else {
334d915fa09SAndreas Gohr                $ecolor = null;
335a8d2f3cbSAndreas Gohr                $date = $ext->getLastUpdate();
336e5688dc7SAndreas Gohr                $vcolor = null;
337a8d2f3cbSAndreas Gohr            }
338a8d2f3cbSAndreas Gohr
339b9daa2f5SAndreas Gohr            if ($filter && strpos($status, $filter) === false) {
340b9daa2f5SAndreas Gohr                continue;
341b9daa2f5SAndreas Gohr            }
342a8d2f3cbSAndreas Gohr
343a8d2f3cbSAndreas Gohr            echo $tr->format(
344a8d2f3cbSAndreas Gohr                [20, 3, 12, '*'],
345a8d2f3cbSAndreas Gohr                [
346a8d2f3cbSAndreas Gohr                    $ext->getID(),
347a8d2f3cbSAndreas Gohr                    $status,
348a8d2f3cbSAndreas Gohr                    $date,
349a8d2f3cbSAndreas Gohr                    strip_tags(sprintf(
350a8d2f3cbSAndreas Gohr                            $this->getLang('extensionby'),
351a8d2f3cbSAndreas Gohr                            $ext->getDisplayName(),
352a8d2f3cbSAndreas Gohr                            $this->colors->wrap($ext->getAuthor(), Colors::C_PURPLE))
353a8d2f3cbSAndreas Gohr                    )
354a8d2f3cbSAndreas Gohr                ],
355a8d2f3cbSAndreas Gohr                [
356e5688dc7SAndreas Gohr                    $ecolor,
357a8d2f3cbSAndreas Gohr                    Colors::C_YELLOW,
358e5688dc7SAndreas Gohr                    $vcolor,
359a8d2f3cbSAndreas Gohr                    null,
360a8d2f3cbSAndreas Gohr                ]
361a8d2f3cbSAndreas Gohr            );
362a8d2f3cbSAndreas Gohr
363a8d2f3cbSAndreas Gohr            if (!$details) continue;
364a8d2f3cbSAndreas Gohr
365a8d2f3cbSAndreas Gohr            echo $tr->format(
366a8d2f3cbSAndreas Gohr                [5, '*'],
367a8d2f3cbSAndreas Gohr                ['', $ext->getDescription()],
368a8d2f3cbSAndreas Gohr                [null, Colors::C_CYAN]
369a8d2f3cbSAndreas Gohr            );
370a8d2f3cbSAndreas Gohr        }
371a8d2f3cbSAndreas Gohr    }
372a8d2f3cbSAndreas Gohr}
373