add forum cache toggle

This commit is contained in:
flash 2017-03-24 18:10:44 +01:00
parent 3d1e3d742a
commit 7afdc09dd3
3 changed files with 12 additions and 3 deletions

View file

@ -132,9 +132,15 @@ class Post
$this->update(); $this->update();
} }
if (strlen($this->parsed) < 1) { $post_parsed = strlen($this->parsed) > 0;
$cache_enabled = config('performance.forum_cache');
if (!$cache_enabled || !$post_parsed) {
$this->parsed = BBParser::toHTML(htmlentities($this->text), $this->poster); $this->parsed = BBParser::toHTML(htmlentities($this->text), $this->poster);
$this->update();
if ($cache_enabled) {
$this->update();
}
} }
} }
} }

View file

@ -70,6 +70,9 @@ cache_dir = store/cache/
; Enable template caching ; Enable template caching
template_cache = true template_cache = true
; Enable forum caching
forum_cache = true
; Development specific settings ; Development specific settings
[dev] [dev]
; Show detailed error logs in browser ; Show detailed error logs in browser

View file

@ -7,7 +7,7 @@
{% endblock %} {% endblock %}
{% block settingsContent %} {% block settingsContent %}
<div class="bbcode" id="settingsPreview" style="max-height: 500px; overflow-y: auto; background: #C2AEEE; box-shadow: inset 0 0 1em 1em #D3BFFF;">{{ user.userPage()|raw|nl2br }}</div> <div class="bbcode" id="settingsPreview" style="max-height: 500px; overflow-y: auto; background: #C2AEEE; box-shadow: inset 0 0 1em 1em #D3BFFF;">{{ user.userPage()|raw }}</div>
<hr> <hr>
<form enctype="multipart/form-data" method="post" action="javascript:;" onsubmit="updateSettings(this, '{{ route('settings.account.userpage') }}');"> <form enctype="multipart/form-data" method="post" action="javascript:;" onsubmit="updateSettings(this, '{{ route('settings.account.userpage') }}');">
<input type="hidden" name="session" value="{{ session_id() }}"> <input type="hidden" name="session" value="{{ session_id() }}">