-if (isset($queues['crawl'])) {
- $gmworker->addFunction(
- $GLOBALS['phinde']['queuePrefix'] . 'phinde_crawl',
- function(\GearmanJob $job) {
- $data = unserialize($job->workload());
- echo "-- Crawling " . $data['url'] . "\n";
- passthru('./crawl.php ' . escapeshellarg($data['url']));
- }
- );
-}
-if (isset($queues['index'])) {
- $gmworker->addFunction(
- $GLOBALS['phinde']['queuePrefix'] . 'phinde_index',
- function(\GearmanJob $job) {
- $data = unserialize($job->workload());
- echo "-- Indexing " . $data['url'] . "\n";
- passthru('./index.php ' . escapeshellarg($data['url']));
- //exit();
- }
- );
-}
+$gmworker->addFunction(
+ $GLOBALS['phinde']['queuePrefix'] . 'phinde_process',
+ function(\GearmanJob $job) {
+ $data = unserialize($job->workload());
+ echo "-- Processing " . $data['url']
+ . ' (' . implode(',', $data['actions']) . ')'
+ . "\n";
+ passthru(
+ './process.php ' . escapeshellarg($data['url'])
+ . ' ' . implode(' ', $data['actions'])
+ );
+ }
+);
+
+$gmworker->addFunction(
+ $GLOBALS['phinde']['queuePrefix'] . 'phinde_quit',
+ function(\GearmanJob $job) {
+ echo "Got exit job\n";
+ $job->sendComplete('');
+ exit(0);
+ }
+);