public function performPreInstallTasks() { $o_config = Configuration::load(); CompositeCache::flush(); // avoid stale cache // create tmp dir if (!file_exists($o_config->get('taskqueue_tmp_directory'))) { if (!self::createDirectoryPath($o_config->get('taskqueue_tmp_directory'))) { $this->addError("Couldn't create tmp directory at " . $o_config->get('taskqueue_tmp_directory')); return false; } } else { // if already exists then remove all contents to avoid stale cache caRemoveDirectory($o_config->get('taskqueue_tmp_directory'), false); } // Create media directories $o_media_volumes = new MediaVolumes(); $va_media_volumes = $o_media_volumes->getAllVolumeInformation(); $vs_base_dir = $o_config->get('ca_base_dir'); $va_dir_creation_errors = array(); foreach ($va_media_volumes as $vs_label => $va_volume_info) { if (preg_match('!^' . $vs_base_dir . '!', $va_volume_info['absolutePath'])) { if (!self::createDirectoryPath($va_volume_info['absolutePath'])) { $this->addError("Couldn't create directory for media volume {$vs_label}"); return false; } } } return true; }
public function testFlush() { $vm_ret = CompositeCache::save('foo', array('foo' => 'bar'), 'barNamespace'); $this->assertTrue($vm_ret, 'Setting item in cache should return true'); CompositeCache::flush(); $vm_ret = CompositeCache::contains('foo', 'barNamespace'); $this->assertFalse($vm_ret, 'Should not return anything after deleting'); }
public function performPreInstallTasks() { $o_config = Configuration::load(); CompositeCache::flush(); // avoid stale cache // create tmp dir if (!file_exists($o_config->get('taskqueue_tmp_directory'))) { if (!self::createDirectoryPath($o_config->get('taskqueue_tmp_directory'))) { $this->addError("Couldn't create tmp directory at " . $o_config->get('taskqueue_tmp_directory')); return false; } } else { // if already exists then remove all contents to avoid stale cache caRemoveDirectory($o_config->get('taskqueue_tmp_directory'), false); } // Create media directories $o_media_volumes = new MediaVolumes(); $va_media_volumes = $o_media_volumes->getAllVolumeInformation(); $vs_base_dir = $o_config->get('ca_base_dir'); $va_dir_creation_errors = array(); foreach ($va_media_volumes as $vs_label => $va_volume_info) { if (preg_match('!^' . $vs_base_dir . '!', $va_volume_info['absolutePath'])) { if (!self::createDirectoryPath($va_volume_info['absolutePath'])) { $this->addError("Couldn't create directory for media volume {$vs_label}"); return false; } } } // nuke search index if we using ElasticSearch (the SqlSearch index is nuked when we drop the database) if ($o_config->get('search_engine_plugin') == 'ElasticSearch') { require_once __CA_LIB_DIR__ . '/core/Plugins/SearchEngine/ElasticSearch.php'; $o_es = new WLPlugSearchEngineElasticSearch(); $o_es->truncateIndex(null, true); } return true; }