FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
fossinit.php File Reference

This program applies core-schema.dat to the database (which must exist) and updates the license_ref table. More...

Go to the source code of this file.

Functions

 explainUsage ()
 Print Usage statement. More...
 
 insertInToLicenseRefTableUsingJson ($tableName)
 insert into license_ref table using json file. More...
 
 initLicenseRefTable ($Verbose)
 Load the license_ref table with licenses. More...
 

Variables

 $AllPossibleOpts = "abc:d:ef:ghijklmnopqr:stuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
 
 $longOpts
 
 $Verbose = false
 
 $DatabaseName = "fossology"
 
 $UpdateLiceneseRef = false
 
 $sysconfdir = ''
 
 $delDbPattern = 'the option -rfosstest will drop data bases with datname like "fosstest%"'
 
 $forceDecision = false
 
 $forcePfile = false
 
 $Options = getopt($AllPossibleOpts, $longOpts)
 
 foreach ($Options as $optKey=> $optVal) = bootstrap($sysconfdir)
 
 $SysConf = bootstrap($sysconfdir)
 
 $SysConf ["DBCONF"]["dbname"] = $DatabaseName
 
 $GLOBALS ["SysConf"] = array_merge($GLOBALS["SysConf"], $SysConf)
 
 $projectGroup = $SysConf['DIRECTORIES']['PROJECTGROUP'] ?: 'fossy'
 
 $gInfo = posix_getgrnam($projectGroup)
 
 $groups = `groups`
 
 if (!preg_match("/\s$projectGroup\s/", $groups)&&(posix_getgid()!=$gInfo['gid']))
 
 $pgDriver = new Postgres($PG_CONN)
 
 $previousSchema = $libschema->getCurrSchema()
 
 $isUpdating = array_key_exists('TABLE', $previousSchema) && array_key_exists('users', $previousSchema['TABLE'])
 
if($dbManager->existsTable('sysconfig')) $migrateColumns
 
 $FailMsg = $libschema->applySchema($SchemaFilePath, $Verbose, $DatabaseName, $migrateColumns)
 
if($FailMsg) $Filename = "$MODDIR/www/ui/init.ui"
 
 $flagRemoved = !file_exists($Filename)
 
if(!$flagRemoved) if(!$flagRemoved) else
 
if($UpdateLiceneseRef) if(array_key_exists('r', $Options)) $currSchema = $libschema->getCurrSchema()
 
 $sysconfig = $dbManager->createMap('sysconfig','variablename','conf_value')
 
global $LIBEXECDIR
 
if(!$isUpdating||$sysconfig['Release']== '2.6') if($sysconfig['Release']== '2.6.3') $expiredDbReleases = array('2.6.3', '2.6.3.1', '2.6.3.2')
 
if($isUpdating &&(empty($sysconfig['Release'])||in_array($sysconfig['Release'], $expiredDbReleases))) $expiredDbReleases [] = '2.6.3.3'
 
 $checker = new SanityChecker($dbManager,$Verbose)
 
 $errors = $checker->check()
 

Detailed Description

This program applies core-schema.dat to the database (which must exist) and updates the license_ref table.

Returns
0 for success, 1 for failure.

Definition in file fossinit.php.

Function Documentation

explainUsage ( )

Print Usage statement.

Returns
No return, this calls exit.

Definition at line 24 of file fossinit.php.

initLicenseRefTable (   $Verbose)

Load the license_ref table with licenses.

Parameters
$Verbosedisplay database load progress information. If $Verbose is false, this function only prints errors.
Returns
0 on success, 1 on failure

traverse all records in user's license_ref table, update or insert

Definition at line 467 of file fossinit.php.

insertInToLicenseRefTableUsingJson (   $tableName)

insert into license_ref table using json file.

Parameters
$tableName

import licenseRef.json

Definition at line 417 of file fossinit.php.

Variable Documentation

$longOpts
Initial value:
= [
"force-decision",
"force-pfile",
"force-encode"
]

Definition at line 59 of file fossinit.php.

if ($dbManager->existsTable('sysconfig')) $migrateColumns
Initial value:
= array('clearing_decision'=>array('reportinfo','clearing_pk','type_fk','comment'),
'license_ref_bulk'=>array('rf_fk','removing'))

Definition at line 173 of file fossinit.php.

if ($isUpdating &&empty($sysconfig['Release'])) if (!$isUpdating) else
Initial value:
{
print "Database schema update completed successfully.\n"

Definition at line 221 of file fossinit.php.

if ($isUpdating &&!empty($sysconfig)&&$sysconfig['Release']== '2.6.3.1') if($dbManager->existsTable("author"))

delete from copyright where pfile_fk not in (select pfile_pk from pfile) add foreign constraint on copyright pfile_fk if not exist comment out for 2.5.0 require_once("$LIBEXECDIR/dbmigrate_2.0-2.5-pre.php"); Migrate_20_25($Verbose);

Definition at line 125 of file fossinit.php.