forked from Cavemanon/cavepaintings
by_id_or_hash for more elegant CLI use
This commit is contained in:
@@ -61,9 +61,9 @@ class AdminPage extends Extension
|
||||
public function onCommand(CommandEvent $event)
|
||||
{
|
||||
if ($event->cmd == "help") {
|
||||
print "\tget-page [query string]\n";
|
||||
print "\tget-page <query string>\n";
|
||||
print "\t\teg 'get-page post/list'\n\n";
|
||||
print "\tregen-thumb [hash]\n";
|
||||
print "\tregen-thumb <id / hash>\n";
|
||||
print "\t\tregenerate a thumbnail\n\n";
|
||||
}
|
||||
if ($event->cmd == "get-page") {
|
||||
@@ -72,12 +72,12 @@ class AdminPage extends Extension
|
||||
$page->display();
|
||||
}
|
||||
if ($event->cmd == "regen-thumb") {
|
||||
$image = Image::by_hash($event->args[0]);
|
||||
$uid = $event->args[0];
|
||||
$image = Image::by_id_or_hash($uid);
|
||||
if ($image) {
|
||||
print("Regenerating thumb for image {$image->id} ({$image->hash})\n");
|
||||
send_event(new ThumbnailGenerationEvent($image->hash, $image->ext, true));
|
||||
} else {
|
||||
print("Can't find image with hash {$event->args[0]}\n");
|
||||
print("No post with ID '$uid'\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user