Dep: update

주로 PHAN
This commit is contained in:
2021-08-06 22:39:09 +09:00
parent 5310c2e7f6
commit b306601c72
1098 changed files with 92137 additions and 33228 deletions
@@ -39,12 +39,12 @@ final class CacheExtension extends Nette\DI\CompilerExtension
if (extension_loaded('pdo_sqlite')) {
$builder->addDefinition($this->prefix('journal'))
->setType(Nette\Caching\Storages\IJournal::class)
->setType(Nette\Caching\Storages\Journal::class)
->setFactory(Nette\Caching\Storages\SQLiteJournal::class, [$dir . '/journal.s3db']);
}
$builder->addDefinition($this->prefix('storage'))
->setType(Nette\Caching\IStorage::class)
->setType(Nette\Caching\Storage::class)
->setFactory(Nette\Caching\Storages\FileStorage::class, [$dir]);
if ($this->name === 'cache') {
+41 -14
View File
@@ -59,8 +59,10 @@ final class CacheMacro implements Latte\IMacro
$this->used = true;
$node->empty = false;
$node->openingCode = Latte\PhpWriter::using($node)
->write('<?php if (Nette\Bridges\CacheLatte\CacheMacro::createCache($this->global->cacheStorage, %var, $this->global->cacheStack, %node.array?)) { ?>',
Nette\Utils\Random::generate()
->write(
'<?php if (Nette\Bridges\CacheLatte\CacheMacro::createCache($this->global->cacheStorage, %var, $this->global->cacheStack, %node.array?)) /* line %var */ try { ?>',
Nette\Utils\Random::generate(),
$node->startLine
);
}
@@ -72,7 +74,14 @@ final class CacheMacro implements Latte\IMacro
public function nodeClosed(Latte\MacroNode $node)
{
$node->closingCode = Latte\PhpWriter::using($node)
->write('<?php Nette\Bridges\CacheLatte\CacheMacro::endCache($this->global->cacheStack, %node.array?); } ?>');
->write(
'<?php
Nette\Bridges\CacheLatte\CacheMacro::endCache($this->global->cacheStack, %node.array?) /* line %var */;
} catch (\Throwable $ʟ_e) {
Nette\Bridges\CacheLatte\CacheMacro::rollback($this->global->cacheStack); throw $ʟ_e;
} ?>',
$node->startLine
);
}
@@ -94,8 +103,12 @@ final class CacheMacro implements Latte\IMacro
* Starts the output cache. Returns Nette\Caching\OutputHelper object if buffering was started.
* @return Nette\Caching\OutputHelper|\stdClass
*/
public static function createCache(Nette\Caching\IStorage $cacheStorage, string $key, ?array &$parents, array $args = null)
{
public static function createCache(
Nette\Caching\Storage $cacheStorage,
string $key,
?array &$parents,
array $args = null
) {
if ($args) {
if (array_key_exists('if', $args) && !$args['if']) {
return $parents[] = new \stdClass;
@@ -119,18 +132,32 @@ final class CacheMacro implements Latte\IMacro
* @param Nette\Caching\OutputHelper[] $parents
*/
public static function endCache(array &$parents, array $args = null): void
{
$helper = array_pop($parents);
if (!$helper instanceof Nette\Caching\OutputHelper) {
return;
}
if (isset($args['dependencies'])) {
$args += $args['dependencies']();
}
if (isset($args['expire'])) {
$args['expiration'] = $args['expire']; // back compatibility
}
$helper->dependencies[Cache::TAGS] = $args['tags'] ?? null;
$helper->dependencies[Cache::EXPIRATION] = $args['expiration'] ?? '+ 7 days';
$helper->end();
}
/**
* @param Nette\Caching\OutputHelper[] $parents
*/
public static function rollback(array &$parents): void
{
$helper = array_pop($parents);
if ($helper instanceof Nette\Caching\OutputHelper) {
if (isset($args['dependencies'])) {
$args += $args['dependencies']();
}
if (isset($args['expire'])) {
$args['expiration'] = $args['expire']; // back compatibility
}
$helper->dependencies[Cache::TAGS] = $args['tags'] ?? null;
$helper->dependencies[Cache::EXPIRATION] = $args['expiration'] ?? '+ 7 days';
$helper->end();
$helper->rollback();
}
}
}