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