public function updateStyleSheets()
{
$objStyleSheets = $this->Database->execute("SELECT * FROM tl_style_sheet");
$arrStyleSheets = $objStyleSheets->fetchEach('name');
// Make sure the dcaconfig.php file is loaded
if (file_exists(TL_ROOT . '/system/config/dcaconfig.php')) {
@trigger_error('Using the dcaconfig.php file has been deprecated and will no longer work in Contao 5.0. Create one or more DCA files in app/Resources/contao/dca instead.', E_USER_DEPRECATED);
include TL_ROOT . '/system/config/dcaconfig.php';
}
// Delete old style sheets
foreach (scan(TL_ROOT . '/assets/css', true) as $file) {
// Skip directories
if (is_dir(TL_ROOT . '/assets/css/' . $file)) {
continue;
}
// Preserve root files (is this still required now that scripts are in assets/css/scripts?)
if (is_array(\Config::get('rootFiles')) && in_array($file, \Config::get('rootFiles'))) {
continue;
}
// Do not delete the combined files (see #3605)
if (preg_match('/^[a-f0-9]{12}\\.css$/', $file)) {
continue;
}
$objFile = new \File('assets/css/' . $file);
// Delete the old style sheet
if ($objFile->extension == 'css' && !in_array($objFile->filename, $arrStyleSheets)) {
$objFile->delete();
}
}
$objStyleSheets->reset();
// Create the new style sheets
while ($objStyleSheets->next()) {
$this->writeStyleSheet($objStyleSheets->row());
$this->log('Generated style sheet "' . $objStyleSheets->name . '.css"', __METHOD__, TL_CRON);
}
}