aboutsummaryrefslogtreecommitdiff
path: root/simplecache
diff options
context:
space:
mode:
Diffstat (limited to 'simplecache')
-rw-r--r--simplecache/view.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/simplecache/view.php b/simplecache/view.php
index f04ca0118..67c310d87 100644
--- a/simplecache/view.php
+++ b/simplecache/view.php
@@ -14,10 +14,11 @@ require_once(dirname(dirname(__FILE__)). '/engine/settings.php');
global $CONFIG, $viewinput, $override;
if (!isset($override)) {
- $override = false;
+ $override = FALSE;
}
$contents = '';
+
if (!isset($viewinput)) {
$viewinput = $_GET;
}
@@ -51,21 +52,22 @@ if ($mysql_dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpa
$filename = $dataroot . 'views_simplecache/' . md5($viewtype . $view_name);
if (file_exists($filename)) {
$contents = file_get_contents($filename);
- header("Content-Length: " . strlen($contents));
} else {
mysql_query("INSERT into {$CONFIG->dbprefix}datalists set name = 'simplecache_lastupdate_$viewtype', value = '0' ON DUPLICATE KEY UPDATE value='0'");
-
- echo ''; exit;
}
- } else {
- mysql_close($mysql_dblink);
- require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
- $contents = elgg_view($view_name);
- header("Content-Length: " . strlen($contents));
}
}
}
+// load full engine if simplecache is disabled, overriden, or invalid
+if (!$contents) {
+ mysql_close($mysql_dblink);
+ require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
+ $contents = elgg_view($view);
+}
+
+header("Content-Length: " . strlen($contents));
+
$split_output = str_split($contents, 1024);
foreach($split_output as $chunk) {