BUG - Notices found in the heartbeat call

- The attribute "workspaces" not defined in the class "serverConfiguration"
- Define the missing attribute in the class
This commit is contained in:
Julio Cesar Laura
2012-07-18 09:53:39 -04:00
parent ea32fd1d40
commit 2be5a0837d
2 changed files with 53 additions and 52 deletions

View File

@@ -53,6 +53,7 @@ class serverConf {
var $logins;
private $lanDirection;
private $lanLanguage;
public $workspaces = array();
public function __construct() {

View File

@@ -15,7 +15,7 @@ switch ($request) {
}
//Build Data to be sent
$params=buildData();
//Send the information
postHeartBeat($params);
} catch (Exception $e) {
@@ -29,14 +29,14 @@ function validateConnectivity($url){
$sContent = file_get_conditional_contents($url);
$sw_connect=true;
//if ($sContent == '' || $sContent === false || strpos ( $sContent, 'address location' ) === false ) { 4
if ($sContent == '' || $sContent === false ) {
if ($sContent == '' || $sContent === false ) {
$sw_connect=false;
}
return $sw_connect;
}
function file_get_conditional_contents($szURL){
$pCurl = curl_init ();
curl_setopt ( $pCurl, CURLOPT_URL, $szURL );
curl_setopt ( $pCurl, CURLOPT_RETURNTRANSFER, true );
@@ -46,24 +46,24 @@ function file_get_conditional_contents($szURL){
//To avoid SSL error
curl_setopt ( $pCurl, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt ( $pCurl, CURLOPT_SSL_VERIFYPEER, 0);
//To avoid timeouts
curl_setopt ( $pCurl, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt ( $pCurl, CURLOPT_TIMEOUT, 20 );
curl_setopt ( $pCurl, CURLOPT_NOPROGRESS, FALSE);
curl_setopt ( $pCurl, CURLOPT_VERBOSE, TRUE);
$szContents = curl_exec($pCurl);
$aInfo = curl_getinfo($pCurl);
$curl_session = curl_getinfo($pCurl, CURLINFO_HTTP_CODE);
$headers = curl_getinfo ( $pCurl );
$header = substr ( $szContents, 0, $headers ['header_size'] );
$content = substr ( $szContents, $headers ['header_size'] );
if($aInfo['http_code'] === 200)
{
@@ -74,10 +74,10 @@ function file_get_conditional_contents($szURL){
}
function buildData(){
require_once ("classes/model/Users.php");
G::LoadClass("serverConfiguration");
G::LoadClass("system");
$oServerConf = &serverConf::getSingleton();
$os = '';
@@ -88,11 +88,11 @@ function buildData(){
fclose ( $fp );
}
$os .= " (" . PHP_OS . ")";
$params = array ();
$params ['ip'] = getenv ( 'SERVER_ADDR' );
$oServerConf->setHeartbeatProperty('HB_BEAT_INDEX',intval($oServerConf->getHeartbeatProperty('HB_BEAT_INDEX','HEART_BEAT_CONF'))+1,'HEART_BEAT_CONF');
$params ['index'] = $oServerConf->getHeartbeatProperty('HB_BEAT_INDEX','HEART_BEAT_CONF');//$this->index;
$params ['beatType'] = is_null($oServerConf->getHeartbeatProperty('HB_BEAT_TYPE','HEART_BEAT_CONF'))?"starting":$oServerConf->getHeartbeatProperty('HB_BEAT_TYPE','HEART_BEAT_CONF');//1;//$this->beatType;
$params ['date'] = date ( 'Y-m-d H:i:s' );
@@ -106,7 +106,7 @@ function buildData(){
}else{
$params ['pmProduct'] = 'PMCE';
}
$params ['logins'] = $oServerConf->logins;
$params ['workspaces'] = serialize ( $oServerConf->getWSList () );
$params ['plugins'] = serialize ( $oServerConf->getPluginsList () );
@@ -115,23 +115,23 @@ function buildData(){
if($licInfo=$oServerConf->getProperty('LICENSE_INFO')){
$params ['license'] = serialize ( $licInfo );
}
///////
$criteria = new Criteria("workflow");
$criteria->addSelectColumn("COUNT(USERS.USR_UID) AS USERS_NUMBER");
$criteria->add(UsersPeer::USR_UID, null, Criteria::ISNOTNULL);
$rs = UsersPeer::doSelectRS($criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
$params["users"] = $row["USERS_NUMBER"];
///////
$ee = null;
if (file_exists(PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION")) {
$ee = trim(file_get_contents(PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION"));
}
@@ -141,80 +141,80 @@ function buildData(){
$ee = (!($details == null))? $details->iVersion : null;
}
$params["ee"] = $ee;
///////
$addonNumber = 0;
$addonEnabledNumber = 0;
$pluginRegistry = &PMPluginRegistry::getSingleton();
$arrayAddon = array();
if (file_exists(PATH_DATA_SITE . "ee")) {
$arrayAddon = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee")));
$arrayAddon["enterprise"] = array("sFilename" => "enterprise-1.tar");
}
foreach ($arrayAddon as $addon) {
$sFileName = substr($addon["sFilename"], 0, strpos($addon["sFilename"], "-"));
if (file_exists(PATH_PLUGINS . $sFileName . ".php")) {
$addonDetails = $pluginRegistry->getPluginDetails($sFileName . ".php");
$enabled = 0;
if ($addonDetails) {
$enabled = ($addonDetails->enabled)? 1 : 0;
}
if ($enabled == 1) {
$addonEnabledNumber = $addonEnabledNumber + 1;
}
$addonNumber = $addonNumber + 1;
}
}
$params["addonNumber"] = $addonNumber;
$params["addonEnabledNumber"] = $addonEnabledNumber;
///////
$licenseID = null;
$licenseType = null;
$licenseDomainWorkspace = null;
$licenseNumber = 0;
if (file_exists(PATH_PLUGINS . "enterprise" . PATH_SEP . "class.pmLicenseManager.php")) {
if (file_exists(PATH_PLUGINS . "enterprise" . PATH_SEP . "class.pmLicenseManager.php") && class_exists('enterprisePlugin')) {
$licenseManager = &pmLicenseManager::getSingleton();
preg_match("/^license_(.*).dat$/", $licenseManager->file, $matches);
$licenseID = $matches[1];
$licenseType = $licenseManager->type;
$licenseDomainWorkspace = $licenseManager->info["DOMAIN_WORKSPACE"];
///////
$criteria = new Criteria("workflow");
$criteria->addSelectColumn("COUNT(LICENSE_MANAGER.LICENSE_UID) AS LICENSE_NUMBER");
$criteria->add(LicenseManagerPeer::LICENSE_UID, null, Criteria::ISNOTNULL);
$rs = LicenseManagerPeer::doSelectRS($criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
///////
$licenseNumber = ($row["LICENSE_NUMBER"] > 0)? $row["LICENSE_NUMBER"] : count(glob(PATH_DATA_SITE . "licenses" . PATH_SEP . "*.dat"));
}
$params["licenseID"] = $licenseID;
$params["licenseType"] = $licenseType;
$params["licenseDomainWorkspace"] = $licenseDomainWorkspace;
$params["licenseNumber"] = $licenseNumber;
///////
return $params;
}
@@ -225,9 +225,9 @@ function buildData(){
$oServerConf = & serverConf::getSingleton ();
$oServerConf->setHeartbeatProperty('HB_NEXT_BEAT_DATE',strtotime ( "+2 hour" ),'HEART_BEAT_CONF');
$nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE','HEART_BEAT_CONF');
$heartBeatUrl = $oServerConf->getHeartbeatProperty('HB_BEAT_URL','HEART_BEAT_CONF');
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $heartBeatUrl );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
@@ -239,12 +239,12 @@ function buildData(){
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $params );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $params );
//To avoid timeouts
curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt ( $ch, CURLOPT_TIMEOUT, 20 );
$response = curl_exec ( $ch );
$curl_session = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$headers = curl_getinfo ( $ch );
@@ -257,16 +257,16 @@ function buildData(){
$oServerConf->resetLogins ();
$oServerConf->setHeartbeatProperty('HB_NEXT_BEAT_DATE',strtotime ( "+7 day" ),'HEART_BEAT_CONF');
//Reset Errors
} else {
//Catch the error
$oServerConf->setHeartbeatProperty('HB_NEXT_BEAT_DATE',strtotime ( "+1 day" ),'HEART_BEAT_CONF');
}
}
/*
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $heartBeatUrl );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
@@ -278,7 +278,7 @@ function buildData(){
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $params );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $params );
//To avoid timeouts
curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 10 );