public function index() { $crawlerModel = new CrawlerModel(); $sources = $crawlerModel->getAllSources(); $totalCount = 0; $time_start = microtime(true); foreach ($sources as $source) { $class = '\\Krikke\\Crawler\\Controller\\Crawlers\\' . ucfirst($source['source']); $controller = new $class(); //if($source['source_type'] == 1){ //$result = $this->crawlSource($source); $result = $controller->crawlSource($source); if (isset($result['total']) && !empty($result['total']) && $result['total'] != 0) { $totalCount += $result['total']; } //} } $time_end = microtime(true); $time = $time_end - $time_start; $scriptTime = round($time, 2) . " s"; if (ENVIRONMENT == 'production') { $this->sendNotification($totalCount, $scriptTime); } }
public function index() { $model = new CrawlerModel(); $this->viewData['sources'] = $model->getAllSources(); echo $this->twig->render('home/index.html.twig', $this->viewData); }