1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-08 23:56:58 +02: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

@@ -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;
}
}