Example #1
0
 protected function publishLinks($urlSet, $count = 0, $deep = true)
 {
     foreach ($urlSet as $set) {
         if ($count >= $this->config->get('settings.publish.limit')) {
             $this->info("* Per-node-link limit reached!");
             break;
         }
         $url = $set['url'];
         $date = $set['lastmod'];
         if ($this->isSitemap($url)) {
             if ($deep) {
                 $count = $this->publishLinks($this->gatherLinks($url), $count, false);
             }
             continue;
         }
         $result = $this->redis->lPush('nodes-queue', json_encode(compact('url', 'date')));
         if ($result > 0) {
             $count++;
             $this->counter['succeeed']++;
         } else {
             $this->counter['failed']++;
         }
     }
     return $count;
 }