7 public function clear($section=
'') {
12 $this->_properties=array();
18 $oTPL =
dbx()->get_system_obj(
'dbxTPL');
19 if (is_object($oTPL) && method_exists($oTPL,
'cleanup_optional_placeholders')) {
25 if (is_array($xnorep)) {
26 for($i=0; $i < 2; $i++) {
27 foreach ($xnorep as $id => $norep) {
38 $key = preg_replace(
'/[^A-Za-z0-9_.:-]+/',
'_', (
string)$key);
39 $key = trim($key,
'_');
40 return (strpos($key,
'dbxprocess_') === 0) ? $key :
'dbxprocess_' . $key;
43 public function init_job($key, $title =
'', $tasks = array(), $meta = array()) {
45 $state = is_array($meta) ? $meta : array();
47 $state[
'proc_key'] = $jobKey;
49 $state[
'tasks'] = is_array($tasks) ? array_values($tasks) : array();
56 $state[
'started_at'] =
$state[
'started_at'] ?? date(
'Y-m-d H:i:s');
57 $state[
'updated_at'] = date(
'Y-m-d H:i:s');
64 $state =
dbx()->get_remember_var($this->
job_key($key), array(), $this->_process_remember_modul);
75 $state[
'updated_at'] = date(
'Y-m-d H:i:s');
76 dbx()->set_remember_var($jobKey,
$state, $this->_process_remember_modul);
81 dbx()->set_remember_var($this->
job_key($key), array(), $this->_process_remember_modul);
86 $cmd = strtolower(trim((
string)$cmd));
88 if ($cmd ==
'restart') {
91 'proc_key' => $jobKey,
93 'message' =>
'process restarted',
96 'updated_at' => date(
'Y-m-d H:i:s'),
103 'proc_key' => $jobKey,
105 'message' =>
'no active state',
111 $status =
$state[
'status'] ??
'new';
113 if ($cmd ==
'pause' && !in_array($status, array(
'finished',
'error',
'canceled'),
true)) {
114 $state[
'status'] =
'paused';
115 $state[
'paused_at'] = date(
'Y-m-d H:i:s');
116 $state[
'message'] =
'process paused';
117 } elseif (($cmd ==
'resume' || $cmd ==
'continue') && in_array($status, array(
'paused',
'canceled',
'new'),
true)) {
118 $state[
'status'] =
'running';
119 $state[
'resumed_at'] = date(
'Y-m-d H:i:s');
120 $state[
'message'] = ($cmd ==
'continue') ?
'process continued' :
'process resumed';
121 } elseif ($cmd ==
'cancel' && !in_array($status, array(
'finished',
'error'),
true)) {
122 $state[
'status'] =
'canceled';
123 $state[
'canceled_at'] = date(
'Y-m-d H:i:s');
124 $state[
'message'] =
'process canceled';
133 $oInterpreter=
dbx()->get_system_obj(
"dbxInterpreter");
137 echo
'<br><br><br>'.$response;
149 $count =count($processes);
154 if ($status==
'next') {
165 if (isset($processes[$stepp]))
$content=$processes[$stepp];
167 if ($status==
'end') {
169 $this->
clear($this->_section);
171 dbx()->debug(
"process ($process) return=($content)");
196 public function init($section) {
197 $this->_section=$section;
198 $this->
clear($section);
208 dbx()->debug(
"#Prozess Prozess=($process) Status=($status) content=($content) status=($status)",$processes);
Gemeinsame Basisklasse fuer dbXapp-System-, Modul- und Include-Objekte.
get_property($name, $default='', $section='', $modul='modul')
Liest eine Objekt- oder Session-Property.
set_property($name, $value, $section='', $modul='modul')
Speichert eine Objekt- oder Session-Property.
del_property($name, $section='', $modul='modul')
Loescht eine Objekt- oder Session-Property.
fast_response($response, $interpreter=1)
run($process='', $content=1, $fast_response=1)
init_job($key, $title='', $tasks=array(), $meta=array())
DBX schema administration.