ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilPluginRawReader.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2020 Daniel Weise <daniel.weise@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3
4declare(strict_types=1);
5
7{
8 const BASE_PLUGIN_PATH = 'Customizing/global/plugins';
9 const SEARCH_PATTERN = 'plugin.php';
10
11 public function getPluginNames() : ?\Iterator
12 {
13 if (!@is_dir(self::BASE_PLUGIN_PATH)) {
14 throw new LogicException('Path not found: ' . self::BASE_PLUGIN_PATH);
15 }
16
17 $it = new RecursiveDirectoryIterator(self::BASE_PLUGIN_PATH);
18 foreach (new RecursiveIteratorIterator($it) as $file) {
19 $path = $file->getPathName();
20 if (is_file($path) && basename($path) === self::SEARCH_PATTERN) {
21 yield basename(dirname($path));
22 }
23 }
24 }
25
26 public function hasPlugin($name) : bool
27 {
28 $names = iterator_to_array($this->getPluginNames());
29 return in_array($name, $names);
30 }
31}
An exception for terminatinating execution or to throw for unit testing.
if($format !==null) $name
Definition: metadata.php:230