} /* Set SYSCONFDIR and set global (for backward compatibility) */ $SysConf = bootstrap($sysconfdir); require_once "{$MODDIR}/lib/php/libschema.php"; // don't think we want all the other common libs require_once "{$MODDIR}/lib/php/common.php"; /* Initialize global system configuration variables $SysConfig[] */ ConfigInit($SYSCONFDIR, $SysConf); if (empty($SchemaFilePath)) { $SchemaFilePath = "{$MODDIR}/www/ui/core-schema.dat"; } if (!file_exists($SchemaFilePath)) { print "FAILED: Schema data file ({$SchemaFilePath}) not found.\n"; exit(1); } $FailMsg = ApplySchema($SchemaFilePath, $Verbose, $DatabaseName); if ($FailMsg) { print "ApplySchema failed: {$FailMsg}\n"; exit(1); } else { if ($Verbose) { print "DB schema has been updated.\n"; } $State = 1; $Filename = "{$MODDIR}/www/ui/init.ui"; if (file_exists($Filename)) { if ($Verbose) { print "Removing flag '{$Filename}'\n"; } if (is_writable("{$MODDIR}/www/ui/")) { $State = unlink($Filename);
// use our existing test database connection to populate the // database with the FOSSology ApplySchema() function // To make absolutely sure we do not interfere with any existing // database connections, save off any pre-existing database connections if (isset($PG_CONN)) { $previous_PG_CONN = $PG_CONN; } // assign the global PG_CONN variable used by ApplySchema $PG_CONN = $test_db_conn; // apply the core schema // We need to buffer the output in order to silence the normal // output generated by ApplySchema, or it will interfere with // our makefile interface debug("Applying the FOSSOlogy schema to test database via ApplySchema()"); ob_start(); $apply_result = ApplySchema($core_schema_dat_file); ob_end_clean(); // then re-assign the previous PG_CONN, if there was one if (isset($previous_PG_CONN)) { $PG_CONN = $previous_PG_CONN; } if (!empty($apply_result)) { die("FAIL: ApplySchema did not succeed. Output was:\n{$apply_result}\n"); } debug("Done Applying the FOSSOlogy schema to test database via ApplySchema()"); $elapsed = get_time() - $start_time; debug("Elapsed Time = {$elapsed}"); // insert the 'fossy' user into the test database // this is the FOSSology user 'fossy' (not a Postgres user, or a system user) $random_seed = rand() . rand(); $hash = sha1($random_seed . "fossy");