aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/application.php25
1 files changed, 13 insertions, 12 deletions
diff --git a/core/application.php b/core/application.php
index 280a8e7..5d2b1f4 100644
--- a/core/application.php
+++ b/core/application.php
@@ -167,22 +167,23 @@ if(Application::get('MIGRATOR.ENABLED')) {
#===============================================================================
# Check if "304 Not Modified" and ETag header should be sent
#===============================================================================
-if(Application::get('CORE.SEND_304') === TRUE AND !defined('ADMINISTRATION')) {
+if(Application::get('CORE.SEND_304') AND !defined('ADMINISTRATION')) {
#===========================================================================
- # Select edit time from last edited items (page, post, user)
+ # Fetch timestamps of the last modified entities
#===========================================================================
- $execute = '(SELECT time_update FROM %s ORDER BY time_update DESC LIMIT 1) AS %s';
-
- $pageTable = ORM\Repositories\Page::getTableName();
- $postTable = ORM\Repositories\Post::getTableName();
- $userTable = ORM\Repositories\User::getTableName();
-
- $pageSQL = sprintf($execute, $pageTable, $pageTable);
- $postSQL = sprintf($execute, $postTable, $postTable);
- $userSQL = sprintf($execute, $postTable, $postTable);
+ $query = '(SELECT time_update FROM %s ORDER BY time_update DESC LIMIT 1) AS %s';
+
+ foreach([
+ ORM\Repositories\Category::getTableName(),
+ ORM\Repositories\Page::getTableName(),
+ ORM\Repositories\Post::getTableName(),
+ ORM\Repositories\User::getTableName()
+ ] as $table) {
+ $parts[] = sprintf($query, $table, $table);
+ }
- $Statement = $Database->query("SELECT {$pageSQL}, {$postSQL}, {$userSQL}");
+ $Statement = $Database->query('SELECT '.implode(',', $parts));
#===========================================================================
# Define HTTP ETag header identifier