mirror of
https://github.com/e107inc/e107.git
synced 2025-04-13 09:01:59 +02:00
System Crons were failing. Working again.
This commit is contained in:
parent
ddb01846f6
commit
2ae50931ea
29
class2.php
29
class2.php
@ -9,9 +9,9 @@
|
||||
* General purpose file
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||
* $Revision: 1.170 $
|
||||
* $Date: 2009-12-18 20:49:54 $
|
||||
* $Author: e107steved $
|
||||
* $Revision: 1.171 $
|
||||
* $Date: 2009-12-24 09:59:20 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
//
|
||||
@ -1584,18 +1584,19 @@ function init_session()
|
||||
|
||||
define('USERIP', $e107->getip());
|
||||
|
||||
|
||||
if(isset($_E107['cli']) && $_SERVER['argv'][1])
|
||||
if(varset($_E107['cli']))
|
||||
{
|
||||
require_once(e_HANDLER.'cli_class.php');
|
||||
$cli = new eCLI;
|
||||
$arg = $cli->parse_args();
|
||||
if($arg['u'] && $arg['p'])
|
||||
{
|
||||
e107_require_once(e_HANDLER.'login.php');
|
||||
$usr = new userlogin;
|
||||
$cli_log = $usr->userlogin(trim($arg['u']), trim($arg['p']), 0);
|
||||
}
|
||||
define('USER', true);
|
||||
define('USERID', 1);
|
||||
define('USERNAME', 'e107-cli');
|
||||
define('USERTHEME', false);
|
||||
define('ADMIN', true);
|
||||
define('GUEST', false);
|
||||
define('USERCLASS', '');
|
||||
define('USEREMAIL', '');
|
||||
define('USERCLASS_LIST', '');
|
||||
define('USERCLASS', '');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($_COOKIE[e_COOKIE]) && !isset($_SESSION[e_COOKIE]) && !isset($_E107['cli']))
|
||||
|
43
cron.php
43
cron.php
@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/cron.php,v $
|
||||
| $Revision: 1.7 $
|
||||
| $Date: 2009-10-24 12:01:24 $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2009-12-24 09:59:21 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -21,11 +21,15 @@
|
||||
// Usage: [full path to this script]cron.php --u=admin --p=password // use your admin login.
|
||||
|
||||
$_E107['cli'] = TRUE;
|
||||
$_E107['debug'] = FALSE;
|
||||
$_E107['no_online'] = TRUE;
|
||||
|
||||
require_once(realpath(dirname(__FILE__)."/class2.php"));
|
||||
|
||||
$pwd = trim($_SERVER['argv'][1]);
|
||||
|
||||
$pwd = ($_E107['debug'] && $_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : trim($_SERVER['argv'][1]);
|
||||
|
||||
if($pref['e_cron_pwd'] != $pwd)
|
||||
{
|
||||
{
|
||||
require_once(e_HANDLER."mail.php");
|
||||
$message = "Your Cron Schedule is not configured correctly. Your passwords do not match.
|
||||
<br /><br />
|
||||
@ -59,21 +63,35 @@ if($pref['e_cron_pref']) // grab cron
|
||||
}
|
||||
|
||||
|
||||
if($_E107['debug'] && $_SERVER['QUERY_STRING'])
|
||||
{
|
||||
echo "<h1>Cron List</h1>";
|
||||
print_a($list);
|
||||
}
|
||||
|
||||
require_once(e_HANDLER."cron_class.php");
|
||||
|
||||
|
||||
$cron = new CronParser();
|
||||
|
||||
|
||||
foreach($list as $func=>$val)
|
||||
{
|
||||
$cron->calcLastRan($val['tab']);
|
||||
$due = $cron->getLastRanUnix();
|
||||
|
||||
if($_E107['debug'])
|
||||
{
|
||||
echo "<br />Cron: ".$val['function'];
|
||||
}
|
||||
|
||||
if($due > (time()-45))
|
||||
{
|
||||
if($_E107['debug']) { echo "<br />Running Now...<br />path: ".$val['path']; }
|
||||
|
||||
if(($val['path']=='_system') || is_readable(e_PLUGIN.$val['path']."/e_cron.php"))
|
||||
{
|
||||
if($val['path'] != '_system')
|
||||
if($val['path'] != '_system') // this is correct.
|
||||
{
|
||||
include_once(e_PLUGIN.$val['path']."/e_cron.php");
|
||||
}
|
||||
@ -85,13 +103,24 @@ foreach($list as $func=>$val)
|
||||
if(method_exists($obj,$val['function']))
|
||||
{
|
||||
// $mes->add("Executing config function <b>".$key." : ".$method_name."()</b>", E_MESSAGE_DEBUG);
|
||||
if($_E107['debug']) { echo "<br />Method Found: ".$classname."::".$val['function']."()"; }
|
||||
|
||||
$status = call_user_func(array($obj,$val['function']));
|
||||
if(!$status)
|
||||
{
|
||||
//TODO log error in admin log.
|
||||
// echo "\nerror running the function ".$func.".\n"; log the error.
|
||||
// echo "\nerror running the function ".$func.".\n"; // log the error.
|
||||
if($_E107['debug']) { echo "<br />Method returned False: ".$val['function']; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($_E107['debug']) { echo "<br />Couldn't find method: ".$val['function']; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($_E107['debug']) { echo "<br />Couldn't find class: ".$classname; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org/).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/cron.php,v $
|
||||
| $Revision: 1.24 $
|
||||
| $Date: 2009-11-27 21:42:46 $
|
||||
| $Author: e107steved $
|
||||
| $Revision: 1.25 $
|
||||
| $Date: 2009-12-24 09:59:21 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -50,7 +50,7 @@ class cron
|
||||
$this->cronAction = e_QUERY;
|
||||
|
||||
// The 'available' flag only gives the option to configure the cron if the underlying feature is enabled
|
||||
$this->coreCrons['_system_cron'] = array(
|
||||
$this->coreCrons['_system'] = array(
|
||||
0 => array('name' => 'Test Email', 'function' => 'sendEmail', 'description' => 'Send a test email to '.$pref['siteadminemail'].'<br />Recommended to test the scheduling system.'),
|
||||
1 => array('name' => 'Mail Queue', 'function' => 'procEmailQueue', 'description' => 'Process mail queue'),
|
||||
2 => array('name' => 'Mail Bounce Check', 'function' => 'procEmailBounce', 'description' => 'Check for bounced emails', 'available' => vartrue($pref['mail_bounce_auto'])),
|
||||
@ -119,7 +119,8 @@ class cron
|
||||
|
||||
$active = ($ago < 125) ? TRUE : FALSE;
|
||||
$status = ($active) ? LAN_ENABLED : LAN_DISABLED; // "Enabled" : "Offline";
|
||||
|
||||
$lastRefresh = ($ago < 10000) ? $ago.' seconds ago.' : 'Never';
|
||||
|
||||
$mes->add("Status: <b>".$status."</b>", E_MESSAGE_INFO);
|
||||
|
||||
// print_a($pref['e_cron_pref']);
|
||||
@ -134,11 +135,13 @@ class cron
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mes->add("Active Crons: <b>".count($list)."</b>", E_MESSAGE_INFO);
|
||||
$mes->add("Last cron refresh was ".$ago.' seconds ago.', E_MESSAGE_INFO);
|
||||
$mes->add("Last cron refresh: ".$lastRefresh, E_MESSAGE_INFO);
|
||||
|
||||
//FIXME: for Windows, the is_executable() function only checks the file
|
||||
// extensions of exe, com, bat and cmd.
|
||||
|
||||
if(!is_executable(e_BASE."cron.php"))
|
||||
{
|
||||
$mes->add("Please CHMOD /cron.php to 755" , E_MESSAGE_WARNING);
|
||||
|
@ -10,9 +10,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/cron_class.php,v $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2009-11-27 21:42:46 $
|
||||
| $Author: e107steved $
|
||||
| $Revision: 1.6 $
|
||||
| $Date: 2009-12-24 09:59:21 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -32,7 +32,9 @@ class _system_cron
|
||||
|
||||
function sendEmail() // Test Email.
|
||||
{
|
||||
global $pref;
|
||||
global $pref, $_E107;
|
||||
if($_E107['debug']) { echo "<br />sendEmail() executed"; }
|
||||
|
||||
require_once(e_HANDLER.'mail.php');
|
||||
$message = "Your Cron test worked correctly. Sent at ".date("r").".";
|
||||
|
||||
@ -80,7 +82,7 @@ class _system_cron
|
||||
|
||||
|
||||
|
||||
/* $Id: cron_class.php,v 1.5 2009-11-27 21:42:46 e107steved Exp $ */
|
||||
/* $Id: cron_class.php,v 1.6 2009-12-24 09:59:21 e107coders Exp $ */
|
||||
|
||||
/**####################################################################################################**\
|
||||
Version: V1.01
|
||||
|
Loading…
x
Reference in New Issue
Block a user