25 require_once(
"$MODDIR/lib/php/common-cli.php");
29 error_reporting(E_NOTICE & E_STRICT);
31 $Usage =
"Usage: " . basename($argv[0]) .
" [options] 32 --help = display this help text 33 --username = user name 35 --groupname = a group the user belongs to (default active group) 36 --uploadId = id of upload 39 $opts = getopt(
"c:", array(
"help",
"username:",
"groupname:",
"uploadId:",
"password:"));
41 if (array_key_exists(
"help", $opts)) {
46 if (!array_key_exists(
"uploadId", $opts)) {
47 echo
"no uploadId supplied\n";
51 $uploadId = $opts[
"uploadId"];
53 $user = array_key_exists(
"username", $opts) ? $opts[
"username"] :
'';
54 $group = array_key_exists(
"groupname", $opts) ? $opts[
"groupname"] :
'';
55 $passwd = array_key_exists(
"password", $opts) ? $opts[
"password"] : null;
59 $userId = $SysConf[
'auth'][
'UserId'];
60 $groupId = $SysConf[
'auth'][
'GroupId'];
63 $jobDao = $GLOBALS[
'container']->get(
"dao.job");
64 $jobStatuses = $jobDao->getAllJobStatus($uploadId, $userId, $groupId);
66 foreach ($jobStatuses as $jobStatus) {
68 case JobStatus::FAILED:
69 print
"status=ERROR\n";
71 case JobStatus::RUNNING;
80 print
"status=SCANNING\n";
85 $dbManager = $GLOBALS[
'container']->get(
"db.manager");
90 $uploadDao = $GLOBALS[
'container']->get(
"dao.upload");
92 if ($uploadDao->getUpload($uploadId) == null) {
93 $status =
"NON_EXISTENT";
94 }
else if (!$uploadDao->isAccessible($uploadId, $groupId)) {
95 $status =
"INACCESSIBLE";
98 switch($uploadBrowseProxy->getStatus($uploadId)) {
99 case UploadStatus::OPEN:
102 case UploadStatus::IN_PROGRESS:
103 $status =
"IN_PROGRESS";
105 case UploadStatus::CLOSED:
108 case UploadStatus::REJECTED:
109 $status =
"REJECTED";
112 $status =
"ERROR: invalid status";
114 }
catch(Exception $e) {
115 $status =
"ERROR: ".$e->getMessage();
118 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...