From fddc1fd453ad186fe442a0bb26686e365cc712a7 Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 30 Mar 2023 19:38:23 +0000 Subject: [PATCH] [img] allow CLI image deletion --- ext/image/main.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ext/image/main.php b/ext/image/main.php index 1520b344..3871799e 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -196,6 +196,19 @@ class ImageIO extends Extension $event->image->delete(); } + public function onCommand(CommandEvent $event) + { + if ($event->cmd == "help") { + print "\tdelete \n"; + print "\t\tdelete a specific post\n\n"; + } + if ($event->cmd == "delete") { + $post_id = (int)$event->args[0]; + $image = Image::by_id($post_id); + send_event(new ImageDeletionEvent($image)); + } + } + public function onImageReplace(ImageReplaceEvent $event) { try {