FOSSology  4.4.0
Open Source License Compliance by Open Source Software
purgeTestEnvironment.php
1 #!/usr/bin/php
2 <?php
3 /*
4  SPDX-FileCopyrightText: © 2014 Siemens AG
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 require_once(__DIR__ . "/TestDbFactory.php");
10 require_once(dirname(dirname(__DIR__)) . "/lib/php/Test/TestInstaller.php");
11 
12 $testDbFactory = new TestDbFactory();
13 
14 $opts = getopt("c:d:", array());
15 
16 if (array_key_exists("c", $opts)) {
17  $sysConfDir = $opts['c'];
18 } else {
19  $sysConfDir = null;
20 }
21 
22 $testInstaller = new Fossology\Lib\Test\TestInstaller($sysConfDir);
23 $testInstaller->clear();
24 
25 if (array_key_exists("d", $opts)) {
26  $srcDir = $opts["d"];
27  foreach (explode(",", $srcDir) as $dir) {
28  if (!empty($dir)) {
29  $testInstaller->uninstall($dir);
30  }
31  }
32 }
33 
34 $testDbFactory->purgeTestDb($sysConfDir);