public static function findPublishedRootPages(array $arrOptions = array()) { $t = static::$strTable; $arrColumns = array("{$t}.type=?"); if (isset($arrOptions['ignoreFePreview']) || !BE_USER_LOGGED_IN) { $time = \Date::floorToMinute(); $arrColumns[] = "({$t}.start='' OR {$t}.start<='{$time}') AND ({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "') AND {$t}.published='1'"; } return static::findBy($arrColumns, 'root', $arrOptions); }
/** * Generates the cache mapper array. * * @param string $cacheDir The cache directory */ private function generateCacheMapper($cacheDir) { $mapper = []; $pages = PageModel::findPublishedRootPages(); if (null === $pages) { return; } while ($pages->next()) { $base = $pages->dns ?: '*'; if ($pages->fallback) { $mapper[$base . '/empty.fallback'] = $base . '/empty.' . $pages->language; } $mapper[$base . '/empty.' . $pages->language] = $base . '/empty.' . $pages->language; } $this->filesystem->dumpFile($cacheDir . '/contao/config/mapping.php', sprintf("<?php\n\nreturn %s;\n", var_export($mapper, true))); }