info command
This commit is contained in:
		
							parent
							
								
									4ade3452ee
								
							
						
					
					
						commit
						c5d8585824
					
				| @ -460,7 +460,8 @@ abstract class DataHandlerExtension extends Extension | |||||||
|     abstract protected function create_image_from_data(string $filename, array $metadata); |     abstract protected function create_image_from_data(string $filename, array $metadata); | ||||||
|     abstract protected function create_thumb(string $hash, string $type): bool; |     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 = []; |         $arr = []; | ||||||
|         foreach (getSubclassesOf("DataHandlerExtension") as $handler) { |         foreach (getSubclassesOf("DataHandlerExtension") as $handler) { | ||||||
|             $arr = array_merge($arr, $handler->SUPPORTED_EXT); |             $arr = array_merge($arr, $handler->SUPPORTED_EXT); | ||||||
|  | |||||||
| @ -341,7 +341,8 @@ function get_extension(?string $mime_type): ?string | |||||||
|     return ($ext ? $ext : null); |     return ($ext ? $ext : null); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function getSubclassesOf(string $parent) { | function getSubclassesOf(string $parent) | ||||||
|  | { | ||||||
|     $result = []; |     $result = []; | ||||||
|     foreach (get_declared_classes() as $class) { |     foreach (get_declared_classes() as $class) { | ||||||
|         $rclass = new ReflectionClass($class); |         $rclass = new ReflectionClass($class); | ||||||
|  | |||||||
| @ -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. |      * Collect the information and return it in a keyed array. | ||||||
|      */ |      */ | ||||||
|     private function get_info() |     private function get_info(): array | ||||||
|     { |     { | ||||||
|         global $config, $database; |         global $config, $database; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user