szurubooru/scripts/find-posts.php
Marcin Kurczewski 0ef5f1b46d Absolute paths used where necessary
- No random chdir() calls
- No more exceptions when executing scripts from dirs other than root
- find-posts.php prints absolute paths making piping more useful
2013-11-23 20:52:41 +01:00

26 lines
444 B
PHP

<?php
require_once __DIR__ . '/../src/core.php';
function usage()
{
echo 'Usage: ' . basename(__FILE__);
echo ' QUERY' . PHP_EOL;
return true;
}
array_shift($argv);
if (empty($argv))
usage() and die;
$query = array_shift($argv);
$posts = Model_Post::getEntities($query, null, null);
foreach ($posts as $post)
{
echo implode("\t",
[
$post->id,
$post->name,
Model_Post::getFullPath($post->name),
$post->mimeType,
]). PHP_EOL;
}