FOSSology  4.4.0
Open Source License Compliance by Open Source Software
configTestEnv.php
1 #!/usr/bin/php
2 <?php
3 /*
4  SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
23 // TODO : $usage = "$argv[0] Url User Password [path-to-suite]\n";
24 
25 // usage done this way as here doc's mess up eclipse colors.
26 $U = NULL;
27 $U .= "Usage: $argv[0] Url User Password [proxy]\n\nUrl is a full url with ending /\n";
28 $U .= "e.g. http://someHost.somedomain/repo/\n\n";
29 $U .= "Data-Base User and Data-Base Password\n\n";
30 $U .= "Optional proxy in the form http://web-proxy.xx.com:80xx\n";
31 $U .= "The proxy format is not checked, so make sure it's correct\n";
32 $U .= "Very little parameter checking is done.\n\n";
33 $U .= "For example,\n$argv[0] 'http://fossology.org/' dbuser dbpasswd 'http://web-proxy.somebody.com:8080'\n";
34 $U .= "Note the single quotes are used to keep the shell happy.\n";
35 $usage = $U;
36 
37 // simple parameter checks
38 if((int)$argc < 4)
39 {
40  print $usage;
41  exit(1);
42 }
43 
44 // code below fixes php notice if no proxy used on the command line
45 $proxy = '';
46 if(empty($argv[4]))
47 {
48  $argv[4] = '';
49 }
50 
51 list($me, $url, $user, $password, $proxy) = $argv;
52 //print "Params: U:$url USR:$user PW:password PROX:$proxy\n";
53 if(empty($url)) { exit(1); }
54 if('http://' != substr($url,0,7))
55 {
56  print "$me ERROR not a valid URL\n$url\n\n$usage";
57  exit(1);
58 }
59 
60 $FD = fopen('./TestEnvironment.php', 'w') or die("Can't open ./TestEnvironment $php_errormsg\n");
61 $startphp = "<?php\n";
62 $testGlobals = "global \$USER;\n" .
63  "global \$PASSWORD;\n" .
64  "global \$URL;\n";
65 $fullUrl = "\$URL='$url';\n";
66 $usr = "\$USER='$user';\n";
67 $passwd = "\$PASSWORD='$password';\n";
68 $useproxy = NULL;
69 $endphp = "?>\n";
70 $tests = getcwd();
71 $define ="define('TESTROOT',\"$tests\");\n";
72 if(!(empty($proxy)))
73 {
74  $useproxy = "\$PROXY='$proxy';\n";
75  fwrite($FD, "$startphp$testGlobals$fullUrl$usr$passwd$useproxy$define$endphp");
76 }
77 else
78 {
79  fwrite($FD, "$startphp$testGlobals$fullUrl$usr$passwd$define$endphp");
80 }
81 fclose($FD);
82 print "./TestEnvironment.php created sucessfully\n";
if(!preg_match("/\s$projectGroup\s/", $groups) &&(posix_getgid() !=$gInfo[ 'gid']))
get monk license list of one specified uploadtree_id
Definition: migratetest.php:33
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:308