public function purge() { // Create compile task object. $task = new FD40_Stylesheet_Task("Purging stylesheet cache & log files."); $cacheFolder = $this->folder('cache'); if (JFolder::exists($cacheFolder)) { if (JFolder::delete($cacheFolder)) { $task->report("Deleted cache folder '{$cacheFolder}'."); } else { $task->report("Unable to delete cache folder '{$cacheFolder}'."); } } $logFolder = $this->folder('log'); if (JFolder::exists($logFolder)) { if (JFolder::delete($logFolder)) { $task->report("Deleted log folder '{$logFolder}'."); } else { $task->report("Unable to delete log folder '{$logFolder}'."); } } return $task->resolve(); }
public function joinFiles($sections = array(), $type = 'css') { $task = new FD40_Stylesheet_Task("Joining {$type} sections."); $content = ''; foreach ($sections as $section) { $sectionFile = $this->stylesheet->file($section, $type); if (!JFile::exists($sectionFile)) { return $task->reject("Missing minified section file '{$sectionFile}'."); } $sectionContent = JFile::read($sectionFile); if ($sectionContent === false) { return $task->reject("Unable to read minified section file '{$sectionFile}'."); } $content .= $sectionContent; } $task->result = $content; return $task->resolve(); }