/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { // initialize database manager $databaseManager = new sfDatabaseManager($this->configuration); $flag = true; if (function_exists('apc_store') && ini_get('apc.enabled')) { $cache = new sfAPCCache(); if (!ini_get('apc.enable_cli')) { $this->logSection('combine', 'Check apc.enabled_cli in your ini file', null, 'ERROR'); $flag = false; } } else { $cache = new sfFileCache(array('cache_dir' => sfCombinePlusUtility::getCacheDir())); } if ($flag) { $results = sfCombinePlus::getAll(); foreach ($results as $result) { $cache->remove($result->getAssetKey()); } $this->logSection('combine', 'Cleanup cache complete', null, 'INFO'); $deleted = sfCombinePlus::deleteAll(); $this->logSection('combine', sprintf('Cleanup database complete (%d rows deleted)', $deleted), null, 'INFO'); } }
/** * Take a db hash and convert it into an array of files * * @see getFiles */ public static function getFilesByKey($key, $separator = ' ') { $base64 = false; // try get base64 from cache if (function_exists('apc_store') && ini_get('apc.enabled')) { $cache = new sfAPCCache(); $base64 = $cache->get($key); } if (!$base64) { $cache = new sfFileCache(array('cache_dir' => self::getCacheDir())); $base64 = $cache->get($key); } // check db if (!$base64) { $combine = sfCombinePlus::getByKey($key); $base64 = $combine ? $combine->getFiles() : false; } return self::getFilesByBase64($base64, $separator); }