Skip to content

Commit

Permalink
Convert to 2.0 configuration values
Browse files Browse the repository at this point in the history
Note for v1.0 versions: If you use non defaults for these items, you will need to add to duplicate them to use snake_case in your config files, and create a system.php config file.

cms.parsedPageCacheTTL -> cms.template_cache_ttl
cms.enableRoutesCache -> cms.enable_route_cache
cms.urlCacheTtl -> cms.url_cache_ttl
cms.convertLineEndings -> system.convert_line_endings
  • Loading branch information
daftspunk committed Apr 17, 2021
1 parent df3f060 commit 74c7bda
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions classes/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,14 @@ public function delete()
foreach ($this->getChildren() as $subPage) {
$result = array_merge($result, $subPage->delete());
}

/*
* Delete the object
*/
$result = array_merge($result, [$this->getBaseFileName()]);

parent::delete();

/*
* Remove from meta
*/
Expand Down Expand Up @@ -906,7 +906,7 @@ public static function buildMenuTree($theme)
$iterator($pageList->getPageTree(), null, 0);

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

return self::$menuTreeCache;
Expand Down
4 changes: 2 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.enableRoutesCache');
$cacheable = Config::get('cms.enable_route_cache');
$cached = $cacheable ? Cache::get($key, false) : false;

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

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

Expand Down
4 changes: 2 additions & 2 deletions classes/Snippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public static function processPageMarkup($pageName, $theme, $markup)
public static function processTemplateSettingsArray($settingsArray)
{
if (
!isset($settingsArray['viewBag']['snippetProperties']['TableData']) &&
!isset($settingsArray['viewBag']['snippetProperties']['TableData']) &&
!isset($settingsArray['viewBag']['snippetProperties']) // CMS Editor
) {
return $settingsArray;
Expand Down Expand Up @@ -645,7 +645,7 @@ protected static function extractSnippetsFromMarkupCached($theme, $pageName, $ma
}

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

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

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

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

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

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

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

Expand Down
5 changes: 4 additions & 1 deletion formwidgets/menuitems/partials/_menuitems.htm
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?php
$mediaPath = Config::get('cms.storage.media.path', Config::get('system.storage.media.path', '/storage/app/media'));
?>
<div
class="layout-absolute"
data-control="menu-item-editor"
data-alias="<?= $this->alias ?>"
data-item-properties="<?= e($itemProperties) ?>"
data-storage-media-path="<?= url(Config::get('cms.storage.media.path')); ?>"
data-storage-media-path="<?= Url::to($mediaPath) ?>"
>
<div class="control-scrollbar" data-control="scrollbar">
<div class="control-treeview treeview-light"
Expand Down

0 comments on commit 74c7bda

Please sign in to comment.