case 'upgrade': //通信已关闭 if ($connect == 'off') { exit(serialize(array('return' => 'connect', 'connect' => $connect))); } //测试读写权限 $status = Cloud::valid_perm(VI_ROOT, array('attach/', 'cache/', 'static/')); if (count($status)) { exit(serialize(array('return' => 'permission', 'catalog' => $status))); } //升级引擎 $status = Cloud::upgrade_engine($command['package'], $command['hash']); //升级成功 if ($status > 0) { //执行升级脚本 System::upgrade($command['version']); //更新模块缓存 Module::search(); exit(serialize(array('return' => 'success', 'status' => 'success'))); } else { exit(serialize(array('return' => 'package', 'status' => $status, 'lastfile' => Cloud::$lastfile))); } break; //////////////////////////// //模块搜索 //////////////////////////// //模块搜索 case 'licence': exit(serialize($_G['licence'])); break; ////////////////////////////
break; } set_time_limit(0); $G_MAIN_MENU = 'processmaker'; $G_SUB_MENU = 'setup'; $G_ID_MENU_SELECTED = 'SETUP'; $G_ID_SUB_MENU_SELECTED = 'UPGRADE'; require_once "classes/class.system.php"; $oSystem = new System(); try { if (!$oSystem->verifyFileForUpgrade()) { throw new Exception("There was an error uploading the file, probably the file size if greater than upload_max_filesize parameter in php.ini, please check this parameter and try again."); } $oSystem->cleanupUpgradeDirectory(); $oSystem->getUpgradedFilesList(); $ver = $oSystem->upgrade(); $G_PUBLISH = new Publisher(); $aMessage['THEMESSAGE1'] = G::LoadTranslation('ID_UPGRADE_READY') . " <b>" . $ver[0] . "</b> " . G::LoadTranslation('ID_TO') . " <b>" . $ver[1] . "</b>"; $aMessage['THEMESSAGE2'] = file_get_contents($oSystem->sUpgradeFileList); $aMessage['THEMESSAGE3'] = ''; if (!is_Array($oSystem->aErrors) || count($oSystem->aErrors) == 0) { $aMessage['THEMESSAGE4'] = G::LoadTranslation('ID_NONE'); } else { $aMessage['THEMESSAGE4'] = implode("\n", $oSystem->aErrors); } $oHeadPublisher =& headPublisher::getSingleton(); if (file_exists(PATH_CORE . 'js' . PATH_SEP . 'setup' . PATH_SEP . 'upgrade_System.js')) { $oHeadPublisher->addScriptFile('/jscore/setup/upgrade_System.js'); } else { $oHeadPublisher->addScriptCode("function upgradeSystem(wsCount) {\n document.getElementById('form[THETITLE3]').innerHTML = wsCount + ' workspaces to update.';\n document.getElementById('form[SUBTITLE4]').innerHTML = ' <img src='/images/alert.gif' width='13' height='13' border='0'> Please wait...';\n updateWorkspace(wsCount);\n };\n function updateWorkspace(id) {\n if(id < 0) return false;\n var oRPC = new leimnud.module.rpc.xmlhttp({\n async : true,\n method: 'POST',\n url: '../setup/upgrade_SystemAjax',\n args : 'id=' + id\n });\n oRPC.callback = function(rpc) {\n document.getElementById('form[SUBTITLE4]').innerHTML = rpc.xmlhttp.responseText;\n updateWorkspace(id-1);\n }.extend(this);\n oRPC.make();\n };"); }