1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

Experimental News-cache timeout pref added.

This commit is contained in:
Cameron
2017-01-09 13:09:52 -08:00
parent 7f93e59d90
commit af92191e37
2 changed files with 22 additions and 6 deletions

View File

@@ -857,6 +857,7 @@ class news_admin_ui extends e_admin_ui
$temp['news_default_template'] = preg_replace('#[^\w\pL\-]#u', '', $_POST['news_default_template']); $temp['news_default_template'] = preg_replace('#[^\w\pL\-]#u', '', $_POST['news_default_template']);
$temp['news_list_limit'] = intval($_POST['news_list_limit']); $temp['news_list_limit'] = intval($_POST['news_list_limit']);
$temp['news_list_templates'] = e107::getParser()->toDB($_POST['news_list_templates']); $temp['news_list_templates'] = e107::getParser()->toDB($_POST['news_list_templates']);
$temp['news_cache_timeout'] = intval($_POST['news_cache_timeout']);
e107::getConfig()->updatePref($temp); e107::getConfig()->updatePref($temp);
@@ -1141,7 +1142,20 @@ class news_admin_ui extends e_admin_ui
".$frm->textarea('news_ping_services', $pingVal, 4, 100, $pingOpt)." ".$frm->textarea('news_ping_services', $pingVal, 4, 100, $pingOpt)."
<div class='field-help'>".LAN_NEWS_89."<br />".LAN_NEWS_90."</div> <div class='field-help'>".LAN_NEWS_89."<br />".LAN_NEWS_90."</div>
</td> </td>
</tr> </tr>";
// TODO LAN
$tab1 .= "
<tr>
<td>News Cache Timeout </td>
<td>
".$frm->number('news_cache_timeout',varset($pref['news_cache_timeout'],0), 6)."
<div class='field-help'>Time in minutes. Applies only when system cache is enabled.</div>
</td>
</tr>";
$tab1 .= "
<tr> <tr>
<td>".NWSLAN_86."</td> <td>".NWSLAN_86."</td>

View File

@@ -33,6 +33,7 @@ class news_front
private $text = null; private $text = null;
private $pref = array(); private $pref = array();
private $debugInfo = array(); private $debugInfo = array();
private $cacheRefreshTime = false;
// private $interval = 1; // private $interval = 1;
function __construct() function __construct()
@@ -44,6 +45,7 @@ class news_front
$this->pref = e107::getPref(); $this->pref = e107::getPref();
$this->cacheRefreshTime = vartrue($this->pref['news_cache_timeout'],false);
// $this->interval = $this->pref['newsposts']-$this>pref['newsposts_archive']; // $this->interval = $this->pref['newsposts']-$this>pref['newsposts_archive'];
require_once(e_HANDLER."news_class.php"); require_once(e_HANDLER."news_class.php");
@@ -258,9 +260,9 @@ class news_front
echo "<h4>News Debug Info</h4>"; echo "<h4>News Debug Info</h4>";
echo "<b>action:</b> ".$this->action." "; echo "<b>action:</b> ".$this->action." ";
echo "<br /><b>subaction:</b> ".$this->subAction." "; echo "<br /><b>subaction:</b> ".$this->subAction." ";
echo "<br /><b>route</b> ".$this->route." "; echo "<br /><b>route:</b> ".$this->route." ";
echo "<br /><b>e_QUERY:</b> ".e_QUERY." "; echo "<br /><b>e_QUERY:</b> ".e_QUERY." ";
echo "<br /><b>CacheTimeout:</b> ".$this->cacheRefreshTime." ";
echo "<br /><b>_GET:</b> ".print_r($_GET,true); echo "<br /><b>_GET:</b> ".print_r($_GET,true);
foreach($this->debugInfo as $key=>$val) foreach($this->debugInfo as $key=>$val)
@@ -520,9 +522,9 @@ class news_front
$this->addDebug("checkCache", 'true'); $this->addDebug("checkCache", 'true');
$e107cache->setMD5(null); $e107cache->setMD5(null);
$cache_data = $e107cache->retrieve($cacheString); $cache_data = $e107cache->retrieve($cacheString, $this->cacheRefreshTime);
$cache_title = $e107cache->retrieve($cacheString."_title"); $cache_title = $e107cache->retrieve($cacheString."_title", $this->cacheRefreshTime);
$cache_diz = $e107cache->retrieve($cacheString."_diz"); $cache_diz = $e107cache->retrieve($cacheString."_diz", $this->cacheRefreshTime);
$etitle = ($cache_title != "e_PAGETITLE") ? $cache_title : ""; $etitle = ($cache_title != "e_PAGETITLE") ? $cache_title : "";
$ediz = ($cache_diz != "META_DESCRIPTION") ? $cache_diz : ""; $ediz = ($cache_diz != "META_DESCRIPTION") ? $cache_diz : "";