mirror of
https://github.com/e107inc/e107.git
synced 2025-04-22 13:41:52 +02:00
Added cron/function for updating from github. (Available only if the e107 installation is a cloned repo)
This commit is contained in:
parent
c0675ab6db
commit
f428cc8041
5
cron.php
5
cron.php
@ -35,6 +35,7 @@ require_once(realpath(dirname(__FILE__)."/class2.php"));
|
||||
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 />
|
||||
Sent from cron: ".$pwd."<br />
|
||||
@ -57,9 +58,9 @@ e107::getCache()->set('cronLastLoad',time(),TRUE,FALSE,TRUE);
|
||||
$list = array();
|
||||
|
||||
$sql = e107::getDb();
|
||||
if($sql->db_Select("cron",'cron_function,cron_tab','cron_active =1'))
|
||||
if($sql->select("cron",'cron_function,cron_tab','cron_active =1'))
|
||||
{
|
||||
while($row = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
while($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
list($class,$function) = explode("::",$row['cron_function'],2);
|
||||
$key = $class."__".$function;
|
||||
|
@ -66,7 +66,7 @@ class cron_admin_ui extends e_admin_ui
|
||||
protected $pluginName = 'core';
|
||||
protected $table = "cron";
|
||||
protected $pid = "cron_id";
|
||||
protected $listOrder = 'cron_category';
|
||||
protected $listOrder = 'cron_category desc'; // Show 'upgrades' on first page.
|
||||
protected $perPage = 10;
|
||||
protected $batchDelete = TRUE;
|
||||
|
||||
@ -108,8 +108,8 @@ class cron_admin_ui extends e_admin_ui
|
||||
$pwd = $this->setCronPwd();
|
||||
}
|
||||
|
||||
$sql->db_Select_gen("SELECT cron_function,cron_active FROM #cron ");
|
||||
while($row = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
$sql->gen("SELECT cron_function,cron_active FROM #cron ");
|
||||
while($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$this->curCrons[] = $row['cron_function'];
|
||||
if($row['cron_active']==1)
|
||||
@ -164,12 +164,28 @@ class cron_admin_ui extends e_admin_ui
|
||||
),
|
||||
6 => array(
|
||||
'name' => LAN_CRON_20_1,
|
||||
'category' => '',
|
||||
'category' => 'update',
|
||||
'function' => 'checkCoreUpdate',
|
||||
'description' => LAN_CRON_20_2 ."<br />". LAN_CRON_20_3,
|
||||
// 'available' => e107::getPref('ban_retrigger')
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
if(is_dir(e_BASE.".git"))
|
||||
{
|
||||
$cronDefaults['_system'][7] = array(
|
||||
'name' => "Update this Git repository", //TODO LAN
|
||||
'category' => 'update',
|
||||
'function' => 'gitrepo',
|
||||
'description' => "Update this e107 installation with the very latest files from github.<br />Recommended for developers only.<br /><span class='label label-warning'>Warning!</span> May cause site instability!", //TODO LAN
|
||||
// 'available' => e107::getPref('ban_retrigger')
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(!vartrue($_GET['action']) || $_GET['action'] == 'refresh')
|
||||
{
|
||||
@ -260,7 +276,7 @@ class cron_admin_ui extends e_admin_ui
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$sql->db_Insert('cron',$insert))
|
||||
if(!$sql->insert('cron',$insert))
|
||||
{
|
||||
e107::getMessage()->add(LAN_CRON_6, E_MESSAGE_ERROR);
|
||||
}
|
||||
@ -285,7 +301,7 @@ class cron_admin_ui extends e_admin_ui
|
||||
$cron_function = $insert['cron_function'];
|
||||
unset($insert['cron_function']);
|
||||
|
||||
if($sql->db_Update('cron',$insert)===FALSE)
|
||||
if($sql->update('cron',$insert)===FALSE)
|
||||
{
|
||||
e107::getMessage()->add(LAN_CRON_7, E_MESSAGE_ERROR);
|
||||
}
|
||||
@ -475,7 +491,8 @@ class cron_admin_form_ui extends e_admin_form_ui
|
||||
'mail' => ADLAN_136,
|
||||
'notify' => ADLAN_149,
|
||||
'user' => LAN_USER,
|
||||
'plugin' => ADLAN_CL_7
|
||||
'plugin' => ADLAN_CL_7,
|
||||
'update' => LAN_UPDATE
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,37 @@ class _system_cron
|
||||
// Whatever code you wish.
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the current Repo. of this e107 installation. (eg. e107 on github)
|
||||
*/
|
||||
function gitrepo()
|
||||
{
|
||||
$mes = e107::getMessage();
|
||||
|
||||
if(is_dir(e_BASE.".git")) // Check it's a Git Repo
|
||||
{
|
||||
|
||||
// Change Dir.
|
||||
$cmd = 'cd '.e_ROOT;
|
||||
$mes->addDebug($cmd);
|
||||
$text .= `$cmd 2>&1`;
|
||||
|
||||
// Run Pull request
|
||||
$cmd = 'git pull';
|
||||
$mes->addDebug($cmd);
|
||||
$text .= `$cmd 2>&1`;
|
||||
|
||||
$return = print_a($text,true);
|
||||
$mes->addSuccess($return);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->addError("No git repo found"); //TODO LAN
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Burnsy - This is just a test
|
||||
*
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
|
||||
$mes = e107::getMessage();
|
||||
$mes->setTitle(LAN_STATUS, 'info');
|
||||
echo $mes->render('default','info',false);
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user