62 $cache_file = $xoops_var_path .
'/configs/cache.php';
68 $this->poolDefs = array_merge($defaults,
$poolDefs);
80 'driver' =>
'FileSystem',
87 'driver' =>
'Ephemeral',
110 if (file_exists($configFile)) {
113 $defaults = self::getDefaults();
114 if (
false !== stripos(PHP_OS,
'WIN')) {
115 $pathLen = strlen($defaults[
'default'][
'options'][
'path']);
116 if (260 <= ($pathLen+202)) {
118 if (array_key_exists(
"SQLite", \Stash\DriverList::getAvailableDrivers())) {
119 $defaults[
'default'][
'driver'] =
'SQLite';
120 unset($defaults[
'default'][
'options'][
'dirSplit']);
121 @mkdir($defaults[
'default'][
'options'][
'path']);
123 trigger_error(
"Manual cache configuration required.");
140 if (array_key_exists(
$name, $this->pools)) {
141 $pool = $this->pools[
$name];
142 } elseif (array_key_exists(
$name, $this->poolDefs)) {
145 if ($pool ===
false) {
149 $this->pools[
$name] = $pool;
166 if (isset($this->poolDefs[
$name][
'options'])) {
169 $driverName = $this->poolDefs[
$name][
'driver'];
170 if (0 === strcasecmp($driverName,
'Composite')) {
172 foreach ($this->poolDefs[$name][
'options'][
'drivers'] as $subDriver) {
173 $drivers[] = $this->
getDriver($subDriver[
'driver'], $subDriver[
'options']);
179 if ($driver!==
false) {
180 $pool =
new Pool($driver);
181 if (is_object($pool)) {
182 $pool->setLogger($this->xoops->logger());
186 $this->xoops->logger()->warn(
'Could not create cache pool '.$name);
206 if ($driverClass!==
false && $driverClass::isAvailable()) {
208 $driver =
new $driverClass();
211 return ($driver instanceof DriverInterface) ? $driver :
false;
224 $this->xoops->events()->triggerEvent(
'debug.log',
'Substituting default cache pool for '.$originalName);
226 if (array_key_exists(
$name, $this->pools)) {
227 return $this->pools[
$name];
231 $this->xoops->logger()->error(
'Could not create default cache pool');
232 $pool =
new Access(
new \Stash\Pool());
234 $this->pools[
$name] = $pool;
getDefaultPool($originalName)
static createDefaultConfig()
getDriver($driverName, $options)
static getDriverClass($name)
static readWrapped($yamlFile)
static saveWrapped($var, $yamlFile, $inline=4, $indent=4)