aboutsummaryrefslogtreecommitdiff
path: root/src/phinde/Queue.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2016-11-07 21:41:36 +0100
committerChristian Weiske <cweiske@cweiske.de>2016-11-07 21:41:36 +0100
commitd7651fd96dcfa2829519504e4c8ec1ce511cd57f (patch)
treee24d7a9f90060b0fee5a652de43bd0627f1c5bde /src/phinde/Queue.php
parentf90790c6b2a54c9b1c8a0aeaf1f23e6aa67d7aca (diff)
downloadphinde-d7651fd96dcfa2829519504e4c8ec1ce511cd57f.tar.gz
phinde-d7651fd96dcfa2829519504e4c8ec1ce511cd57f.zip
Big patch merging crawling+indexing into one command, new json document structure
Diffstat (limited to 'src/phinde/Queue.php')
-rw-r--r--src/phinde/Queue.php34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/phinde/Queue.php b/src/phinde/Queue.php
index 406f27e..6c30faa 100644
--- a/src/phinde/Queue.php
+++ b/src/phinde/Queue.php
@@ -11,40 +11,22 @@ class Queue
$this->gmclient->addServer('127.0.0.1');
}
- public function addToIndex($linkUrl, $linkTitle, $sourceUrl)
+ public function addToProcessList($linkUrl, $actions)
{
- echo "Queuing for indexing: $linkUrl\n";
+ echo "Queuing for processing: $linkUrl"
+ . ' (' . implode(',', $actions) . ')'
+ . "\n";
$this->gmclient->doBackground(
- $GLOBALS['phinde']['queuePrefix'] . 'phinde_index',
+ $GLOBALS['phinde']['queuePrefix'] . 'phinde_process',
serialize(
array(
- 'url' => $linkUrl,
- 'title' => $linkTitle,
- 'source' => $sourceUrl
+ 'url' => $linkUrl,
+ 'actions' => $actions,
)
)
);
if ($this->gmclient->returnCode() != GEARMAN_SUCCESS) {
- echo 'Error queueing URL indexing for '
- . $linkUrl . "\n"
- . 'Error code: ' . $this->gmclient->returnCode() . "\n";
- exit(2);
- }
- }
-
- public function addToCrawl($linkUrl)
- {
- echo "Queuing for crawling: $linkUrl\n";
- $this->gmclient->doBackground(
- $GLOBALS['phinde']['queuePrefix'] . 'phinde_crawl',
- serialize(
- array(
- 'url' => $linkUrl
- )
- )
- );
- if ($this->gmclient->returnCode() != GEARMAN_SUCCESS) {
- echo 'Error queueing URL crawling for '
+ echo 'Error queueing URL processing for '
. $linkUrl . "\n"
. 'Error code: ' . $this->gmclient->returnCode() . "\n";
exit(2);