14 require_once(
"$MODDIR/lib/php/common-cli.php");
18 error_reporting(E_NOTICE & E_STRICT);
20 $Usage =
"Usage: " . basename($argv[0]) .
" [options]
21 --help = display this help text
22 --username = user name
24 --groupname = a group the user belongs to (default active group)
25 --uploadId = id of upload
28 $opts = getopt(
"c:", array(
"help",
"username:",
"groupname:",
"uploadId:",
"password:"));
30 if (array_key_exists(
"help", $opts)) {
35 if (!array_key_exists(
"uploadId", $opts)) {
36 echo
"no uploadId supplied\n";
40 $uploadId = $opts[
"uploadId"];
42 $user = array_key_exists(
"username", $opts) ? $opts[
"username"] :
'';
43 $group = array_key_exists(
"groupname", $opts) ? $opts[
"groupname"] :
'';
44 $passwd = array_key_exists(
"password", $opts) ? $opts[
"password"] :
null;
48 $userId = $SysConf[
'auth'][
'UserId'];
49 $groupId = $SysConf[
'auth'][
'GroupId'];
52 $jobDao = $GLOBALS[
'container']->get(
"dao.job");
53 $jobStatuses = $jobDao->getAllJobStatus($uploadId, $userId, $groupId);
55 foreach ($jobStatuses as $jobStatus) {
57 case JobStatus::FAILED:
58 print
"status=ERROR\n";
60 case JobStatus::RUNNING;
69 print
"status=SCANNING\n";
74 $dbManager = $GLOBALS[
'container']->get(
"db.manager");
79 $uploadDao = $GLOBALS[
'container']->get(
"dao.upload");
81 if ($uploadDao->getUpload($uploadId) ==
null) {
82 $status =
"NON_EXISTENT";
83 }
else if (!$uploadDao->isAccessible($uploadId, $groupId)) {
84 $status =
"INACCESSIBLE";
87 switch($uploadBrowseProxy->getStatus($uploadId)) {
88 case UploadStatus::OPEN:
91 case UploadStatus::IN_PROGRESS:
92 $status =
"IN_PROGRESS";
94 case UploadStatus::CLOSED:
97 case UploadStatus::REJECTED:
101 $status =
"ERROR: invalid status";
103 }
catch(Exception $e) {
104 $status =
"ERROR: ".$e->getMessage();
107 print
"status=$status\n";
account_check(&$user, &$passwd, &$group="")
check if this account is correct
cli_Init()
Initialize the fossology environment for CLI use. This routine loads the plugins so they can be use b...