protected function dump($vars) { $file_name = $vars['name']; if (empty($file_name)) { //do nothing if name is not set I2CE::raiseError("No file specified", E_USER_NOTICE); return; } //get the extension if (array_key_exists('ext', $vars)) { $ext = strtolower($vars['ext']); } else { $ext = strtolower(substr(strrchr($file_name, "."), 1)); } $category = null; if (array_key_exists('cat', $vars)) { $category = $vars['cat']; } if (empty($category)) { //try to see if we have a default category if (array_key_exists($ext, $this->default_categories)) { $category = $this->default_categories[$ext]; } if (empty($category)) { //do nothing if no category found I2CE::raiseError("No file category specified for ({$file_name}). Valid categories are:" . print_r($this->default_categories, true), E_USER_NOTICE); I2CE::raiseError(print_r($this->default_categories, true)); return; } } if (!in_array($category, $this->allowedCategories)) { //we are not allowed to search this category I2CE::raiseError("Not allowed to search category ({$category}). Allowed are:\n" . print_r($this->allowedCategories, true), E_USER_NOTICE); return; } $file_loc = I2CE::getFileSearch()->search($category, $file_name); $locale = I2CE::getFileSearch()->getLocaleOfLastSearch(); if (!$file_loc) { //do nothing if we can't find the file I2CE::raiseError("Cannot find ({$file_name}). Search category is {$category} , Path is:\n" . print_r(I2CE::getFileSearch()->getSearchPath($category), true), E_USER_NOTICE); return; } if (!array_key_exists('apdContent', $vars)) { $vars['apdContent'] = null; } if (!array_key_exists('content', $vars)) { $vars['content'] = null; } //$headers = $this->doHeader($file_name,$file_loc,$ext,$vars['content'],$vars['apdContent']); $headers = $this->doHeader($file_name, $ext, $vars['content'], $vars['apdContent']); $config = I2CE::getConfig(); $cacheTime = 600; // defaults to 10 minutes if (isset($config->modules->FileDump->cache_time)) { $cacheTime = $config->modules->FileDump->cache_time * 60; } $ttl = 3600; // defaults to one hour if ($config->is_scalar("/modules/FileDump/ttl")) { $ttl = $config->modules->FileDump->ttl * 60; } if (I2CE_Dumper::dumpContents($file_loc, $headers, $cacheTime)) { I2CE_Dumper::cacheFileLocation(MDB2::singleton()->database_name, $file_name, $locale, $headers, $file_loc, $cacheTime, $ttl); } }