/** * \brief Initalize the fossology environment for cli use. This routine loads * the plugins so they can be use by cli programs. In the process of doing * that it disables the core-auth plugin. * * \return true */ function cli_Init() { // every cli must perform these steps global $Plugins; /* Load the plugins */ plugin_load(0); /* load but do not initialize */ /* Turn off authentication */ /** The auth module hijacks and disables plugins, so turn it off. **/ if (array_key_exists("auth", $Plugins)) { $P =& $Plugins["auth"]; if (!empty($P)) { $P->State = PLUGIN_STATE_FAIL; } } $_SESSION['User'] = '******'; /* Initialize plugins */ /** This registers plugins with the menu structure and start the DB connection. **/ plugin_preinstall(); return true; }
require_once __DIR__ . "/../../lib/php/bootstrap.php"; $PG_CONN = 0; // Database connection /* Set SYSCONFDIR and set global (for backward compatibility) */ $SysConf = bootstrap(); global $container; /** @var TimingLogger $logger */ $timingLogger = $container->get("log.timing"); $timingLogger->logWithStartTime("bootstrap", $startTime); /* Initialize global system configuration variables $SysConfig[] */ $timingLogger->tic(); ConfigInit($SYSCONFDIR, $SysConf); $timingLogger->toc("setup init"); $timingLogger->tic(); plugin_load(); plugin_preinstall(); plugin_postinstall(); $timingLogger->toc("setup plugins"); $plugin = plugin_find(GetParm("mod", PARM_STRING) ?: HomePage::NAME); if ($plugin) { $timingLogger->tic(); $plugin->execute(); $timingLogger->toc("plugin execution"); } else { $linkUri = Traceback_uri() . "?mod=auth"; $errorText = _("Module unavailable or your login session timed out."); print "{$errorText} <P />"; $linkText = _("Click here to continue."); print "<a href=\"{$linkUri}\">{$linkText}</a>"; } plugin_unload();