Browse Source

add drop index argument

main
ghost 10 months ago
parent
commit
6a2ebab6f5
  1. 3
      README.md
  2. 24
      src/index.php

3
README.md

@ -9,4 +9,5 @@ @@ -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`

24
src/index.php

@ -84,3 +84,27 @@ catch (Exception $exception) @@ -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
Loading…
Cancel
Save