diff --git a/class2.php b/class2.php
index e5973d1af..0d839c9e8 100644
--- a/class2.php
+++ b/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']))
diff --git a/cron.php b/cron.php
index 10192f131..aac0b9ee7 100644
--- a/cron.php
+++ b/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.
@@ -59,21 +63,35 @@ if($pref['e_cron_pref']) // grab cron
}
+if($_E107['debug'] && $_SERVER['QUERY_STRING'])
+{
+ echo "
Cron List
";
+ 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 "
Cron: ".$val['function'];
+ }
+
if($due > (time()-45))
{
+ if($_E107['debug']) { echo "
Running Now...
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 ".$key." : ".$method_name."()", E_MESSAGE_DEBUG);
+ if($_E107['debug']) { echo "
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 "
Method returned False: ".$val['function']; }
}
}
+ else
+ {
+ if($_E107['debug']) { echo "
Couldn't find method: ".$val['function']; }
+ }
+ }
+ else
+ {
+ if($_E107['debug']) { echo "
Couldn't find class: ".$classname; }
}
}
diff --git a/e107_admin/cron.php b/e107_admin/cron.php
index 4b69cef94..add8b27ea 100644
--- a/e107_admin/cron.php
+++ b/e107_admin/cron.php
@@ -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'].'
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: ".$status."", E_MESSAGE_INFO);
// print_a($pref['e_cron_pref']);
@@ -134,11 +135,13 @@ class cron
}
}
}
+
$mes->add("Active Crons: ".count($list)."", 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);
diff --git a/e107_handlers/cron_class.php b/e107_handlers/cron_class.php
index 1dfba8810..2146cda29 100644
--- a/e107_handlers/cron_class.php
+++ b/e107_handlers/cron_class.php
@@ -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 "
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