1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-14 01:22:13 +02:00

More cron work.

This commit is contained in:
CaMer0n 2009-10-24 10:07:30 +00:00
parent c8daa0efcd
commit fdc7e579ed
3 changed files with 65 additions and 21 deletions

View File

@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/cron.php,v $
| $Revision: 1.5 $
| $Date: 2009-10-23 14:16:07 $
| $Revision: 1.6 $
| $Date: 2009-10-24 10:07:30 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@ -38,6 +38,11 @@ require_once(realpath(dirname(__FILE__)."/class2.php"));
exit;
}
e107::getCache()->CachePageMD5 = '_';
e107::getCache()->set('cronLastLoad',time(),TRUE,FALSE,TRUE);
// from the plugin directory:
// realpath(dirname(__FILE__)."/../../")."/";

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/cron.php,v $
| $Revision: 1.6 $
| $Date: 2009-10-23 14:16:07 $
| $Revision: 1.7 $
| $Date: 2009-10-24 10:07:30 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@ -44,8 +44,11 @@ class cron
function cron()
{
global $pref;
$mes = $mes = e107::getMessage();
$this->cronAction = e_QUERY;
$this->lastRefresh();
if(isset($_POST['submit']))
{
@ -88,12 +91,49 @@ class cron
$this -> cronRenderPrefs();
}
}
function lastRefresh()
{
e107::getCache()->CachePageMD5 = '_';
$lastload = e107::getCache()->retrieve('cronLastLoad',FALSE,TRUE,TRUE);
$mes = e107::getMessage();
$ago = (time() - $lastload);
$active = ($ago < 125) ? TRUE : FALSE;
$status = ($active) ? "Enabled" : "Offline";
$mes->add("Status: <b>".$status."</b>", E_MESSAGE_INFO);
if($pref['e_cron_pref']) // grab cron
{
foreach($pref['e_cron_pref'] as $func=>$cron)
{
if($cron['active']==1)
{
$list[$func] = $cron;
}
}
}
$mes->add("Active Crons: <b>".count($list)."</b>", E_MESSAGE_INFO);
$mes->add("Last cron refresh was ".$ago.' seconds ago.', E_MESSAGE_INFO);
if(!$active)
{
$setpwd_message = "Use the following Cron Command:<br /><b style='color:black'>".$_SERVER['DOCUMENT_ROOT'].e_HTTP."cron.php ".$pref['e_cron_pwd']."</b><br />
This cron command is unique and will not be displayed again. Please copy and paste it into your webserver cron area to be run every minute of every day.";
$mes->add($setpwd_message, E_MESSAGE_INFO);
}
}
function cronExecute($class_func)
{
//TODO LANs
$mes = eMessage::getInstance();
$mes = e107::getMessage();
if(!function_exists($func) || !call_user_func($func))
{
$mes->add("Error running ".$func."()", E_MESSAGE_ERROR);
@ -452,7 +492,6 @@ class cron
</form>
</div>";
$mes = e107::getMessage();
$ns -> tablerender(PAGE_NAME, $mes->render() . $text);
}

View File

@ -9,9 +9,9 @@
* Cache handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/cache_handler.php,v $
* $Revision: 1.14 $
* $Date: 2009-09-25 20:17:34 $
* $Author: secretr $
* $Revision: 1.15 $
* $Date: 2009-10-24 10:07:30 $
* $Author: e107coders $
*/
if (!defined('e107_INIT')) { exit; }
@ -23,8 +23,8 @@ define('CACHE_PREFIX','<?php exit;');
*
* @package e107
* @category e107_handlers
* @version $Revision: 1.14 $
* @author $Author: secretr $
* @version $Revision: 1.15 $
* @author $Author: e107coders $
*/
class ecache {
@ -155,15 +155,15 @@ class ecache {
/**
* @return void
* @param string $CacheTag - name of tag for future retrieval
* @param string $Data - data to be cached
* @param bool $ForceCache (optional, default false) - if TRUE, writes cache even when disabled
* @param bool $bRaw (optional, default false) - if TRUE, writes data exactly as provided instead of prefacing with php leadin
* @desc Creates / overwrites the cache file for $query, $text is the data to store for $query.
* @scope public
*/
function set($CacheTag, $Data, $ForceCache = false, $bRaw=0, $syscache = false)
*
* @param string $CacheTag - name of tag for future retrieval
* @param data $Data - data to be cached
* @param boolean $ForceCache [optional] if TRUE, writes cache even when disabled
* @param boolean $bRaw [optional] if TRUE, writes data exactly as provided instead of prefacing with php leadin
* @param boolean $syscache [optional]
* @return
*/
public function set($CacheTag, $Data, $ForceCache = false, $bRaw=0, $syscache = false)
{
global $pref, $FILES_DIRECTORY, $tp;
if(($ForceCache != false ) || ($syscache == false && varsettrue($pref['cachestatus'])) || ($syscache == true && varsettrue($pref['syscachestatus'])) && !$tp->checkHighlighting())