Changeset 1108

Show
Ignore:
Timestamp:
09/07/08 14:39:54 (3 months ago)
Author:
arnoschn
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/arnoschn/cache/lib/utils/scripts/ci-test.php

    r1107 r1108  
    224224    } 
    225225     
    226     function _checkWebServer($url
     226    function _checkWebServer($url, $test_installation = null
    227227    { 
    228228        $return = true; 
    229          
     229        if ($test_installation == null && defined('AK_CI_TEST_DIR')) { 
     230            $test_installation = AK_CI_TEST_DIR; 
     231        } 
    230232        $parts = parse_url($url); 
    231233        if (!isset($parts['host'])) { 
     
    235237        $rewritebase = isset($parts['path'])?$parts['path']:'/'; 
    236238        $htaccessTemplateFile = AK_BASE_DIR.DS.'script'.DS.'extras'.DS.'TPL-htaccess'; 
    237         $htaccessFile = AK_CI_TEST_DIR.DS.'test'.DS.'fixtures'.DS.'public'.DS.'.htaccess'; 
     239        $htaccessFile = $test_installation.DS.'test'.DS.'fixtures'.DS.'public'.DS.'.htaccess'; 
    238240        $htaccessRes = file_put_contents($htaccessFile,str_replace('${rewrite-base}',$rewritebase,file_get_contents($htaccessTemplateFile)))>0; 
    239241         
     
    242244        //$htaccess = AK_CI_TEST_DIR.DS.'test'.DS.'fixtures'.DS.'public'.DS.'.htaccess'; 
    243245        //$htaccess_backup =AK_CI_TEST_DIR.DS.'test'.DS.'fixtures'.DS.'public'.DS.'.htaccess.backup'; 
    244         $test_htaccess = AK_CI_TEST_DIR.DS.'test'.DS.'.htaccess'; 
    245         $test_htaccess_backup =AK_CI_TEST_DIR.DS.'test'.DS.'.htaccess.backup';  
     246        $test_htaccess = $test_installation.DS.'test'.DS.'.htaccess'; 
     247        $test_htaccess_backup =$test_installation.DS.'test'.DS.'.htaccess.backup';  
    246248        //copy($htaccess,$htaccess_backup); 
    247249        //unlink($htaccess); 
     
    252254        $this->debug('Checking if webserver is reachable at: '.$url.'/ci-setup-test.html'); 
    253255        $content = time().' - '.rand(0,10000); 
    254         $file = AK_CI_TEST_DIR.DS.'test'.DS.'fixtures'.DS.'public'.DS.'ci-setup-test.html'; 
     256        $file = $test_installation.DS.'test'.DS.'fixtures'.DS.'public'.DS.'ci-setup-test.html'; 
    255257        file_put_contents($file,$content); 
    256258        $res = @file_get_contents($url.'/ci-setup-test.html'); 
     
    350352        $settings['${php4}'] = $this->_promptForPhp('php4'); 
    351353        $settings['${php5}'] = $this->_promptForPhp('php5'); 
    352         $settings['${test-url}'] = $this->_promptForTestingUrl(); 
     354        $settings['${test-url}'] = $this->_promptForTestingUrl($settings['${test-installation}']); 
    353355        return file_put_contents($file,str_replace(array_keys($settings),array_values($settings),file_get_contents($templateFile)))>0; 
    354356    } 
     
    361363        return $executable; 
    362364    } 
    363     function _promptForTestingUrl(
    364     { 
    365         while ((($testingUrl = $this->promptUserVar('Please provide the testing url of the webserver (example: http://localhost/test/fixtures/public)')) && !$this->_checkWebServer($testingUrl))) { 
     365    function _promptForTestingUrl($test_installation
     366    { 
     367        while ((($testingUrl = $this->promptUserVar('Please provide the testing url of the webserver (example: http://localhost/test/fixtures/public)') && !$this->_checkWebServer($testingUrl,$test_installation)))) { 
    366368            $this->error('Could not verify the testing url. Please make sure a webserver is running and handling that request.'); 
    367369        }