Actually clear cache values for all base urls
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
f652c28b21
commit
63e261b444
|
@ -965,7 +965,7 @@ class Server extends ServerContainer implements IServerContainer {
|
||||||
$c->getConfig(),
|
$c->getConfig(),
|
||||||
$c->getThemingDefaults(),
|
$c->getThemingDefaults(),
|
||||||
\OC::$SERVERROOT,
|
\OC::$SERVERROOT,
|
||||||
$cacheFactory->createDistributed('SCSS-' . md5($this->getURLGenerator()->getBaseUrl()))
|
$this->getMemCacheFactory()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
$this->registerService(JSCombiner::class, function (Server $c) {
|
$this->registerService(JSCombiner::class, function (Server $c) {
|
||||||
|
@ -974,7 +974,7 @@ class Server extends ServerContainer implements IServerContainer {
|
||||||
return new JSCombiner(
|
return new JSCombiner(
|
||||||
$c->getAppDataDir('js'),
|
$c->getAppDataDir('js'),
|
||||||
$c->getURLGenerator(),
|
$c->getURLGenerator(),
|
||||||
$cacheFactory->createDistributed('JS-' . md5($this->getURLGenerator()->getBaseUrl())),
|
$this->getMemCacheFactory(),
|
||||||
$c->getSystemConfig(),
|
$c->getSystemConfig(),
|
||||||
$c->getLogger()
|
$c->getLogger()
|
||||||
);
|
);
|
||||||
|
|
|
@ -30,6 +30,7 @@ use OCP\Files\IAppData;
|
||||||
use OCP\Files\NotFoundException;
|
use OCP\Files\NotFoundException;
|
||||||
use OCP\Files\NotPermittedException;
|
use OCP\Files\NotPermittedException;
|
||||||
use OCP\Files\SimpleFS\ISimpleFolder;
|
use OCP\Files\SimpleFS\ISimpleFolder;
|
||||||
|
use OCP\ICacheFactory;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
|
|
||||||
|
@ -50,21 +51,25 @@ class JSCombiner {
|
||||||
/** @var ILogger */
|
/** @var ILogger */
|
||||||
protected $logger;
|
protected $logger;
|
||||||
|
|
||||||
|
/** @var ICacheFactory */
|
||||||
|
private $cacheFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param IAppData $appData
|
* @param IAppData $appData
|
||||||
* @param IURLGenerator $urlGenerator
|
* @param IURLGenerator $urlGenerator
|
||||||
* @param ICache $depsCache
|
* @param ICacheFactory $cacheFactory
|
||||||
* @param SystemConfig $config
|
* @param SystemConfig $config
|
||||||
* @param ILogger $logger
|
* @param ILogger $logger
|
||||||
*/
|
*/
|
||||||
public function __construct(IAppData $appData,
|
public function __construct(IAppData $appData,
|
||||||
IURLGenerator $urlGenerator,
|
IURLGenerator $urlGenerator,
|
||||||
ICache $depsCache,
|
ICacheFactory $cacheFactory,
|
||||||
SystemConfig $config,
|
SystemConfig $config,
|
||||||
ILogger $logger) {
|
ILogger $logger) {
|
||||||
$this->appData = $appData;
|
$this->appData = $appData;
|
||||||
$this->urlGenerator = $urlGenerator;
|
$this->urlGenerator = $urlGenerator;
|
||||||
$this->depsCache = $depsCache;
|
$this->cacheFactory = $cacheFactory;
|
||||||
|
$this->depsCache = $this->cacheFactory->createDistributed('JS-' . md5($this->urlGenerator->getBaseUrl()));
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
|
@ -243,7 +248,7 @@ class JSCombiner {
|
||||||
* @throws NotFoundException
|
* @throws NotFoundException
|
||||||
*/
|
*/
|
||||||
public function resetCache() {
|
public function resetCache() {
|
||||||
$this->depsCache->clear();
|
$this->cacheFactory->createDistributed('JS-')->clear();
|
||||||
$appDirectory = $this->appData->getDirectoryListing();
|
$appDirectory = $this->appData->getDirectoryListing();
|
||||||
foreach ($appDirectory as $folder) {
|
foreach ($appDirectory as $folder) {
|
||||||
foreach ($folder->getDirectoryListing() as $file) {
|
foreach ($folder->getDirectoryListing() as $file) {
|
||||||
|
|
|
@ -39,6 +39,7 @@ use OCP\Files\NotPermittedException;
|
||||||
use OCP\Files\SimpleFS\ISimpleFile;
|
use OCP\Files\SimpleFS\ISimpleFile;
|
||||||
use OCP\Files\SimpleFS\ISimpleFolder;
|
use OCP\Files\SimpleFS\ISimpleFolder;
|
||||||
use OCP\ICache;
|
use OCP\ICache;
|
||||||
|
use OCP\ICacheFactory;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
|
@ -69,6 +70,9 @@ class SCSSCacher {
|
||||||
/** @var null|string */
|
/** @var null|string */
|
||||||
private $injectedVariables;
|
private $injectedVariables;
|
||||||
|
|
||||||
|
/** @var ICacheFactory */
|
||||||
|
private $cacheFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ILogger $logger
|
* @param ILogger $logger
|
||||||
* @param Factory $appDataFactory
|
* @param Factory $appDataFactory
|
||||||
|
@ -76,7 +80,7 @@ class SCSSCacher {
|
||||||
* @param IConfig $config
|
* @param IConfig $config
|
||||||
* @param \OC_Defaults $defaults
|
* @param \OC_Defaults $defaults
|
||||||
* @param string $serverRoot
|
* @param string $serverRoot
|
||||||
* @param ICache $depsCache
|
* @param ICacheFactory $cacheFactory
|
||||||
*/
|
*/
|
||||||
public function __construct(ILogger $logger,
|
public function __construct(ILogger $logger,
|
||||||
Factory $appDataFactory,
|
Factory $appDataFactory,
|
||||||
|
@ -84,14 +88,15 @@ class SCSSCacher {
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
\OC_Defaults $defaults,
|
\OC_Defaults $defaults,
|
||||||
$serverRoot,
|
$serverRoot,
|
||||||
ICache $depsCache) {
|
ICacheFactory $cacheFactory) {
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->appData = $appDataFactory->get('css');
|
$this->appData = $appDataFactory->get('css');
|
||||||
$this->urlGenerator = $urlGenerator;
|
$this->urlGenerator = $urlGenerator;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->defaults = $defaults;
|
$this->defaults = $defaults;
|
||||||
$this->serverRoot = $serverRoot;
|
$this->serverRoot = $serverRoot;
|
||||||
$this->depsCache = $depsCache;
|
$this->cacheFactory = $cacheFactory;
|
||||||
|
$this->depsCache = $cacheFactory->createDistributed('SCSS-' . md5($this->urlGenerator->getBaseUrl()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -263,7 +268,7 @@ class SCSSCacher {
|
||||||
*/
|
*/
|
||||||
public function resetCache() {
|
public function resetCache() {
|
||||||
$this->injectedVariables = null;
|
$this->injectedVariables = null;
|
||||||
$this->depsCache->clear();
|
$this->cacheFactory->createDistributed('SCSS-')->clear();
|
||||||
$appDirectory = $this->appData->getDirectoryListing();
|
$appDirectory = $this->appData->getDirectoryListing();
|
||||||
foreach ($appDirectory as $folder) {
|
foreach ($appDirectory as $folder) {
|
||||||
foreach ($folder->getDirectoryListing() as $file) {
|
foreach ($folder->getDirectoryListing() as $file) {
|
||||||
|
|
Loading…
Reference in New Issue