Skip to content

Commit

Permalink
Use system temp directory for the cache.
Browse files Browse the repository at this point in the history
To resolve phar cache issue reported in mglaman#17
  • Loading branch information
mglaman committed May 2, 2018
1 parent 6aef855 commit 3215b2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
17 changes: 5 additions & 12 deletions src/Cli/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,19 @@

class Cache
{
protected static $cacheDir;
protected static $cache;


/**
* @param string $cacheDir
*/
public static function setCacheDir($cacheDir)
{
self::$cacheDir = $cacheDir;
}
protected static $cache;

/**
* @return \Doctrine\Common\Cache\CacheProvider
*/
public static function getCache()
{
if (!isset(self::$cache)) {
self::$cache = new FilesystemCache(self::$cacheDir, FilesystemCache::EXTENSION, 0077);
$tmpPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . '/drupalorg-cli-cache';
@mkdir($tmpPath);
self::$cache = new FilesystemCache($tmpPath, FilesystemCache::EXTENSION, 0077);
}
return self::$cache;
}
}
}
7 changes: 0 additions & 7 deletions src/Cli/Command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ abstract class Command extends BaseCommand
*/
protected $client;

public function __construct($name = null)
{
parent::__construct($name);

Cache::setCacheDir(CLI_ROOT . '/cache');
}

/**
* @inheritdoc
*/
Expand Down

0 comments on commit 3215b2a

Please sign in to comment.