info command

This commit is contained in:
Shish 2020-02-23 18:12:14 +00:00
parent 4ade3452ee
commit c5d8585824
4 changed files with 20 additions and 5 deletions

View file

@ -460,9 +460,10 @@ abstract class DataHandlerExtension extends Extension
abstract protected function create_image_from_data(string $filename, array $metadata);
abstract protected function create_thumb(string $hash, string $type): bool;
public static function get_all_supported_exts(): array {
public static function get_all_supported_exts(): array
{
$arr = [];
foreach(getSubclassesOf("DataHandlerExtension") as $handler) {
foreach (getSubclassesOf("DataHandlerExtension") as $handler) {
$arr = array_merge($arr, $handler->SUPPORTED_EXT);
}
return $arr;

View file

@ -137,7 +137,7 @@ class ParseLinkTemplateEvent extends Event
public function replace(string $needle, ?string $replace): void
{
if(!is_null($replace)) {
if (!is_null($replace)) {
$this->link = str_replace($needle, $replace, $this->link);
}
}

View file

@ -341,7 +341,8 @@ function get_extension(?string $mime_type): ?string
return ($ext ? $ext : null);
}
function getSubclassesOf(string $parent) {
function getSubclassesOf(string $parent)
{
$result = [];
foreach (get_declared_classes() as $class) {
$rclass = new ReflectionClass($class);

View file

@ -33,10 +33,23 @@ class ET extends Extension
}
}
public function onCommand(CommandEvent $event)
{
if ($event->cmd == "help") {
print "\tget-info\n";
print "\t\tList a bunch of info\n\n";
}
if ($event->cmd == "info") {
foreach ($this->get_info() as $k => $v) {
print("$k = $v\n");
}
}
}
/**
* Collect the information and return it in a keyed array.
*/
private function get_info()
private function get_info(): array
{
global $config, $database;