Commit 09950317 authored by Tino Goratsch's avatar Tino Goratsch

Merge branch 'release/v4.19.1'

parents 814487dc 0eb36499
......@@ -14,7 +14,7 @@ interface BootstrapInterface extends HttpKernelInterface
/**
* Contains the current ACP3 version string
*/
const VERSION = '4.19.0';
const VERSION = '4.19.1';
/**
* Performs some startup checks
......
......@@ -58,10 +58,6 @@ abstract class AbstractMinifier implements MinifierInterface
* @var string
*/
protected $systemAssetsDesignPath = 'System/';
/**
* @var string
*/
protected $assetGroup = '';
/**
* @var LoggerInterface
*/
......@@ -97,6 +93,8 @@ abstract class AbstractMinifier implements MinifierInterface
$this->logger = $logger;
}
abstract protected function getAssetGroup(): string;
/**
* @param string $type
* @param string $layout
......@@ -137,14 +135,14 @@ abstract class AbstractMinifier implements MinifierInterface
public function getURI($layout = 'layout')
{
$debug = $this->environment === 'dev';
$filenameHash = $this->generateFilenameHash($this->assetGroup, $layout);
$filenameHash = $this->generateFilenameHash($this->getAssetGroup(), $layout);
$cacheId = 'assets-last-generated-' . $filenameHash;
if (false === ($lastGenerated = $this->systemCache->fetch($cacheId))) {
$lastGenerated = time(); // Assets are not cached -> set the current time as the new timestamp
}
$path = $this->buildAssetPath($debug, $this->assetGroup, $filenameHash, $lastGenerated);
$path = $this->buildAssetPath($debug, $this->getAssetGroup(), $filenameHash, $lastGenerated);
// If the requested minified StyleSheet and/or the JavaScript file doesn't exist, generate it
if (is_file($this->appPath->getUploadsDir() . $path) === false || $debug === true) {
......
......@@ -7,21 +7,22 @@ namespace ACP3\Core\Assets\Minifier;
*/
class CSS extends AbstractMinifier
{
/**
* @var string
*/
protected $assetGroup = 'css';
/**
* @var array
*/
protected $stylesheets = [];
protected function getAssetGroup(): string
{
return 'css';
}
/**
* @inheritdoc
*/
protected function processLibraries($layout)
{
$cacheId = $this->buildCacheId($this->assetGroup, $layout);
$cacheId = $this->buildCacheId($this->getAssetGroup(), $layout);
if ($this->systemCache->contains($cacheId) === false) {
$this->fetchLibraries();
......@@ -40,12 +41,12 @@ class CSS extends AbstractMinifier
protected function fetchLibraries()
{
foreach ($this->assets->getLibraries() as $library) {
if ($library['enabled'] === true && isset($library[$this->assetGroup]) === true) {
if ($library['enabled'] === true && isset($library[$this->getAssetGroup()]) === true) {
$this->stylesheets[] = $this->fileResolver->getStaticAssetPath(
!empty($library['module']) ? $library['module'] . '/Resources' : $this->systemAssetsModulePath,
!empty($library['module']) ? $library['module'] : $this->systemAssetsDesignPath,
static::ASSETS_PATH_CSS,
$library[$this->assetGroup]
$library[$this->getAssetGroup()]
);
}
}
......
......@@ -7,21 +7,22 @@ namespace ACP3\Core\Assets\Minifier;
*/
class JavaScript extends AbstractMinifier
{
/**
* @var string
*/
protected $assetGroup = 'js';
/**
* @var array
*/
protected $javascript = [];
protected function getAssetGroup(): string
{
return 'js';
}
/**
* @inheritdoc
*/
protected function processLibraries($layout)
{
$cacheId = $this->buildCacheId($this->assetGroup, $layout);
$cacheId = $this->buildCacheId($this->getAssetGroup(), $layout);
if ($this->systemCache->contains($cacheId) === false) {
$this->fetchLibraries();
......@@ -39,12 +40,12 @@ class JavaScript extends AbstractMinifier
protected function fetchLibraries()
{
foreach ($this->assets->getLibraries() as $library) {
if ($library['enabled'] === true && isset($library[$this->assetGroup]) === true) {
if ($library['enabled'] === true && isset($library[$this->getAssetGroup()]) === true) {
$this->javascript[] = $this->fileResolver->getStaticAssetPath(
!empty($library['module']) ? $library['module'] . '/Resources' : $this->systemAssetsModulePath,
!empty($library['module']) ? $library['module'] : $this->systemAssetsDesignPath,
static::ASSETS_PATH_JS,
$library[$this->assetGroup]
$library[$this->getAssetGroup()]
);
}
}
......
......@@ -40,6 +40,10 @@ class Title
* @var string
*/
protected $pageTitleSeparator = '-';
/**
* @var string
*/
private $metaTitle = '';
/**
* @var string
*/
......@@ -183,6 +187,25 @@ class Title
return $this;
}
/**
* @return string
*/
public function getMetaTitle(): string
{
return $this->metaTitle;
}
/**
* @param string $metaTitle
* @return $this
*/
public function setMetaTitle(string $metaTitle)
{
$this->metaTitle = $metaTitle;
return $this;
}
/**
* @return string
*/
......@@ -215,7 +238,7 @@ class Title
new GetSiteAndPageTitleBeforeEvent($this)
);
$title = $this->getPageTitle();
$title = !empty($this->getMetaTitle()) ? $this->getMetaTitle() : $this->getPageTitle();
if (!empty($this->pageTitlePrefix)) {
$title = $this->pageTitlePrefix . $this->getPageTitleSeparator() . $title;
......
......@@ -7,6 +7,7 @@
namespace ACP3\Core\Cache;
use ACP3\Core\Environment\ApplicationMode;
use ACP3\Core\Http\RequestInterface;
use ACP3\Core\Settings\SettingsInterface;
use ACP3\Modules\ACP3\System\Installer\Schema;
use Symfony\Component\HttpFoundation\Response;
......@@ -17,6 +18,8 @@ use Symfony\Component\HttpFoundation\Response;
*/
trait CacheResponseTrait
{
abstract protected function getRequest(): RequestInterface;
/**
* @return Response
*/
......@@ -37,19 +40,24 @@ trait CacheResponseTrait
*/
public function setCacheResponseCacheable($lifetime = 60)
{
$varyHeaderName = 'X-User-Context-Hash';
$response = $this->getResponse();
$response
->setVary($varyHeaderName)
->setMaxAge($lifetime)
->setSharedMaxAge($lifetime)
->headers->add([
$varyHeaderName => $this->getRequest()->getSymfonyRequest()->headers->get($varyHeaderName)
]);
if ($this->disallowPageCache()) {
$response->setPrivate();
$lifetime = null;
} else {
$response->setPublic();
}
$response
->setVary('Cookie')
->setMaxAge($lifetime)
->setSharedMaxAge($lifetime);
}
/**
......@@ -60,6 +68,6 @@ trait CacheResponseTrait
$systemSettings = $this->getSettings()->getSettings(Schema::MODULE_NAME);
return $this->getApplicationMode() === ApplicationMode::DEVELOPMENT
|| $systemSettings['page_cache_is_enabled'] == 0;
|| $systemSettings['page_cache_is_enabled'] == 0;
}
}
......@@ -177,4 +177,12 @@ abstract class AbstractWidgetAction implements ActionInterface
{
return $this->container->getParameter('core.environment');
}
/**
* @return Core\Http\RequestInterface
*/
protected function getRequest(): Core\Http\RequestInterface
{
return $this->request;
}
}
......@@ -100,4 +100,17 @@ class TitleTest extends \PHPUnit_Framework_TestCase
$expected = 'FooBar | Lorem Ipsum';
$this->assertEquals($expected, $this->title->getSiteAndPageTitle());
}
public function testGetSiteAndPageTitleMetaTitleTakesPrecedenceOverPageTitle()
{
$this->setUpStepsExpectations(0);
$this->title
->setSiteTitle('Lorem Ipsum')
->setMetaTitle('Baz')
->setPageTitle('FooBar');
$expected = 'Baz | Lorem Ipsum';
$this->assertEquals($expected, $this->title->getSiteAndPageTitle());
}
}
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"autoload": {
"psr-4": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"suggest": {
"acp3/module-seo": "Provides additional SEO capabilities"
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0",
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1",
"google/recaptcha": "^1.1.0"
},
"autoload": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"autoload": {
"psr-4": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"suggest": {
"acp3/module-captcha": "Provides basic protection against spam bots."
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"suggest": {
"acp3/module-captcha": "Provides basic protection against spam bots."
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"autoload": {
"psr-4": {
......
......@@ -17,11 +17,11 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"autoload": {
"psr-4": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0",
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1",
"mibe/feedwriter": "^1.0"
},
"autoload": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"autoload": {
"psr-4": {
......
......@@ -17,13 +17,13 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0",
"acp3/module-categories": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1",
"acp3/module-categories": "^4.19.1"
},
"suggest": {
"acp3/module-seo": "Provides additional SEO capabilities"
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"suggest": {
"acp3/module-seo": "Provides additional SEO capabilities"
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"suggest": {
"acp3/module-captcha": "Provides basic protection against spam bots."
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"autoload": {
"psr-4": {
......
......@@ -17,13 +17,13 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0",
"acp3/module-categories": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1",
"acp3/module-categories": "^4.19.1"
},
"suggest": {
"acp3/module-seo": "Provides additional SEO capabilities"
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"suggest": {
"acp3/module-captcha": "Provides basic protection against spam bots."
......
......@@ -17,11 +17,11 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"autoload": {
"psr-4": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"autoload": {
"psr-4": {
......
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1"
},
"autoload": {
"psr-4": {
......
......@@ -40,10 +40,6 @@ class OnBreadcrumbTitleGetSiteAndPageTitleBeforeListener
*/
public function useMetaTitle(GetSiteAndPageTitleBeforeEvent $event)
{
$metaTitle = $this->metaStatements->getTitle($this->request->getQuery());
if (!empty($metaTitle)) {
$event->getTitle()->setPageTitle($metaTitle);
}
$event->getTitle()->setMetaTitle($this->metaStatements->getTitle($this->request->getQuery()));
}
}
......@@ -17,12 +17,12 @@
"prefer-stable": true,
"require": {
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-system": "^4.19.0",
"acp3/module-users": "^4.19.0",
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-system": "^4.19.1",
"acp3/module-users": "^4.19.1",
"thepixeldeveloper/sitemap": "^4.4.2"
},
"autoload": {
......
......@@ -18,11 +18,11 @@
"require": {
"composer/semver": "^1.4",
"acp3/composer-installer": "^1.0",
"acp3/core": "^4.19.0",
"acp3/setup": "^4.19.0",
"acp3/module-errors": "^4.19.0",
"acp3/module-permissions": "^4.19.0",
"acp3/module-users": "^4.19.0"
"acp3/core": "^4.19.1",
"acp3/setup": "^4.19.1",
"acp3/module-errors": "^4.19.1",
"acp3/module-permissions": "^4.19.1",
"acp3/module-users": "^4.19.1"