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