mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 08:39:07 +01:00
Admin - add filter for periodic runs
- Store & display exec results for periodic runs
This commit is contained in:
parent
b7c359a6f1
commit
d7c5dc71cf
@ -498,6 +498,16 @@ abstract class admin_cmd
|
||||
{
|
||||
$query['col_filter']['remote_id'] = null;
|
||||
}
|
||||
if ((string)$query['col_filter']['periodic'] === '0')
|
||||
{
|
||||
$query['col_filter']['rrule'] = null;
|
||||
}
|
||||
else if ((string)$query['col_filter']['periodic'] === '1')
|
||||
{
|
||||
$query['col_filter'][] = 'cmd_rrule IS NOT NULL';
|
||||
}
|
||||
unset($query['col_filter']['periodic']);
|
||||
|
||||
return admin_cmd::$sql->get_rows($query,$rows,$readonlys);
|
||||
}
|
||||
|
||||
@ -1048,15 +1058,17 @@ abstract class admin_cmd
|
||||
// instanciate single periodic execution object
|
||||
$single = $cmd->as_array();
|
||||
$single['parent'] = $single['id'];
|
||||
unset($single['id'], $single['uid'], $single['rrule'], $single['created'], $single['modified'], $single['modifier']);
|
||||
unset($single['id'], $single['uid'], $single['rrule'], $single['created'], $single['modified'], $single['modifier'], $single['async_job_id']);
|
||||
$periodic = admin_cmd::instanciate($single);
|
||||
|
||||
try {
|
||||
$periodic->run(null, false);
|
||||
$value = $periodic->run(null, false);
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
error_log(__METHOD__."(".array2string($data).") periodic execution failed: ".$ex->getMessage());
|
||||
}
|
||||
$periodic->value = $value;
|
||||
$periodic->save();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,6 +38,7 @@ class admin_cmds
|
||||
|
||||
if (!$rows) return array();
|
||||
|
||||
$async = new Api\Asyncservice();
|
||||
foreach($rows as &$row)
|
||||
{
|
||||
try {
|
||||
@ -47,10 +48,31 @@ class admin_cmds
|
||||
catch (Exception $e) {
|
||||
$row['title'] = $e->getMessage();
|
||||
}
|
||||
$row['data'] = !($data = json_php_unserialize($row['data'])) ? '' :
|
||||
json_encode($data+(empty($row['rrule'])?array():array('rrule' => $row['rrule'])),
|
||||
JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
|
||||
|
||||
if(method_exists($cmd, 'summary'))
|
||||
{
|
||||
$row['data'] = $cmd->summary();
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['data'] = !($data = json_php_unserialize($row['data'])) ? '' :
|
||||
json_encode($data+(empty($row['rrule'])?array():array('rrule' => $row['rrule'])),
|
||||
JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
if($row['rrule'])
|
||||
{
|
||||
$rrule = calendar_rrule::event2rrule(calendar_rrule::parseRrule($row['rrule'],true)+array(
|
||||
'start' => time(),
|
||||
'tzid'=> Api\DateTime::$server_timezone->getName()
|
||||
));
|
||||
$row['rrule'] = ''.$rrule;
|
||||
}
|
||||
if(!$row['scheduled'] && $cmd && $cmd->async_job_id)
|
||||
{
|
||||
$job = $async->read($cmd->async_job_id);
|
||||
|
||||
$row['scheduled'] = $job ? $job[$cmd->async_job_id]['next'] : null;
|
||||
}
|
||||
if ($row['status'] == admin_cmd::scheduled)
|
||||
{
|
||||
$row['class'] = 'AllowDelete';
|
||||
@ -98,7 +120,12 @@ class admin_cmds
|
||||
}
|
||||
unset($cmd);
|
||||
}
|
||||
$periodic = array(
|
||||
0 => 'no',
|
||||
1 => 'yes'
|
||||
);
|
||||
$tpl->exec('admin.admin_cmds.index',$content,array(
|
||||
'periodic' => $periodic,
|
||||
'status' => admin_cmd::$stati,
|
||||
'remote_id' => admin_cmd::remote_sites(),
|
||||
),array(),$content);
|
||||
|
@ -11,6 +11,7 @@
|
||||
<column/>
|
||||
<column width="120"/>
|
||||
<column width="120"/>
|
||||
<column width="120"/>
|
||||
<column width="30%" minWidth="120"/>
|
||||
<column/>
|
||||
<column/>
|
||||
@ -20,6 +21,7 @@
|
||||
<nextmatch-header label="Title" id="title"/>
|
||||
<nextmatch-header label="Requested" id="requested"/>
|
||||
<nextmatch-sortheader label="Scheduled" id="scheduled"/>
|
||||
<nextmatch-filterheader empty_label="Periodic" id="periodic"/>
|
||||
<nextmatch-filterheader options="Remote" id="remote_id"/>
|
||||
<nextmatch-sortheader label="Created" id="created"/>
|
||||
<nextmatch-accountfilter empty_label="Creator" id="creator"/>
|
||||
@ -31,12 +33,14 @@
|
||||
<description id="${row}[title]" statustext="$row_cont[data]"/>
|
||||
<url-email id="${row}[requested_email]" readonly="true" statustext="$row_cont[comment]"/>
|
||||
<date-time id="${row}[scheduled]" readonly="true"/>
|
||||
<description id="${row}[rrule]"/>
|
||||
<select id="${row}[remote_id]" readonly="true"/>
|
||||
<date-time id="${row}[created]" readonly="true"/>
|
||||
<select-account id="${row}[creator]" readonly="true" statustext="$row_cont[creator_email]"/>
|
||||
<vbox>
|
||||
<select id="${row}[status]" readonly="true"/>
|
||||
<description id="${row}[error]" class="redItalic"/>
|
||||
<description id="${row}[value]"/>
|
||||
</vbox>
|
||||
<date-time id="${row}[modified]" readonly="true"/>
|
||||
<select-account id="${row}[modifier]" readonly="true" statustext="$row_cont[modifier_email]"/>
|
||||
|
Loading…
Reference in New Issue
Block a user