add drop index argument

This commit is contained in:
ghost 2024-02-12 17:07:29 +02:00
parent 47b1cad89a
commit 6a2ebab6f5
2 changed files with 26 additions and 1 deletions

View File

@ -9,4 +9,5 @@
* `composer create-project kvazar/crawler crawler`
* `cd crawler`
* `cp example/config.json config.json`
* `crontab -e`:`* * * * * php kvazar/crawler/src/index.php`
* `crontab -e`:`* * * * * php kvazar/crawler/src/index.php`
* drop index: `php kvazar/crawler/src/index.php drop`

View File

@ -84,3 +84,27 @@ catch (Exception $exception)
)
);
}
// Init optional commands
if (isset($argv[1]))
{
switch ($argv[1])
{
// Drop index request
case 'drop':
$index->drop(
true
);
exit(
_('Index dropped!')
);
break;
}
}
// Begin crawler
// @TODO