diff options
-rw-r--r-- | _css/css.php | 1 | ||||
-rw-r--r-- | _css/js.php | 1 | ||||
-rw-r--r-- | engine/lib/elgglib.php | 2 | ||||
-rw-r--r-- | engine/start.php | 18 | ||||
-rw-r--r-- | simplecache/view.php | 4 | ||||
-rw-r--r-- | views/default/page_elements/header.php | 6 |
6 files changed, 26 insertions, 6 deletions
diff --git a/_css/css.php b/_css/css.php index df681bcb2..a6eebee20 100644 --- a/_css/css.php +++ b/_css/css.php @@ -28,6 +28,7 @@ global $viewinput;
$viewinput['view'] = 'css';
+ $viewinput['viewtype'] = $_GET['viewtype'];
header("Content-type: text/css", true);
header('Expires: ' . date('r',time() + 864000), true);
diff --git a/_css/js.php b/_css/js.php index 99c786e01..a90c87829 100644 --- a/_css/js.php +++ b/_css/js.php @@ -28,6 +28,7 @@ global $viewinput;
$viewinput['view'] = 'js/' . $_GET['js'];
+ $viewinput['viewtype'] = $_GET['viewtype'];
header('Content-type: text/javascript');
header('Expires: ' . date('r',time() + 864000));
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 40a248d8f..7defc779f 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -440,7 +440,7 @@ if (!empty($CONFIG->views->simplecache) && is_array($CONFIG->views->simplecache)) {
foreach($CONFIG->views->simplecache as $view) {
$viewcontents = elgg_view($view);
- $viewname = md5($view);
+ $viewname = md5(elgg_get_viewtype() . $view);
if ($handle = fopen($CONFIG->dataroot . 'views_simplecache/' . $viewname, 'w')) {
fwrite($handle, $viewcontents);
fclose($handle);
diff --git a/engine/start.php b/engine/start.php index 067e6c9b0..2960c938c 100644 --- a/engine/start.php +++ b/engine/start.php @@ -134,6 +134,9 @@ $files = get_library_files(dirname(__FILE__) . "/lib",$file_exceptions);
asort($files);
+
+ // Get config
+ global $CONFIG;
// Include them
foreach($files as $file) {
@@ -190,6 +193,19 @@ // System booted, return to normal view
set_input('view', $oldview);
+ if (empty($oldview)) {
+ if (empty($CONFIG->view))
+ $oldview = 'default';
+ else
+ $oldview = $CONFIG->view;
+ }
+
+ $lastcached = datalist_get('simplecache_'.$oldview);
+ if ($lastcached < (time() - (86400 * 7))) {
+ elgg_view_regenerate_simplecache();
+ $lastcached = time();
+ datalist_set('simplecache_'.$oldview,$lastcached);
+ }
+ $CONFIG->lastcache = $lastcached;
- run_function_once('elgg_view_regenerate_simplecache',time() - (86400 * 7));
?>
\ No newline at end of file diff --git a/simplecache/view.php b/simplecache/view.php index b7e4e7fe5..475ad22b6 100644 --- a/simplecache/view.php +++ b/simplecache/view.php @@ -23,6 +23,8 @@ if ($dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpass)) {
$view = $viewinput['view'];
+ $viewtype = $viewinput['viewtype'];
+ if (empty($viewtype)) $viewtype = 'default';
// Get the dataroot
if (@mysql_select_db($CONFIG->dbname,$dblink)) {
@@ -30,7 +32,7 @@ $row = mysql_fetch_object($result);
$dataroot = $row->value;
}
- $filename = $dataroot . 'views_simplecache/' . md5($view);
+ $filename = $dataroot . 'views_simplecache/' . md5($viewtype . $view);
if (file_exists($filename))
$contents = @file_get_contents($filename);
else {
diff --git a/views/default/page_elements/header.php b/views/default/page_elements/header.php index 627e4b87a..985db2760 100644 --- a/views/default/page_elements/header.php +++ b/views/default/page_elements/header.php @@ -62,19 +62,19 @@ END; <script type="text/javascript" src="<?php echo $vars['url']; ?>vendors/jquery/jquery-1.2.6.pack.js"></script> <script type="text/javascript" src="<?php echo $vars['url']; ?>vendors/jquery/jquery-ui-personalized-1.5.3.packed.js"></script> - <script type="text/javascript" src="<?php echo $vars['url']; ?>_css/js.php?js=initialise_elgg"></script> + <script type="text/javascript" src="<?php echo $vars['url']; ?>_css/js.php/<?php echo $vars['config']->lastcache; ?>?js=initialise_elgg&viewtype=<?php echo $vars['view']; ?>"></script> <?php global $pickerinuse; if (isset($pickerinuse) && $pickerinuse == true) { ?> <!-- only needed on pages where we have friends collections and/or the friends picker --> <script type="text/javascript" src="<?php echo $vars['url']; ?>vendors/jquery/jquery.easing.1.3.packed.js"></script> - <script type="text/javascript" src="<?php echo $vars['url']; ?>_css/js.php?js=friendsPickerv1"></script> + <script type="text/javascript" src="<?php echo $vars['url']; ?>_css/js.php/<?php echo $vars['config']->lastcache; ?>?js=friendsPickerv1&viewtype=<?php echo $vars['view']; ?>"></script> <?php } ?> <!-- include the default css file --> - <link rel="stylesheet" href="<?php echo $vars['url']; ?>_css/css.css" type="text/css" /> + <link rel="stylesheet" href="<?php echo $vars['url']; ?>_css/css.css?lastcache=<?php echo $vars['config']->lastcache; ?>&viewtype=<?php echo $vars['view']; ?>" type="text/css" /> <?php echo $feedref; echo elgg_view('metatags',$vars); |