Skip to content

Commit

Permalink
Merge branch '4.9' into 4.10
Browse files Browse the repository at this point in the history
# Conflicts:
#	calendar-bundle/src/Resources/contao/languages/fr/tl_calendar_feed.xlf
#	composer.json
#	core-bundle/src/Command/InstallCommand.php
#	core-bundle/src/Command/SymlinksCommand.php
#	core-bundle/src/DependencyInjection/Compiler/RegisterFragmentsPass.php
#	core-bundle/src/Migration/Version408/Version480Update.php
#	core-bundle/src/Resources/contao/dca/tl_page.php
#	core-bundle/src/Resources/contao/library/Contao/Controller.php
#	core-bundle/src/Resources/contao/library/Contao/DcaExtractor.php
#	core-bundle/src/Resources/contao/library/Contao/InsertTags.php
#	core-bundle/src/Resources/contao/modules/Module.php
#	core-bundle/tests/Contao/Database/ResultTest.php
#	core-bundle/tests/Functional/RoutingTest.php
#	core-bundle/tests/Security/Authentication/RememberMe/ExpiringTokenBasedRememberMeServicesTest.php
#	installation-bundle/src/Database/Version330Update.php
#	manager-bundle/composer.json
#	manager-bundle/src/Resources/skeleton/config/config.yml
#	manager-bundle/tests/ContaoManager/PluginTest.php
#	monorepo.yml
#	news-bundle/src/Resources/contao/dca/tl_news.php
#	news-bundle/src/Resources/contao/languages/fr/tl_news_feed.xlf
  • Loading branch information
leofeyer committed Dec 11, 2020
2 parents 90caa2a + 918884c commit 5eb206f
Show file tree
Hide file tree
Showing 109 changed files with 628 additions and 540 deletions.
76 changes: 53 additions & 23 deletions .github/workflows/ci.yml
Expand Up @@ -19,16 +19,16 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
php-version: 7.4
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib
tools: prestissimo, flex
tools: flex
coverage: pcov

- name: Checkout
uses: actions/checkout@v1

- name: Install the dependencies
run: composer install --no-interaction --no-suggest
run: composer install --no-interaction

- name: Generate the coverage report
run: php -d pcov.enabled=1 vendor/bin/phpunit --testsuite=coverage --coverage-clover=clover.xml --colors=always
Expand All @@ -47,16 +47,16 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
php-version: 7.4
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib
tools: prestissimo, flex
tools: flex
coverage: none

- name: Checkout
uses: actions/checkout@v1

- name: Install the dependencies
run: composer install --no-interaction --no-suggest
run: composer install --no-interaction

- name: Check the coding style
run: |
Expand Down Expand Up @@ -89,7 +89,39 @@ jobs:
with:
php-version: ${{ matrix.php }}
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib
tools: prestissimo, flex
tools: flex
coverage: none

- name: Initialize the database
run: |
sudo /etc/init.d/mysql start
mysql -uroot -proot -e "CREATE database contao_test"
- name: Checkout
uses: actions/checkout@v1

- name: Install the dependencies
run: composer install --no-interaction

- name: Run the unit tests
run: vendor/bin/phpunit --colors=always

- name: Run the functional tests
run: vendor/bin/phpunit --testsuite=functional --colors=always
env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/contao_test

php8:
name: PHP 8.0
runs-on: ubuntu-latest
if: github.event_name != 'push'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib
tools: flex
coverage: none

- name: Initialize the database
Expand All @@ -101,15 +133,15 @@ jobs:
uses: actions/checkout@v1

- name: Install the dependencies
run: composer install --no-interaction --no-suggest
run: composer install --ignore-platform-reqs --no-interaction

- name: Run the unit tests
run: vendor/bin/phpunit --colors=always

- name: Run the functional tests
run: vendor/bin/phpunit --testsuite=functional --colors=always
env:
DATABASE_URL: mysql://root:root@localhost:3306/contao_test
DATABASE_URL: mysql://root:root@127.0.0.1:3306/contao_test

prefer-lowest:
name: Prefer Lowest
Expand All @@ -121,7 +153,7 @@ jobs:
with:
php-version: 7.3
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib
tools: prestissimo, flex
tools: flex
coverage: none

