FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
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... | |
isLicenseExists ($dbManager, $rf_shortname, $isCandidate=true) | |
mergeCandidateLicense ($dbManager, $candidateLicense) | |
insertNewLicense ($dbManager, $license, $wasCandidate=false) | |
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'])) | |
$GLOBALS ["PG_CONN"] = get_pg_conn($SYSCONFDIR, $SysConf) | |
$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) | |
$Filename = "$MODDIR/www/ui/init.ui" | |
$flagRemoved = !file_exists($Filename) | |
if(! $flagRemoved) if(! $flagRemoved) | else |
$FAILED_LICENSE_IMPORT = array() | |
if(array_key_exists('r', $Options)) | $currSchema = $libschema->getCurrSchema() |
$sysconfig = $dbManager->createMap('sysconfig','variablename','conf_value') | |
global | $LIBEXECDIR |
$release = array_key_exists('Release', $sysconfig) ? $sysconfig['Release'] : 0 | |
if(version_compare($release, '4.3.0', '<')) if($UpdateLiceneseRef) 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() | |
This program applies core-schema.dat to the database (which must exist) and updates the license_ref table.
Definition in file fossinit.php.
explainUsage | ( | ) |
Print Usage statement.
Definition at line 13 of file fossinit.php.
insertInToLicenseRefTableUsingJson | ( | $tableName | ) |
insert into license_ref table using json file.
$tableName |
import licenseRef.json
Definition at line 468 of file fossinit.php.
insertNewLicense | ( | $dbManager, | |
$license, | |||
$wasCandidate = false |
|||
) |
Insert new license to license_ref
DbManager | $dbManager | DbManager to be used |
array | $license | License row to be added |
boolean | $wasCandidate | Was the new license already a candidate? (required for rf_pk) |
Definition at line 785 of file fossinit.php.
isLicenseExists | ( | $dbManager, | |
$rf_shortname, | |||
$isCandidate = true |
|||
) |
Check if the given shortname exists in DB.
DbManager | $dbManager | DbManager used |
string | $rf_shortname | Shortname of the license to check |
boolean | $isCandidate | check given shortname in candidate table |
Definition at line 700 of file fossinit.php.
mergeCandidateLicense | ( | $dbManager, | |
$candidateLicense | |||
) |
Merge the candidate license to the main license_ref table.
DbManager | $dbManager | DbManager used |
array | $candidateLicense | Shortname of the license to check |
Definition at line 724 of file fossinit.php.
$longOpts |
Definition at line 48 of file fossinit.php.
Definition at line 166 of file fossinit.php.
Definition at line 218 of file fossinit.php.
if ( $isUpdating &&!empty( $sysconfig) &&$sysconfig[ 'Release']=='2.6.3.1') if($dbManager->existsTable("author")) | ( | ! | preg_match"/\s$projectGroup\s/", $groups) &&(posix_getgid() !=$gInfo[ 'gid'] | ) |
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 114 of file fossinit.php.