26 $GLOBALS[
'apiCall'] =
true;
29 require_once dirname(dirname(dirname(__DIR__))) .
"/vendor/autoload.php";
30 require_once dirname(dirname(dirname(dirname(__FILE__)))) .
31 "/lib/php/bootstrap.php";
48 const REST_VERSION_SLUG =
"restVersion";
50 const VERSION_1 =
"/v{" . REST_VERSION_SLUG .
":1}/";
52 const AUTH_METHOD =
"JWT_TOKEN";
54 $startTime = microtime(
true);
61 $timingLogger = $container->get(
"log.timing");
62 $timingLogger->logWithStartTime(
"bootstrap", $startTime);
65 $loader = $container->get(
'twig.loader');
66 $loader->addPath(dirname(dirname(__FILE__)).
'/template');
71 $timingLogger->toc(
"setup init");
76 $app =
new App($GLOBALS[
'container']);
92 $app->add(
new FossologyInitMiddleware());
94 $app->add(
new RestAuthMiddleware());
97 $app->get(VERSION_1 .
'auth', AuthController::class .
':getAuthHeaders');
98 $app->post(VERSION_1 .
'tokens', AuthController::class .
':createNewJwtToken');
101 $app->group(VERSION_1 .
'uploads',
103 $this->
get(
'[/{id:\\d+}]', UploadController::class .
':getUploads');
104 $this->
delete(
'/{id:\\d+}', UploadController::class .
':deleteUpload');
105 $this->patch(
'/{id:\\d+}', UploadController::class .
':moveUpload');
106 $this->put(
'/{id:\\d+}', UploadController::class .
':copyUpload');
107 $this->post(
'', UploadController::class .
':postUpload');
108 $this->
get(
'/{id:\\d+}/summary', UploadController::class .
':getUploadSummary');
109 $this->
get(
'/{id:\\d+}/licenses', UploadController::class .
':getUploadLicenses');
110 $this->any(
'/{params:.*}', BadRequestController::class);
114 $app->group(VERSION_1 .
'users',
116 $this->
get(
'[/{id:\\d+}]', UserController::class .
':getUsers');
117 $this->
delete(
'/{id:\\d+}', UserController::class .
':deleteUser');
118 $this->any(
'/{params:.*}', BadRequestController::class);
122 $app->group(VERSION_1 .
'jobs',
124 $this->
get(
'[/{id:\\d+}]', JobController::class .
':getJobs');
125 $this->post(
'', JobController::class .
':createJob');
126 $this->any(
'/{params:.*}', BadRequestController::class);
130 $app->group(VERSION_1 .
'search',
132 $this->
get(
'', SearchController::class .
':performSearch');
136 $app->group(VERSION_1 .
'folders',
138 $this->
get(
'[/{id:\\d+}]', FolderController::class .
':getFolders');
139 $this->post(
'', FolderController::class .
':createFolder');
140 $this->
delete(
'/{id:\\d+}', FolderController::class .
':deleteFolder');
141 $this->patch(
'/{id:\\d+}', FolderController::class .
':editFolder');
142 $this->put(
'/{id:\\d+}', FolderController::class .
':copyFolder');
143 $this->any(
'/{params:.*}', BadRequestController::class);
147 $app->group(VERSION_1 .
'report',
149 $this->
get(
'', ReportController::class .
':getReport');
150 $this->
get(
'/{id:\\d+}', ReportController::class .
':downloadReport');
151 $this->any(
'/{params:.*}', BadRequestController::class);
155 $app->group(VERSION_1 .
'version',
157 $this->
get(
'', VersionController::class .
':getVersion');
162 $GLOBALS[
'container']->get(
"db.manager")->flushStats();
plugin_load()
Load every module ui found in mods-enabled.
bootstrap($sysconfdir="")
Bootstrap the fossology php library.
ConfigInit($sysconfdir, &$SysConf)
Initialize the fossology system after bootstrap().