Added script for batch thumbnail generating

This commit is contained in:
Marcin Kurczewski 2014-05-19 19:28:02 +02:00
parent 9e2f37477b
commit 326e7acb4b

View file

@ -0,0 +1,20 @@
<?php
require_once __DIR__ . '/../src/core.php';
Access::disablePrivilegeChecking();
array_shift($argv);
$query = array_shift($argv);
$posts = PostSearchService::getEntities($query, null, null);
$entityCount = PostSearchService::getEntityCount($query, null, null);
$i = 0;
foreach ($posts as $post)
{
++ $i;
printf('%s (%d/%d)' . PHP_EOL, TextHelper::reprPost($post), $i, $entityCount);
if (!$post->tryGetWorkingThumbPath())
$post->generateThumb();
}
echo 'Don\'t forget to check access rights.';