2014-05-19 19:28:02 +02:00
|
|
|
<?php
|
|
|
|
require_once __DIR__ . '/../src/core.php';
|
|
|
|
|
|
|
|
Access::disablePrivilegeChecking();
|
|
|
|
|
2014-05-20 20:38:27 +02:00
|
|
|
$options = getopt('f', ['force']);
|
|
|
|
$force = (isset($options['f']) or isset($options['force']));
|
2014-05-19 19:28:02 +02:00
|
|
|
|
2014-05-20 20:38:27 +02:00
|
|
|
$args = array_search('--', $argv);
|
|
|
|
$args = array_splice($argv, $args ? ++$args : (count($argv) - count($options)));
|
|
|
|
|
|
|
|
$query = array_shift($args);
|
2014-05-19 19:28:02 +02:00
|
|
|
$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);
|
2014-05-20 20:38:27 +02:00
|
|
|
if ($post->tryGetWorkingThumbnailPath() and $force)
|
|
|
|
unlink($post->tryGetWorkingThumbnailPath());
|
2014-05-20 19:20:07 +02:00
|
|
|
if (!$post->tryGetWorkingThumbnailPath())
|
|
|
|
$post->generateThumbnail();
|
2014-05-19 19:28:02 +02:00
|
|
|
}
|
|
|
|
|
2014-05-20 19:20:07 +02:00
|
|
|
echo 'Don\'t forget to check access rights.' . PHP_EOL;
|