1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-29 10:38:08 +01:00

Issues Addressed:

Created cron task that will check if there is a newer version of e107 available. If so, email site admin, create log entry and trigger message for site admin

Files altered:
e107_admin\cron.php
e107_handlers\cron_class.php
e107_languages\English\admin\lan_cron.php

Related to:
20cb65f539
This commit is contained in:
jburns131 2013-05-12 02:16:03 -04:00
parent 27fceb8758
commit 595efb141f
3 changed files with 95 additions and 2 deletions

View File

@ -155,6 +155,20 @@ class cron_admin_ui extends e_admin_ui
'description' => LAN_CRON_05_2 .' '.e_SYSTEM.'backups/'
// 'available' => e107::getPref('ban_retrigger')
),
5 => array(
'name' => LAN_CRON_06_1,
'category' => 'user',
'function' => 'procBanRetrigger',
'description' => LAN_CRON_06_2 ."<br />". LAN_CRON_06_3,
// 'available' => e107::getPref('ban_retrigger')
),
6 => array(
'name' => LAN_CRON_20_1,
'category' => '',
'function' => 'checkCoreUpdate',
'description' => LAN_CRON_20_2 ."<br />". LAN_CRON_20_3,
// 'available' => e107::getPref('ban_retrigger')
),
);
if(!vartrue($_GET['action']) || $_GET['action'] == 'refresh')

View File

@ -34,9 +34,83 @@ class _system_cron
* Burnsy - This is just a test
*
*/
function checkForUpate ()
function checkCoreUpdate () // Check if there is an e107 Core update and email Site Admin if so
{
// Do something
// Check if there's a core e107 update available
// Get site version
if (is_readable(e_ADMIN."ver.php"))
{
include (e_ADMIN."ver.php"); // $e107info['e107_version'];
}
else
{
// Find alternate way to get local site version or throw an error
}
// Check for updates for currently installed version
$localVersion = (int) $e107info['e107_version'];
switch ($localVersion) {
case 0:
// Local version is <= 0.7
// Run update routine for 0.x
break;
case 1:
// Local version is == 1.x
// Run update routine for 1.x
break;
case 2:
// Local version is == 2.x
// Run update routine for 2.x
// Get newest available release version
$xml = e107::getXml();
$file = "http://e107.org/releases.php?mode=2";
$xdata = $xml->loadXMLfile($file,true,false);
// Check for update
if ($e107info['e107_version'] < $xdata['core']['@attributes']['version'])
{
// If there is a new version of e107 available, notify Site Admin by email, make a log entry, and notify Admin in Admin Area, $versionTest = false
$pref = e107::getPref();
require_once(e_HANDLER.'mail.php');
$message = "There is a new version of e107 available. Please visit http://www.e107.org for further details.";
sendemail($pref['siteadminemail'], "e107 - Update(s) Available For " . $pref['sitename'], $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']);
// Add entry to the log
e107::getAdminLog()->add("Update(s) Available", "There is a new version of e107 available. Please visit http://www.e107.org for further details.", 3);
$versionTest = $xdata['core']['@attributes']['version'];
}
else
{
// If there is not a new version of e107 available, $versionTest = false
$versionTest = false;
}
break;
}
//$versionTest = "{CHECK THE VERSION}"; // If out of date, return some text, if up-to-date , return false;
$che = e107::getCache();
$che->setMD5(e_LANGUAGE);
if($versionTest)
{
$che->set("releasecheck",$versionTest, TRUE);
return $versionTest;
// e107::getMessage()=>addInfo($versionTest);
}
else
{
$che->set("releasecheck", 'false', TRUE);
return false;
}
}

View File

@ -56,6 +56,11 @@ define("LAN_CRON_16", "Using your server control panel (eg. cPanel, DirectAdmin,
// leave some room for additions/changes
// Info for checkCoreUpdate cron
define("LAN_CRON_20_1", "Check for e107 Update");
define("LAN_CRON_20_2", "Check e107.org for Core updates"); // [eml] is automatically replaced by head admin e-mail address.
define("LAN_CRON_20_3", "Recommended to keep system up to date.");
define("LAN_CRON_30", "Every Minute");
define("LAN_CRON_31", "Every Other Minute");
define("LAN_CRON_32", "Every 5 Minutes");