Skip to content

Commit

Permalink
Merge pull request #5047 in SW/shopware from sw-18961/5.3/set-cache-r…
Browse files Browse the repository at this point in the history
…oute to 5.3

* commit 'e3364ed683e6358ac0850897f6b0db71ea8f1562':
  SW-18961 - Add new http cache route entry for frontend listing layout calls
  • Loading branch information
janbuecker committed Jun 7, 2017
2 parents 21628a5 + e3364ed commit cde74c4
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions _sql/migrations/935-add-listing-layout-config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/**
* Shopware 5
* Copyright (c) shopware AG
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
* permission and of our proprietary license can be found at and
* in the LICENSE file you have received along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* "Shopware" is a registered trademark of shopware AG.
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore any rights, title and interest in
* our trademarks remain entirely with us.
*/

use Shopware\Components\Migrations\AbstractMigration;

class Migrations_Migration935 extends AbstractMigration
{
/**
* {@inheritdoc}
*/
public function up($modus)
{
$tags = implode("\n", [
'frontend/listing 3600',
'frontend/index 3600',
'frontend/detail 3600',
'frontend/campaign 14400',
'widgets/listing 14400',
'frontend/custom 14400',
'frontend/sitemap 14400',
'frontend/blog 14400',
'widgets/index 3600',
'widgets/checkout 3600',
'widgets/compare 3600',
'widgets/emotion 14400',
'widgets/recommendation 14400',
'widgets/lastArticles 3600',
'widgets/campaign 3600',
'frontend/listing/layout 0',
]);

$this->addSql(sprintf(
"UPDATE `s_core_config_elements` SET `value` = '%s' WHERE `name` = 'cacheControllers'",
serialize($tags)
));

if ($modus == self::MODUS_INSTALL) {
return;
}

$values = $this->connection->query("SELECT v.id, v.value FROM s_core_config_values v INNER JOIN s_core_config_elements e ON e.id = v.element_id WHERE e.name = 'cacheControllers'")
->fetchAll(PDO::FETCH_ASSOC);

foreach ($values as $row) {
$value = unserialize($row['value']);
$value = explode("\n", $value);
$value[] = 'frontend/listing/layout 0';
$value = implode("\n", $value);
$value = serialize($value);

$sql = sprintf("UPDATE `s_core_config_values` SET `value` = '%s' WHERE id = " . (int) $row['id'], $value);
$this->addSql($sql);
}
}
}

0 comments on commit cde74c4

Please sign in to comment.