FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
configTestEnv.php
1 #!/usr/bin/php
2 <?php
3 /***********************************************************
4  Copyright (C) 2008 Hewlett-Packard Development Company, L.P.
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  version 2 as published by the Free Software Foundation.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  ***********************************************************/
19 
34 // TODO : $usage = "$argv[0] Url User Password [path-to-suite]\n";
35 
36 // usage done this way as here doc's mess up eclipse colors.
37 $U = NULL;
38 $U .= "Usage: $argv[0] Url User Password [proxy]\n\nUrl is a full url with ending /\n";
39 $U .= "e.g. http://someHost.somedomain/repo/\n\n";
40 $U .= "Data-Base User and Data-Base Password\n\n";
41 $U .= "Optional proxy in the form http://web-proxy.xx.com:80xx\n";
42 $U .= "The proxy format is not checked, so make sure it's correct\n";
43 $U .= "Very little parameter checking is done.\n\n";
44 $U .= "For example,\n$argv[0] 'http://fossology.org/' dbuser dbpasswd 'http://web-proxy.somebody.com:8080'\n";
45 $U .= "Note the single quotes are used to keep the shell happy.\n";
46 $usage = $U;
47 
48 // simple parameter checks
49 if((int)$argc < 4)
50 {
51  print $usage;
52  exit(1);
53 }
54 
55 // code below fixes php notice if no proxy used on the command line
56 $proxy = '';
57 if(empty($argv[4]))
58 {
59  $argv[4] = '';
60 }
61 
62 list($me, $url, $user, $password, $proxy) = $argv;
63 //print "Params: U:$url USR:$user PW:password PROX:$proxy\n";
64 if(empty($url)) { exit(1); }
65 if('http://' != substr($url,0,7))
66 {
67  print "$me ERROR not a valid URL\n$url\n\n$usage";
68  exit(1);
69 }
70 
71 $FD = fopen('./TestEnvironment.php', 'w') or die("Can't open ./TestEnvironment $php_errormsg\n");
72 $startphp = "<?php\n";
73 $testGlobals = "global \$USER;\n" .
74  "global \$PASSWORD;\n" .
75  "global \$URL;\n";
76 $fullUrl = "\$URL='$url';\n";
77 $usr = "\$USER='$user';\n";
78 $passwd = "\$PASSWORD='$password';\n";
79 $useproxy = NULL;
80 $endphp = "?>\n";
81 $tests = getcwd();
82 $define ="define('TESTROOT',\"$tests\");\n";
83 if(!(empty($proxy)))
84 {
85  $useproxy = "\$PROXY='$proxy';\n";
86  fwrite($FD, "$startphp$testGlobals$fullUrl$usr$passwd$useproxy$define$endphp");
87 }
88 else
89 {
90  fwrite($FD, "$startphp$testGlobals$fullUrl$usr$passwd$define$endphp");
91 }
92 fclose($FD);
93 print "./TestEnvironment.php created sucessfully\n";
94 ?>
if(!preg_match("/\s$projectGroup\s/", $groups)&&(posix_getgid()!=$gInfo['gid']))
get monk license list of one specified uploadtree_id
Definition: migratetest.php:44
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:321