- name: Initialize the database
Expand All @@ -133,15 +165,15 @@ jobs:
uses: actions/checkout@v1

- name: Install the dependencies
run: composer update --prefer-lowest --prefer-stable --no-interaction --no-suggest
run: composer update --prefer-lowest --prefer-stable --no-interaction

- name: Run the unit tests
run: vendor/bin/phpunit --colors=always

- name: Run the functional tests
run: vendor/bin/phpunit --testsuite=functional --colors=always
env:
DATABASE_URL: mysql://root:root@localhost:3306/contao_test
DATABASE_URL: mysql://root:root@127.0.0.1:3306/contao_test

bundles:
name: Bundles
Expand All @@ -151,9 +183,9 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
php-version: 7.4
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib
tools: prestissimo, flex
tools: flex
coverage: none

- name: Checkout
Expand All @@ -176,7 +208,7 @@ jobs:
}
file_put_contents(__DIR__."/composer.json", json_encode($data, JSON_UNESCAPED_SLASHES));
'
COMPOSER_ROOT_VERSION=dev-${{ env.GITHUB_SHA }} composer install --no-interaction --no-suggest
COMPOSER_ROOT_VERSION=dev-${{ env.GITHUB_SHA }} composer install --no-interaction
vendor/bin/phpunit --colors=always
cd ..
done
Expand All @@ -189,10 +221,10 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
php-version: 7.4
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, mysqli, pcre, pdo_mysql, zlib
ini-values: memory_limit=1G
tools: prestissimo, flex
tools: flex
coverage: none

- name: Adjust the Git autocrlf setting
Expand All @@ -202,7 +234,7 @@ jobs:
uses: actions/checkout@v1

- name: Install the dependencies
run: composer install --no-interaction --no-suggest --no-progress
run: composer install --no-interaction --no-progress

- name: Run the unit tests
run: vendor/bin/phpunit.bat --colors=always
Expand All @@ -215,9 +247,8 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
php-version: 7.4
extensions: json, zlib
tools: prestissimo
coverage: none

- name: Checkout
Expand All @@ -226,7 +257,7 @@ jobs:
- name: Install the dependencies
run: |
composer global require contao/monorepo-tools:dev-master
composer install --no-interaction --no-suggest
composer install --no-interaction
- name: Validate the composer.json files
run: $HOME/.composer/vendor/bin/monorepo-tools composer-json --validate --ansi
Expand All @@ -239,9 +270,8 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
php-version: 7.4
extensions: json, zlib
tools: prestissimo
coverage: none

- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions calendar-bundle/composer.json
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2 || ^8.0",
"contao/core-bundle": "self.version",
"friendsofsymfony/http-cache": "^2.4",
"patchwork/utf8": "^1.2",
Expand All @@ -33,7 +33,7 @@
"require-dev": {
"contao/manager-plugin": "^2.3.1",
"contao/test-case": "^4.0",
"phpunit/phpunit": "^8.4",
"phpunit/phpunit": "^8.5",
"symfony/http-client": "4.4.*",
"symfony/phpunit-bridge": "4.4.*"
},
Expand Down
Expand Up @@ -19,7 +19,7 @@

class ContaoCalendarExtension extends Extension
{
public function load(array $mergedConfig, ContainerBuilder $container): void
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new YamlFileLoader(
$container,
Expand Down
6 changes: 1 addition & 5 deletions calendar-bundle/src/Resources/contao/classes/Events.php
Expand Up @@ -10,8 +10,6 @@

namespace Contao;

use FOS\HttpCache\ResponseTagger;

/**
* Provide methods to get all events of a certain period from the database.
*
Expand Down Expand Up @@ -284,13 +282,11 @@ protected function addEvent($objEvents, $intStart, $intEnd, $intBegin, $intLimit
}
}

// Tag the response
// Tag the event (see #2137)
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
/** @var ResponseTagger $responseTagger */
$responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
$responseTagger->addTags(array('contao.db.tl_calendar_events.' . $objEvents->id));
$responseTagger->addTags(array('contao.db.tl_calendar.' . $objEvents->pid));
}

// Store raw data
Expand Down
Expand Up @@ -81,6 +81,13 @@ public function generate()
$this->strLink = $objTarget->getFrontendUrl();
}

