check easyinstall every 30 days

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9079 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2011-09-07 07:40:23 +00:00
parent e024fad8a9
commit 43f4cde8e7

View file

@ -9,6 +9,7 @@
var $layout_list;
var $xeMenuTitle;
var $easyinstallCheckFile = './files/env/easyinstall_last';
/**
* @brief Initilization
@ -61,8 +62,44 @@
if($db_info->https_port) Context::set('https_port', $db_info->https_port);
$this->showSendEnv();
$this->checkEasyinstall();
}
function checkEasyinstall()
{
$lastTime = (int)FileHandler::readFile($this->easyinstallCheckFile);
if ($lastTime > time() - 60*60*24*30) return;
$oAutoinstallModel = &getModel('autoinstall');
$params = array();
$params["act"] = "getResourceapiLastupdate";
$body = XmlGenerater::generate($params);
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
$xml_lUpdate = new XmlParser();
$lUpdateDoc = $xml_lUpdate->parse($buff);
$updateDate = $lUpdateDoc->response->updatedate->body;
if (!$updateDate)
{
$this->_markingCheckEasyinstall();
return;
}
$item = $oAutoinstallModel->getLatestPackage();
if(!$item || $item->updatedate < $updateDate)
{
$oController = &getAdminController('autoinstall');
$oController->_updateinfo();
}
$this->_markingCheckEasyinstall();
}
function _markingCheckEasyinstall()
{
$currentTime = time();
FileHandler::writeFile($this->easyinstallCheckFile, $currentTime);
}
function makeGnbUrl($module = 'admin')
{
global $lang;