FOSSology
3.2.0rc1
Open Source License Compliance by Open Source Software
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
AjaxJobStatus.php
1
<?php
2
/***********************************************************
3
* Copyright (C) 2015 Siemens AG
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* version 2 as published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
***********************************************************/
18
19
namespace
Fossology\UI\Ajax
;
20
21
use
Fossology\Lib\Db\DbManager
;
22
use
Fossology\Lib\Plugin\DefaultPlugin
;
23
use
Fossology\Lib\Auth\Auth
;
24
use
Symfony\Component\HttpFoundation\Request
;
25
use
Symfony\Component\HttpFoundation\JsonResponse
;
26
27
class
AjaxJobStatus
extends
DefaultPlugin
28
{
29
const
NAME =
"jobstatus"
;
31
private
$dbManager;
32
33
function
__construct()
34
{
35
parent::__construct(self::NAME, array(
36
self::PERMISSION =>
Auth::PERM_READ
37
));
38
$this->
dbManager
= $this->
getObject
(
'db.manager'
);
39
}
40
46
protected
function
handle
(Request $request)
47
{
48
$response =
'1'
;
49
$jobInfo = $this->
dbManager
->getSingleRow(
50
"SELECT jq_end_bits FROM jobqueue WHERE jq_end_bits = '0' LIMIT 1;"
);
51
if
(empty($jobInfo)) {
52
$response =
'0'
;
53
}
54
$status = 1;
55
ReportCachePurgeAll
();
56
$status = empty($status) ? JsonResponse::HTTP_INTERNAL_SERVER_ERROR : JsonResponse::HTTP_OK;
57
return
new
JsonResponse(array(
"status"
=> $response), $status);
58
}
59
}
60
61
register_plugin(
new
AjaxJobStatus
());
Request
Fossology\Lib\Plugin\DefaultPlugin
Definition:
DefaultPlugin.php:32
Fossology\Lib\Plugin\DefaultPlugin\getObject
getObject($name)
Definition:
DefaultPlugin.php:249
Fossology\UI\Ajax\AjaxJobStatus
Definition:
AjaxJobStatus.php:27
Fossology\Lib\Auth\Auth\PERM_READ
const PERM_READ
Definition:
Auth.php:54
Fossology\UI\Ajax
Definition:
AjaxAdminScheduler.php:20
Auth
ReportCachePurgeAll
ReportCachePurgeAll()
Purge all records from the report cache.
Definition:
common-cache.php:160
Fossology\UI\Ajax\AjaxJobStatus\handle
handle(Request $request)
: returns 1 when jobs are running else 0
Definition:
AjaxJobStatus.php:46
dbManager
fo_dbManager * dbManager
fo_dbManager object
Definition:
process.c:28
DbManager
JsonResponse
DefaultPlugin
src
www
ui
async
AjaxJobStatus.php
Generated on Mon Jun 29 2020 12:03:44 for FOSSology by
1.8.11