// Tag the calendars (see #2137)
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
$responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
$responseTagger->addTags(array_map(static function ($id) { return 'contao.db.tl_calendar.' . $id; }, $this->cal_calendar));
}

return parent::generate();
}

Expand Down
17 changes: 7 additions & 10 deletions calendar-bundle/src/Resources/contao/modules/ModuleEventReader.php
Expand Up @@ -13,7 +13,6 @@
use Contao\CoreBundle\Exception\InternalServerErrorException;
use Contao\CoreBundle\Exception\PageNotFoundException;
use Contao\CoreBundle\Exception\RedirectResponseException;
use FOS\HttpCache\ResponseTagger;
use Patchwork\Utf8;

/**
Expand Down Expand Up @@ -243,15 +242,6 @@ protected function compile()
$objTemplate->hasDetails = false;
$objTemplate->hasTeaser = false;

// Tag the response
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
/** @var ResponseTagger $responseTagger */
$responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
$responseTagger->addTags(array('contao.db.tl_calendar_events.' . $objEvent->id));
$responseTagger->addTags(array('contao.db.tl_calendar.' . $objEvent->pid));
}

// Clean the RTE output
if ($objEvent->teaser)
{
Expand Down Expand Up @@ -407,6 +397,13 @@ protected function compile()

$this->Template->event = $objTemplate->parse();

// Tag the event (see #2137)
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
$responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
$responseTagger->addTags(array('contao.db.tl_calendar_events.' . $objEvent->id));
}

$bundles = System::getContainer()->getParameter('kernel.bundles');

// HOOK: comments extension required
Expand Down
Expand Up @@ -78,6 +78,13 @@ public function generate()
return $this->getFrontendModule($this->cal_readerModule, $this->strColumn);
}

// Tag the calendars (see #2137)
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
$responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
$responseTagger->addTags(array_map(static function ($id) { return 'contao.db.tl_calendar.' . $id; }, $this->cal_calendar));
}

return parent::generate();
}

Expand Down
2 changes: 1 addition & 1 deletion comments-bundle/composer.json
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2 || ^8.0",
"contao/core-bundle": "self.version",
"patchwork/utf8": "^1.2",
"symfony/http-kernel": "4.4.*"
Expand Down
14 changes: 11 additions & 3 deletions comments-bundle/src/Resources/contao/classes/Comments.php
Expand Up @@ -12,7 +12,6 @@

use Contao\CoreBundle\Exception\PageNotFoundException;
use Contao\CoreBundle\OptIn\OptIn;
use FOS\HttpCache\ResponseTagger;

/**
* Class Comments
Expand Down Expand Up @@ -43,10 +42,9 @@ public function addCommentsToTemplate(FrontendTemplate $objTemplate, \stdClass $

$objTemplate->comments = array(); // see #4064

// Tag the response
// Tag the source record (see #2137)
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
/** @var ResponseTagger $responseTagger */
$responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
$responseTagger->addTags(array(sprintf('contao.comments.%s.%s', $strSource, $intParent)));
}
Expand Down Expand Up @@ -102,6 +100,7 @@ public function addCommentsToTemplate(FrontendTemplate $objTemplate, \stdClass $
if ($objComments !== null && ($total = $objComments->count()) > 0)
{
$count = 0;
$tags = array();
$objPartial = new FrontendTemplate($objConfig->template ?: 'com_default');

while ($objComments->next())
Expand Down Expand Up @@ -134,8 +133,17 @@ public function addCommentsToTemplate(FrontendTemplate $objTemplate, \stdClass $
}

$arrComments[] = $objPartial->parse();
$tags[] = 'contao.db.tl_comments.' . $objComments->id;

++$count;
}

// Tag the comments (see #2137)
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
$responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
$responseTagger->addTags($tags);
}
}

$objTemplate->comments = $arrComments;
Expand Down

0 comments on commit 5eb206f

Please sign in to comment.