public static function buildResult(tao_install_services_Data $data, common_configuration_Report $report, common_configuration_Component $component) { $content = json_decode($data->getContent(), true); $id = $content['value']['id']; $url = $content['value']['host']; echo 'buildResult host: ' . $url . "\r\n"; $data = array('type' => 'TAOForgeConnectionReport', 'value' => array('status' => $report->getStatusAsString(), 'message' => $report->getMessage(), 'optional' => $component->isOptional(), 'name' => $component->getName(), 'id' => $id)); return new tao_install_services_Data(json_encode($data)); }
/** * Short description of method __construct * * @access public * @author Jerome Bogaerts, <*****@*****.**> * @param string location * @param string expectedRights * @param boolean optional * @return mixed */ public function __construct($location, $expectedRights, $optional = false, $recursive = false) { parent::__construct('tao.configuration.filesystem', $optional); $this->setExpectedRights($expectedRights); $this->setLocation($location); $this->setRecursive($recursive); }
public static function buildResult(tao_install_services_Data $data, common_configuration_Report $report, common_configuration_Component $component) { $content = json_decode($data->getContent(), true); $id = $content['value']['id']; $value = array('status' => $report->getStatusAsString(), 'id' => $id, 'message' => $report->getMessage(), 'min' => $component->getMin(), 'value' => $component->getValue(), 'optional' => $component->isOptional()); $max = $component->getMax(); if (!empty($max)) { $value['max'] = $component->getMax(); } $data = array('type' => 'PHPRuntimeReport', 'value' => $value); return new tao_install_services_Data(json_encode($data)); }
public static function buildResult(tao_install_services_Data $data, common_configuration_Report $report, common_configuration_Component $component) { $content = json_decode($data->getContent(), true); $value = $content['value']['value']; $id = $content['value']['id']; $data = array('type' => 'PHPINIValueReport', 'value' => array('status' => $report->getStatusAsString(), 'id' => $id, 'message' => $report->getMessage(), 'expectedValue' => $value, 'value' => $component->getValue(), 'optional' => $component->isOptional(), 'name' => $component->getName())); return new tao_install_services_Data(json_encode($data)); }
/** * Short description of method __construct * * @access public * @author Jerome Bogaerts, <*****@*****.**> * @param string min * @param string max * @param string name * @param boolean optional * @return mixed */ public function __construct($min, $max, $name = 'unknown', $optional = false) { parent::__construct($name, $optional); $this->setMin($min); $this->setMax($max); }
/** * Short description of method __construct * * @access public * @author Jerome Bogaerts, <*****@*****.**> * @param string expectedValue * @param string name * @param boolean optional * @return mixed */ public function __construct($expectedValue, $name = 'unknown', $optional = false) { parent::__construct($name, $optional); $this->setExpectedValue($expectedValue); }
/** * Short description of method checkComponent * * @access private * @author Jerome Bogaerts, <*****@*****.**> * @param Component component * @return int */ private function checkComponent(common_configuration_Component $component) { $returnValue = (int) 0; $report = $component->check(); // Check the node. $this->componentChecked($component); // Mark the node as 'checked'. // Store the report if not silenced. if (false == $this->isSilent($component)) { $this->addReport($report); // Store the report. } $returnValue = $report->getStatus(); return (int) $returnValue; }
public static function buildResult(tao_install_services_Data $data, common_configuration_Report $report, common_configuration_Component $component) { $content = json_decode($data->getContent(), true); $rights = $content['value']['rights']; $id = $content['value']['id']; $root = dirname(__FILE__) . '/../../../'; $data = array('type' => 'FileSystemComponentReport', 'value' => array('status' => $report->getStatusAsString(), 'message' => $report->getMessage(), 'id' => $id, 'optional' => $component->isOptional(), 'isReadable' => $component->isReadable(), 'isWritable' => $component->isWritable(), 'isExecutable' => $component->isExecutable(), 'recursive' => $component->getRecursive(), 'expectedRights' => $rights, 'isFile' => is_file($root . $component->getLocation()), 'location' => $component->getLocation())); return new tao_install_services_Data(json_encode($data)); }
public static function buildResult(tao_install_services_Data $data, common_configuration_Report $report, common_configuration_Component $component) { $content = json_decode($data->getContent(), true); $driver = $content['value']['driver']; $user = $content['value']['user']; $password = $content['value']['password']; $host = $content['value']['host']; $overwrite = $content['value']['overwrite']; $database = $content['value']['database']; $message = ''; if ($report->getStatus() == common_configuration_Report::VALID) { // Great the driver is there, we can try a connection. try { set_error_handler(array('tao_install_services_CheckDatabaseConnectionService', 'onError')); //$dbCreatorClassName = tao_install_utils_DbCreator::getClassNameForDriver($driver); //$dbCreator = new $dbCreatorClassName($host, $user, $password, $driver); $dbConfiguration = array('driver' => $driver, 'host' => $host, 'dbname' => $database, 'user' => $user, 'password' => $password); $dbCreator = new tao_install_utils_DbalDbCreator($dbConfiguration); // If we are here, we are connected. if ($overwrite == false && $dbCreator->dbExists($database)) { $message = "A database with name '{$database}' already exists."; $status = 'invalid-overwrite'; } else { $message = "Database connection successfully established with '{$host}' using driver '{$driver}'."; $status = 'valid'; } restore_error_handler(); } catch (Exception $e) { if ($e instanceof PDOException && $driver === 'pdo_mysql' && $e->getCode() === 1049) { // mysql -> 1049 = unknown DB -> let the last step of the installer create it if possible. $message = "Database unknown, database creation process delayed."; $status = 'valid'; } else { $message = "Unable to connect to database '{$database}' at '{$host}' using driver '{$driver}': " . $e->getMessage(); $status = 'invalid-noconnection'; } restore_error_handler(); } } else { // No driver found. $status = 'invalid-nodriver'; $message = "Database driver '{$driver}' is not available."; } $value = array('status' => $status, 'message' => $message, 'optional' => $component->isOptional(), 'name' => $component->getName()); $data = array('type' => 'DatabaseConnectionReport', 'value' => $value); return new tao_install_services_Data(json_encode($data)); }