public static function test_project_specific_directory_is_not_accessible_on_server()
 {
     #$ph_cm
     #	= Configuration_ConfigManagerHelper
     #		::get_config_manager(
     #			'haddock',
     #			'public-html'
     #		);
     #
     #$project_specific_directory_on_server
     #	= $ph_cm->get_server_address() . 'project-specific';
     $project_specific_directory_on_server = PublicHTML_ServerAddressesHelper::get_server_address() . 'project-specific';
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $project_specific_directory_on_server);
     curl_setopt($ch, CURLOPT_HEADER, TRUE);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
     $out = curl_exec($ch);
     curl_close($ch);
     #echo $out;
     $lines = Strings_SplittingHelper::split_by_eol($out);
     if (preg_match('{^HTTP/[\\d.]+ (\\d+)}', $lines[0], $matches)) {
         #print_r($matches);
         $http_response_code = $matches[1];
         if ($http_response_code == 403) {
             /*
              * The server returned the code for 'Forbidden'.
              *
              * see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
              */
             return TRUE;
         }
     }
     return FALSE;
 }
 public static function test_config_directory_is_not_accessible_on_server()
 {
     //                $ph_cm
     //                        = Configuration_ConfigManagerHelper
     //                                ::get_config_manager(
     //                                        'haddock',
     //                                        'public-html'
     //                                );
     #$config_directory_on_server = $ph_cm->get_server_address() . 'config';
     $config_directory_on_server = PublicHTML_ServerAddressesHelper::get_server_address() . 'config';
     #echo $config_directory_on_server . PHP_EOL;
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $config_directory_on_server);
     curl_setopt($ch, CURLOPT_HEADER, TRUE);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
     //                echo 'options set' . PHP_EOL;
     $out = curl_exec($ch);
     curl_close($ch);
     //                echo $out;
     $lines = Strings_SplittingHelper::split_by_eol($out);
     if (preg_match('{^HTTP/[\\d.]+ (\\d+)}', $lines[0], $matches)) {
         #print_r($matches);
         $http_response_code = $matches[1];
         if (in_array($http_response_code, explode(' ', '403 404'))) {
             /*
              * The server returned the code for 'Forbidden' or 'Not Found'.
              *
              * see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
              */
             return TRUE;
         }
     }
     return FALSE;
 }
 public function do_actions()
 {
     $server_address = $this->get_server_address();
     #$ph_cm = Configuration_ConfigManagerHelper
     #	::get_config_manager('haddock', 'public-html');
     #
     #$ph_cm->save_server_address($server_address, 'instance');
     PublicHTML_ServerAddressesHelper::set_server_address($server_address);
 }
 public static function test_vhost_is_reachable_on_server()
 {
     //                $ph_cm
     //                        = Configuration_ConfigManagerHelper
     //                                ::get_config_manager(
     //                                        'haddock',
     //                                        'public-html'
     //                                );
     //
     //                $server_address = $ph_cm->get_server_address();
     $server_address = PublicHTML_ServerAddressesHelper::get_server_address();
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $server_address);
     curl_setopt($ch, CURLOPT_HEADER, TRUE);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
     $out = curl_exec($ch);
     curl_close($ch);
     #echo $out;
     $lines = Strings_SplittingHelper::split_by_eol($out);
     if (preg_match('{^HTTP/[\\d.]+ (\\d+)}', $lines[0], $matches)) {
         #print_r($matches);
         $http_response_code = $matches[1];
         #echo __METHOD__ . PHP_EOL;
         #echo "\$http_response_code: $http_response_code" . PHP_EOL;
         if (in_array($http_response_code, explode(' ', '200 301 302'))) {
             /*
              * The server returned the code for 'OK', 'Moved Permanently'
              * or 'Temp'.
              *
              * see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
              */
             return TRUE;
         }
     }
     return FALSE;
 }
 public function do_actions()
 {
     echo PublicHTML_ServerAddressesHelper::get_server_address();
     echo PHP_EOL;
 }
 public static function test_server_address_has_trailing_slash()
 {
     $server_address = PublicHTML_ServerAddressesHelper::get_server_address();
     return preg_match('{/$}', $server_address);
 }