protected function run() { $areaRepository = new AreaRepository(); $arb = new AreaRepositoryBuilder(); $arb->setLimit(0); // all of them $count = 0; foreach ($arb->fetchAll() as $area) { $areaRepository->updateFutureEventsCache($area); ++$count; } return array('result' => 'ok', 'count' => $count); }
$calendar->getEventRepositoryBuilder()->setIncludeAreaInformation(true); $calData = $calendar->getData(); $childAreas = array(); if ($thisconfig->getBoolean('ListChildAreas', false)) { $areaRepoBuilder = new \repositories\builders\AreaRepositoryBuilder(); $areaRepoBuilder->setSite($site); $areaRepoBuilder->setIncludeDeleted(false); if ($area) { $areaRepoBuilder->setParentArea($area); } else { $areaRepoBuilder->setNoParentArea(true); } $childAreas = array(); $areaRepository = new AreaRepository(); foreach ($areaRepoBuilder->fetchAll() as $area) { $areaRepository->updateFutureEventsCache($area); if ($thisconfig->getBoolean('ListChildAreasWithNoEvents', false) || $area->getCachedFutureEvents() > 0) { $childAreas[] = $area; } } } // ######################################################### Build Email Content, show user. configureAppForSite($site); $messageText = $app['twig']->render('email/sendSpecifiedEventsEmail.cli.txt.twig', array('data' => $calData, 'currentSite' => $site, 'currentTimeZone' => $thisconfig->get('TimeZone'), 'intro' => file_get_contents($configDataDir . '/' . $thisconfig->get('IntroTXTFile')), 'listChildAreas' => $thisconfig->getBoolean('ListChildAreas'), 'listChildAreasIntro' => $thisconfig->get('ListChildAreasIntro'), 'childAreas' => $childAreas)); $messageHTML = $app['twig']->render('email/sendSpecifiedEventsEmail.cli.html.twig', array('data' => $calData, 'currentSite' => $site, 'currentTimeZone' => $thisconfig->get('TimeZone'), 'intro' => file_get_contents($configDataDir . '/' . $thisconfig->get('IntroHTMLFile')), 'listChildAreas' => $thisconfig->getBoolean('ListChildAreas'), 'listChildAreasIntro' => $thisconfig->get('ListChildAreasIntro'), 'childAreas' => $childAreas)); if ($CONFIG->isDebug) { file_put_contents('/tmp/sendEventsEmail.txt', $messageText); } if ($CONFIG->isDebug) { file_put_contents('/tmp/sendEventsEmail.html', $messageHTML); }