Changeset 1108
- Timestamp:
- 09/07/08 14:39:54 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/arnoschn/cache/lib/utils/scripts/ci-test.php
r1107 r1108 224 224 } 225 225 226 function _checkWebServer($url )226 function _checkWebServer($url, $test_installation = null) 227 227 { 228 228 $return = true; 229 229 if ($test_installation == null && defined('AK_CI_TEST_DIR')) { 230 $test_installation = AK_CI_TEST_DIR; 231 } 230 232 $parts = parse_url($url); 231 233 if (!isset($parts['host'])) { … … 235 237 $rewritebase = isset($parts['path'])?$parts['path']:'/'; 236 238 $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'; 238 240 $htaccessRes = file_put_contents($htaccessFile,str_replace('${rewrite-base}',$rewritebase,file_get_contents($htaccessTemplateFile)))>0; 239 241 … … 242 244 //$htaccess = AK_CI_TEST_DIR.DS.'test'.DS.'fixtures'.DS.'public'.DS.'.htaccess'; 243 245 //$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'; 246 248 //copy($htaccess,$htaccess_backup); 247 249 //unlink($htaccess); … … 252 254 $this->debug('Checking if webserver is reachable at: '.$url.'/ci-setup-test.html'); 253 255 $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'; 255 257 file_put_contents($file,$content); 256 258 $res = @file_get_contents($url.'/ci-setup-test.html'); … … 350 352 $settings['${php4}'] = $this->_promptForPhp('php4'); 351 353 $settings['${php5}'] = $this->_promptForPhp('php5'); 352 $settings['${test-url}'] = $this->_promptForTestingUrl( );354 $settings['${test-url}'] = $this->_promptForTestingUrl($settings['${test-installation}']); 353 355 return file_put_contents($file,str_replace(array_keys($settings),array_values($settings),file_get_contents($templateFile)))>0; 354 356 } … … 361 363 return $executable; 362 364 } 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)))) { 366 368 $this->error('Could not verify the testing url. Please make sure a webserver is running and handling that request.'); 367 369 }
