AndyB
Well-known member
Hello,
I currently have an add-on called Amazon parser all. The latest version allows running from Rebuild caches. I would also like to learn how to create a CLI option for this add-on.
So far I have created a Cli/Command/AmazonParserAll.php file. My question is what code do I use in the AmazonParserAll.php file? I assume I will use primarily the same code I used in my Job/AmazonParserAll.php file, but what changes do I need to make?
Job/AmazonParserAll.php
Thank you.
I currently have an add-on called Amazon parser all. The latest version allows running from Rebuild caches. I would also like to learn how to create a CLI option for this add-on.
So far I have created a Cli/Command/AmazonParserAll.php file. My question is what code do I use in the AmazonParserAll.php file? I assume I will use primarily the same code I used in my Job/AmazonParserAll.php file, but what changes do I need to make?
Job/AmazonParserAll.php
PHP:
<?php
namespace Andy\AmazonParserAll\Job;
use XF\Job\AbstractRebuildJob;
use XF\Mvc\Entity\Entity;
class AmazonParserAll extends AbstractRebuildJob
{
protected $defaultData = [
'start' => 0,
'batch' => 100
];
protected function getNextIds($start, $batch)
{
$db = $this->app->db();
return $db->fetchAllColumn($db->limit(
"
SELECT post_id
FROM xf_post
WHERE post_id > ?
ORDER BY post_id
", $batch
), $start);
}
...
Thank you.
Last edited: