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