Skip to content

Commit

Permalink
1.4.1: Fixes support for configuration values
Browse files Browse the repository at this point in the history
Use combined config. This supersedes previous advice about duplicating config values for v1 / v2 and just makes it nicer for in general
  • Loading branch information
daftspunk committed Apr 18, 2021
1 parent 3d53f92 commit 1ca6f68
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion classes/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,8 @@ public static function buildMenuTree($theme)
$iterator($pageList->getPageTree(), null, 0);

self::$menuTreeCache = $menuTree;
$expiresAt = now()->addMinutes(Config::get('cms.template_cache_ttl', 10));
$comboConfig = Config::get('cms.parsedPageCacheTTL', Config::get('cms.template_cache_ttl', 10));
$expiresAt = now()->addMinutes($comboConfig);
Cache::put($key, serialize($menuTree), $expiresAt);

return self::$menuTreeCache;
Expand Down
5 changes: 3 additions & 2 deletions classes/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function loadUrlMap()
{
$key = $this->getCacheKey('static-page-url-map');

$cacheable = Config::get('cms.enable_route_cache');
$cacheable = Config::get('cms.enableRoutesCache', Config::get('cms.enable_route_cache', false));
$cached = $cacheable ? Cache::get($key, false) : false;

if (!$cached || ($unserialized = @unserialize($cached)) === false) {
Expand Down Expand Up @@ -132,7 +132,8 @@ protected function loadUrlMap()
self::$urlMap = $map;

if ($cacheable) {
$expiresAt = now()->addMinutes(Config::get('cms.url_cache_ttl', 10));
$comboConfig = Config::get('cms.urlCacheTtl', Config::get('cms.url_cache_ttl', 10));
$expiresAt = now()->addMinutes($comboConfig);
Cache::put($key, serialize($map), $expiresAt);
}

Expand Down
3 changes: 2 additions & 1 deletion classes/Snippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,8 @@ protected static function extractSnippetsFromMarkupCached($theme, $pageName, $ma
}

$cached[$pageName] = $map;
$expiresAt = now()->addMinutes(Config::get('cms.template_cache_ttl', 10));
$comboConfig = Config::get('cms.parsedPageCacheTTL', Config::get('cms.template_cache_ttl', 10));
$expiresAt = now()->addMinutes($comboConfig);
Cache::put($key, serialize($cached), $expiresAt);
}

Expand Down
3 changes: 2 additions & 1 deletion classes/SnippetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ public function getPartialSnippetMap($theme)
$result[$snippetCode] = $partial->getFileName();
}

$expiresAt = now()->addMinutes(Config::get('cms.template_cache_ttl', 10));
$comboConfig = Config::get('cms.parsedPageCacheTTL', Config::get('cms.template_cache_ttl', 10));
$expiresAt = now()->addMinutes($comboConfig);
Cache::put($key, serialize($result), $expiresAt);

return $result;
Expand Down
6 changes: 4 additions & 2 deletions controllers/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,8 @@ protected function fillObjectFromPost($type)
if ($type == 'page') {
$placeholders = array_get($saveData, 'placeholders');

if (is_array($placeholders) && Config::get('system.convert_line_endings', false) === true) {
$comboConfig = Config::get('cms.convertLineEndings', Config::get('system.convert_line_endings', false));
if (is_array($placeholders) && $comboConfig === true) {
$placeholders = array_map([$this, 'convertLineEndings'], $placeholders);
}

Expand Down Expand Up @@ -793,7 +794,8 @@ protected function fillObjectFromPost($type)
}
}

if (!empty($objectData['markup']) && Config::get('system.convert_line_endings', false) === true) {
$comboConfig = Config::get('cms.convertLineEndings', Config::get('system.convert_line_endings', false));
if (!empty($objectData['markup']) && $comboConfig === true) {
$objectData['markup'] = $this->convertLineEndings($objectData['markup']);
}

Expand Down
3 changes: 2 additions & 1 deletion updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@
1.3.5: Minor fix to bust the browser cache for JS assets. Prevent duplicate property fields in snippet inspector.
1.3.6: ChildPages component now displays localized page titles from Translate plugin.
1.3.7: Adds MenuPicker formwidget. Adds future support for v2.0 of October CMS.
1.4.0: Fixes bug when adding menu items in October CMS v2.0. File based config keys have changed, please read the release note on GitHub for more information.
1.4.0: Fixes bug when adding menu items in October CMS v2.0.
1.4.1: Fixes support for configuration values.

0 comments on commit 1ca6f68

Please sign in to comment.