protected static function addCssFileToGroup($path, $groupId) { // create Files Model $objFile = new \File($path); if (!in_array(strtolower($objFile->extension), array('css', 'less'))) { return false; } $objFile->close(); $objFileModel = new ExtCssFileModel(); $objFileModel->pid = $groupId; $objFileModel->tstamp = time(); $objNextSorting = \Database::getInstance()->prepare("SELECT MAX(sorting) AS sorting FROM tl_extcss_file WHERE pid=?")->execute($groupId); $objFileModel->sorting = intval($objNextSorting->sorting) + 64; $objFileModel->src = $objFile->getModel()->uuid; $objFileModel->save(); return $objFileModel; }
protected function addCssFiles() { $objFiles = ExtCssFileModel::findMultipleByPids($this->ids, array('order' => 'FIELD(pid, ' . implode(",", $this->ids) . '), sorting DESC')); if ($objFiles === null) { return false; } while ($objFiles->next()) { $objFileModel = \FilesModel::findByPk($objFiles->src); if ($objFileModel === null) { continue; } if (!file_exists(TL_ROOT . '/' . $objFileModel->path)) { continue; } $objFile = new \File($objFileModel->path); if ($objFile->size == 0) { continue; } if ($this->isFileUpdated($objFile, $this->objUserCssFile)) { $this->rewrite = true; } $this->objLess->parseFile($objFile->value); } }