20 define(
"TITLE_MAINTAGENT", _(
"FOSSology Maintenance"));
30 public function __construct()
32 $this->Name =
"maintagent";
33 $this->Title = TITLE_MAINTAGENT;
34 $this->MenuList =
"Admin::Maintenance";
36 parent::__construct();
51 foreach ($_REQUEST as $key => $value) {
58 $user_pk = Auth::getUserId();
59 $groupId = Auth::getGroupId();
61 $job_pk = JobAddJob($user_pk, $groupId,
"Maintenance");
62 if (empty($job_pk) || ($job_pk < 0)) {
return _(
"Failed to insert job record");
65 $jq_pk =
JobQueueAdd($job_pk,
"maintagent", NULL, NULL, NULL, NULL, $options);
66 if (empty($jq_pk)) {
return _(
"Failed to insert task 'Maintenance' into job queue");
71 if (!$success) {
return($error_msg .
"\n" . $output);
74 return _(
"The maintenance job has been queued");
85 $Options = array(
"a"=>_(
"Run all non slow maintenance operations."),
86 "A"=>_(
"Run all maintenance operations."),
87 "F"=>_(
"Validate folder contents."),
89 "E"=>_(
"Remove orphaned rows from database."),
90 "L"=>_(
"Remove orphaned log files from file system."),
91 "N"=>_(
"Normalize priority "),
94 "R"=>_(
"Remove uploads with no pfiles."),
95 "T"=>_(
"Remove orphaned temp tables."),
96 "D"=>_(
"Vacuum Analyze the database."),
99 "I"=>_(
"Reindexing of database (This activity may take 5-10 mins. Execute only when system is not in use)."),
100 "v"=>_(
"verbose (turns on debugging output)")
104 $V.=
"<form method='post'>\n";
107 foreach ($Options as $option=>$description)
110 $V.=
"<input type='checkbox' name='$option' value='$option' > $description <p>\n";
114 $text = _(
"Queue the maintenance agent");
115 $V.=
"<input type='submit' value='$text'>\n";
118 $V.= _(
"More information about these operations can be found ");
120 $V.=
"<a href=http://www.fossology.org/projects/fossology/wiki/Maintagent> $text </a>";
122 $V.=
"<input type=hidden name=queue value=true>";
141 $V .=
"<font style='background-color:gold'>" . $Msg .
"</font>";
#define PLUGIN_DB_ADMIN
Plugin requires admin level permission on DB.
JobQueueAdd($job_pk, $jq_type, $jq_args, $jq_runonpfile, $Depends, $host=NULL, $jq_cmd_args=NULL)
Insert a jobqueue + jobdepends records.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
fo_communicate_with_scheduler($input, &$output, &$error_msg)
Communicate with scheduler, send commands to the scheduler, then get the output.
Queue the maintenance agent with the requested parameters.
This is the Plugin class. All plugins should:
DisplayForm()
Display the input form.
Output()
This function is called when user output is requested. This function is responsible for content...