restore code format after netbeans update

This commit is contained in:
jygaulier
2012-05-10 18:39:20 +02:00
parent d834d4f3f8
commit 22c492f69d
16 changed files with 340 additions and 342 deletions

View File

@@ -23,6 +23,7 @@ class task_Scheduler
const METHOD_FORK = 'METHOD_FORK';
const METHOD_PROC_OPEN = 'METHOD_PROC_OPEN';
const ERR_ALREADY_RUNNING = 114; // aka EALREADY (Operation already in progress)
private $method;
private $input;
protected $output;
@@ -51,7 +52,7 @@ class task_Scheduler
return appbox::get_instance(\bootstrap::getCore())->get_connection();
}
public function run($input=null, OutputInterface $output = null)
public function run($input = null, OutputInterface $output = null)
{
require_once dirname(__FILE__) . '/../../bootstrap.php';
$this->input = $input;
@@ -249,12 +250,12 @@ class task_Scheduler
}
$taskPoll[$tkey] = array(
"task" => $task,
"task" => $task,
"current_status" => $status,
"cmd" => $cmd,
"args" => $args,
"killat" => null,
"sigterm_sent" => false
"cmd" => $cmd,
"args" => $args,
"killat" => null,
"sigterm_sent" => false
);
if ($this->method == self::METHOD_PROC_OPEN) {
$taskPoll[$tkey]['process'] = NULL;

View File

@@ -4,25 +4,21 @@ abstract class task_abstract
{
const LAUCHED_BY_BROWSER = 1;
const LAUCHED_BY_COMMANDLINE = 2;
const STATE_TOSTOP = 'tostop';
const STATE_STARTED = 'started';
const STATE_TOSTART = 'tostart';
const STATE_TORESTART = 'torestart';
const STATE_STOPPED = 'stopped';
const STATE_TODELETE = 'todelete';
const RUNNER_MANUAL = 'manual';
const RUNNER_SCHEDULER = 'scheduler';
const STATE_OK = 'STATE_OK';
const STATE_MAXMEGSREACHED = 'STATE_MAXMEGS';
const STATE_MAXRECSDONE = 'STATE_MAXRECS';
const STATE_FINISHED = 'STATE_FINISHED';
const SIGNAL_SCHEDULER_DIED = 'SIGNAL_SCHEDULER_DIED';
const ERR_ALREADY_RUNNING = 114; // aka EALREADY (Operation already in progress)
protected $suicidable = false;
protected $launched_by = 0;
@@ -94,7 +90,7 @@ abstract class task_abstract
protected $taskid = NULL;
protected $system = ''; // "DARWIN", "WINDOWS" , "LINUX"...
protected $argt = array(
"--help" => array("set" => false, "values" => array(), "usage" => " (no help available)")
"--help" => array("set" => false, "values" => array(), "usage" => " (no help available)")
);
public function getState()
@@ -172,7 +168,7 @@ abstract class task_abstract
$sql = 'UPDATE task2 SET name = :title WHERE task_id = :taskid';
$stmt = $conn->prepare($sql);
$stmt->execute(array(':title' => $title, ':taskid' => $this->getID()));
$stmt->execute(array(':title' => $title, ':taskid' => $this->getID()));
$stmt->closeCursor();
$this->title = $title;
@@ -186,7 +182,7 @@ abstract class task_abstract
$sql = 'UPDATE task2 SET settings = :settings WHERE task_id = :taskid';
$stmt = $conn->prepare($sql);
$stmt->execute(array(':settings' => $settings, ':taskid' => $this->getID()));
$stmt->execute(array(':settings' => $settings, ':taskid' => $this->getID()));
$stmt->closeCursor();
$this->settings = $settings;
@@ -390,7 +386,7 @@ abstract class task_abstract
$this->running = $stat;
}
protected function pause($when_started=0)
protected function pause($when_started = 0)
{
$this->log($this->records_done . ' records done');
if ($this->running) {// && $this->records_done == 0)
@@ -409,7 +405,7 @@ abstract class task_abstract
}
}
final public function run($runner, $input=null, $output = null)
final public function run($runner, $input = null, $output = null)
{
$this->input = $input;
$this->output = $output;
@@ -500,7 +496,7 @@ abstract class task_abstract
}
}
function traceRam($msg='')
function traceRam($msg = '')
{
static $lastt = null;
$t = explode(' ', ($ut = microtime()));
@@ -568,9 +564,9 @@ abstract class task_abstract
$settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tasksettings>\n</tasksettings>";
$params = array(
':active' => 1
, ':name' => $class_name::getName()
, ':class' => $class_name
':active' => 1
, ':name' => $class_name::getName()
, ':class' => $class_name
, ':settings' => $settings
);
$stmt = $appbox->get_connection()->prepare($sql);
@@ -605,7 +601,7 @@ abstract class task_abstract
$conn = connection::getPDOConnection();
$sql = 'UPDATE task2 SET completed = :p WHERE task_id = :taskid';
$stmt = $conn->prepare($sql);
$stmt->execute(array(':p' => $p, ':taskid' => $this->getID()));
$stmt->execute(array(':p' => $p, ':taskid' => $this->getID()));
$stmt->closeCursor();
$this->completed_percentage = $p;
} catch (Exception $e) {

View File

@@ -62,7 +62,7 @@ abstract class task_databoxAbstract extends task_abstract
if ($this->mono_sbas_id) {
$sql = 'SELECT sbas_id, task2.* FROM sbas, task2 WHERE task_id=:taskid AND sbas_id=:sbas_id';
$stmt = $conn->prepare($sql);
$stmt->execute(array(':taskid' => $this->getID(), ':sbas_id' => $this->mono_sbas_id));
$stmt->execute(array(':taskid' => $this->getID(), ':sbas_id' => $this->mono_sbas_id));
} else {
$sql = 'SELECT sbas_id, task2.* FROM sbas, task2 WHERE task_id = :taskid';
$stmt = $conn->prepare($sql);

View File

@@ -171,7 +171,7 @@ class task_manager
try {
// $testclass = new $classname(null);
if ($classname::interfaceAvailable()) {
$tasks[] = array("class" => $classname, "name" => $classname::getName(), "err" => null);
$tasks[] = array("class" => $classname, "name" => $classname::getName(), "err" => null);
}
} catch (Exception $e) {

View File

@@ -86,7 +86,7 @@ class task_period_apibridge extends task_appboxAbstract
$params = array(
':status' => Bridge_Element::STATUS_ERROR
, ':id' => $row['id']
, ':id' => $row['id']
);
$stmt = $appbox->get_connection()->prepare($sql);
@@ -160,11 +160,11 @@ class task_period_apibridge extends task_appboxAbstract
case Bridge_Element::STATUS_ERROR:
$params = array(
'usr_id' => $account->get_user()->get_id()
, 'reason' => $error_message
'usr_id' => $account->get_user()->get_id()
, 'reason' => $error_message
, 'account_id' => $account->get_id()
, 'sbas_id' => $element->get_record()->get_sbas_id()
, 'record_id' => $element->get_record()->get_record_id()
, 'sbas_id' => $element->get_record()->get_sbas_id()
, 'record_id' => $element->get_record()->get_record_id()
);
$events_mngr = eventsmanager_broker::getInstance(appbox::get_instance(\bootstrap::getCore()), $Core);
$events_mngr->trigger('__BRIDGE_UPLOAD_FAIL__', $params);

View File

@@ -27,9 +27,9 @@ class task_period_archive extends task_abstract
* @var <type>
*/
protected $mimeTypes = array(
"jpg" => "image/jpeg",
"jpg" => "image/jpeg",
"jpeg" => "image/jpeg",
"pdf" => "application/pdf"
"pdf" => "application/pdf"
);
/**
@@ -219,27 +219,27 @@ class task_period_archive extends task_abstract
ob_start();
?>
<form name="graphicForm" onsubmit="return(false);" method="post">
<?php echo _('task::archive:archivage sur base/collection/') ?> :
<?php echo _('task::archive:archivage sur base/collection/') ?> :
<select onchange="chgxmlpopup(this, 'base_id');" name="base_id">
<option value="">...</option>
<?php
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
print("<option value=\"" . $collection->get_base_id() . "\">" . $databox->get_viewname() . " / " . $collection->get_name() . "</option>");
}
}
?>
<?php
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
print("<option value=\"" . $collection->get_base_id() . "\">" . $databox->get_viewname() . " / " . $collection->get_name() . "</option>");
}
}
?>
</select>
<br/>
<br/>
<?php echo _('task::_common_:hotfolder') ?>
<?php echo _('task::_common_:hotfolder') ?>
<input type="text" name="hotfolder" style="width:400px;" onchange="chgxmltxt(this, 'hotfolder');" value=""><br/>
<br/>
<?php echo _('task::_common_:periodicite de la tache') ?>&nbsp;:&nbsp;
<?php echo _('task::_common_:periodicite de la tache') ?>&nbsp;:&nbsp;
<input type="text" name="period" style="width:40px;" onchange="chgxmltxt(this, 'period');" value="">&nbsp;<?php echo _('task::_common_:secondes (unite temporelle)') ?><br/>
<br/>
<?php echo _('task::archive:delai de \'repos\' avant traitement') ?>&nbsp;:&nbsp;
<?php echo _('task::archive:delai de \'repos\' avant traitement') ?>&nbsp;:&nbsp;
<input type="text" name="cold" style="width:40px;" onchange="chgxmltxt(this, 'cold');" value="">&nbsp;<?php echo _('task::_common_:secondes (unite temporelle)') ?><br/>
<br/>
<input type="checkbox" name="move_archived" onchange="chgxmlck(this, 'move_archived');">&nbsp;<?php echo _('task::archive:deplacer les fichiers archives dans _archived') ?>
@@ -335,23 +335,23 @@ class task_period_archive extends task_abstract
if ($this->sxTaskSettings->files && $this->sxTaskSettings->files->file) {
foreach ($this->sxTaskSettings->files->file as $ft)
$this->tmask[] = array(
"mask" => (string) $ft["mask"]
"mask" => (string) $ft["mask"]
, "caption" => (string) $ft["caption"]
, "accept" => (string) $ft["accept"]
, "accept" => (string) $ft["accept"]
);
}
if ($this->sxTaskSettings->files && $this->sxTaskSettings->files->grouping) {
foreach ($this->sxTaskSettings->files->grouping as $ft)
$this->tmaskgrp[] = array(
"mask" => (string) $ft["mask"]
, "caption" => (string) $ft["caption"]
"mask" => (string) $ft["mask"]
, "caption" => (string) $ft["caption"]
, "representation" => (string) $ft["representation"]
, "accept" => (string) $ft["accept"]
, "accept" => (string) $ft["accept"]
);
}
if (count($this->tmask) == 0) {
// no mask defined : accept all kind of files
$this->tmask[] = array("mask" => ".*", "caption" => "", "accept" => "");
$this->tmask[] = array("mask" => ".*", "caption" => "", "accept" => "");
}
// main loop
@@ -899,7 +899,7 @@ class task_period_archive extends task_abstract
// this group in new (to be created)
// do we need one (or both) linked file ? (caption or representation)
$err = false;
$flink = array('caption' => null, 'representation' => null);
$flink = array('caption' => null, 'representation' => null);
foreach ($flink as $linkName => $v) {
if (isset($grpSettings[$linkName]) && $grpSettings[$linkName] != '') {
@@ -1727,7 +1727,7 @@ class task_period_archive extends task_abstract
$params = array(
':rid_parent' => $grp_rid
, ':rid_child' => $rid
, ':rid_child' => $rid
);
$stmt = $connbas->prepare($sql);

View File

@@ -126,7 +126,7 @@ class task_period_batchupload extends task_appboxAbstract
$sql = 'UPDATE uplbatch SET complete="2", error = :error'
. ' WHERE uplbatch_id = :batch_id';
$stmt = $conn->prepare($sql);
$stmt->execute(array(':error' => $errors, ':batch_id' => $batch_id));
$stmt->execute(array(':error' => $errors, ':batch_id' => $batch_id));
$stmt->closeCursor();
$this->log(sprintf(('finishing batch %s'), $row['uplbatch_id']));

View File

@@ -17,13 +17,14 @@ class task_period_cindexer extends task_abstract
{
// how to execute indexer (choose in 'run2' method)
private $method;
const METHOD_FORK = 'METHOD_FORK';
const METHOD_EXEC = 'METHOD_EXEC';
const METHOD_PROC_OPEN = 'METHOD_PROC_OPEN';
const ERR_EXECUTABLE_NOT_FOUND = 2; // aka ENOENT (No such file or directory)
const ERR_CRASHED = 14; // aka EFAULT (Bad address)
const ERR_CANT_FORK = 3; // aka ESRCH (No such process)
/**
*
* @var string
@@ -278,7 +279,7 @@ class task_period_cindexer extends task_abstract
?>
<form name="graphicForm" onsubmit="return(false);" method="post">
<br/>
<?php echo _('task::cindexer:executable') ?>&nbsp;:&nbsp;
<?php echo _('task::cindexer:executable') ?>&nbsp;:&nbsp;
<input type="text" name="binpath" style="width:300px;" onchange="chgxmltxt(this, 'binpath');" value="">&nbsp;/&nbsp;<?php echo $appname ?>
<br/>
<?php echo _('task::cindexer:host') ?>&nbsp;:&nbsp;<input type="text" name="host" style="width:100px;" onchange="chgxmltxt(this, 'host');" value="">
@@ -289,13 +290,13 @@ class task_period_cindexer extends task_abstract
<br/>
<?php echo _('task::cindexer:user') ?>&nbsp;:&nbsp;<input type="text" name="user" style="width:200px;" onchange="chgxmltxt(this, 'user');" value="">
<br/>
<?php echo _('task::cindexer:password') ?>&nbsp;:&nbsp;<input type="password" name="password" style="width:200px;" onchange="chgxmltxt(this, 'password');" value="">
<?php echo _('task::cindexer:password') ?>&nbsp;:&nbsp;<input type="password" name="password" style="width:200px;" onchange="chgxmltxt(this, 'password');" value="">
<br/>
<br/>
<?php echo _('task::cindexer:control socket') ?>&nbsp;:&nbsp;<input type="text" name="socket" style="width:50px;" onchange="chgxmltxt(this, 'socket');" value="">
<br/>
<?php echo _('task::cindexer:Debug mask') ?>&nbsp;:&nbsp;<input type="text" name="debugmask" style="width:50px;" onchange="chgxmltxt(this, 'debugmask');" value="">
<?php echo _('task::cindexer:Debug mask') ?>&nbsp;:&nbsp;<input type="text" name="debugmask" style="width:50px;" onchange="chgxmltxt(this, 'debugmask');" value="">
<br/>
<br/>
@@ -304,20 +305,20 @@ class task_period_cindexer extends task_abstract
<br/>
</div>
<?php echo _('task::cindexer:MySQL charset') ?>&nbsp;:&nbsp;<input type="text" name="charset" style="width:100px;" onchange="chgxmltxt(this, 'charset');" value="">
<?php echo _('task::cindexer:MySQL charset') ?>&nbsp;:&nbsp;<input type="text" name="charset" style="width:100px;" onchange="chgxmltxt(this, 'charset');" value="">
<br/>
<input type="checkbox" name="nolog" onclick="chgxmlck(this, 'nolog');">&nbsp;<?php echo _('task::cindexer:do not (sys)log, but out to console)') ?>
<br/>
<?php echo _('task::cindexer:default language for new candidates') ?>&nbsp;:&nbsp;<input type="text" name="clng" style="width:50px;" onchange="chgxmltxt(this, 'clng');" value="">
<?php echo _('task::cindexer:default language for new candidates') ?>&nbsp;:&nbsp;<input type="text" name="clng" style="width:50px;" onchange="chgxmltxt(this, 'clng');" value="">
<br/>
<br/>
<hr/>
<br/>
<?php echo _('task::cindexer:windows specific') ?>&nbsp;:<br/>
<?php echo _('task::cindexer:windows specific') ?>&nbsp;:<br/>
<input type="checkbox" name="winsvc_run" onclick="chgxmlck(this, 'run');">&nbsp;<?php echo _('task::cindexer:run as application, not as service') ?>
<br/>

View File

@@ -460,7 +460,7 @@ class task_period_ftp extends task_appboxAbstract
$obj[] = array(
"name" => $subdef, "size" => filesize($localfile),
"name" => $subdef, "size" => filesize($localfile),
"shortXml" => ($sdcaption ? $sdcaption : '')
);
@@ -488,7 +488,7 @@ class task_period_ftp extends task_appboxAbstract
$sql = "UPDATE ftp_export_elements"
. " SET done = :done, error='1' WHERE id = :file_id";
$stmt = $conn->prepare($sql);
$stmt->execute(array(':done' => $done, ':file_id' => $file['id']));
$stmt->execute(array(':done' => $done, ':file_id' => $file['id']));
$stmt->closeCursor();
}
}

View File

@@ -677,7 +677,7 @@ class task_period_outofdate extends task_abstract
. " SET " . $sqlset[0]
. " WHERE " . $w;
$ret[] = array('sql' => $sql, 'params' => $params);
$ret[] = array('sql' => $sql, 'params' => $params);
}
@@ -709,7 +709,7 @@ class task_period_outofdate extends task_abstract
. " SET " . $sqlset[1]
. " WHERE " . $w;
$ret[] = array('sql' => $sql, 'params' => $params);
$ret[] = array('sql' => $sql, 'params' => $params);
}
@@ -738,7 +738,7 @@ class task_period_outofdate extends task_abstract
. " SET " . $sqlset[2]
. " WHERE " . $w;
$ret[] = array('sql' => $sql, 'params' => $params);
$ret[] = array('sql' => $sql, 'params' => $params);
}
return($ret);
@@ -779,12 +779,12 @@ class task_period_outofdate extends task_abstract
foreach ($status as $n => $stat) {
$labelon = $stat['labelon'] ? $stat['labelon'] : ($n . '-ON');
$labeloff = $stat['labeloff'] ? $stat['labeloff'] : ($n . '-OFF');
$ret['status_bits'][] = array('n' => $n, 'value' => 0, 'label' => $labeloff);
$ret['status_bits'][] = array('n' => $n, 'value' => 1, 'label' => $labelon);
$ret['status_bits'][] = array('n' => $n, 'value' => 0, 'label' => $labeloff);
$ret['status_bits'][] = array('n' => $n, 'value' => 1, 'label' => $labelon);
}
foreach ($databox->get_collections() as $collection)
$ret['collections'][] = array('id' => $collection->get_coll_id(), 'name' => $collection->get_name());
$ret['collections'][] = array('id' => $collection->get_coll_id(), 'name' => $collection->get_name());
} catch (Exception $e) {
}

View File

@@ -83,7 +83,7 @@ class task_period_upgradetov31 extends task_abstract
$sql = 'UPDATE record SET uuid = :uuid WHERE record_id = :record_id';
$params = array(
':uuid' => $uuid
':uuid' => $uuid
, ':record_id' => $row['record_id']
);
$stmt = $connbas->prepare($sql);

View File

@@ -160,7 +160,7 @@ class task_period_upgradetov32 extends task_abstract
}
}
try {
$stmt_original->execute(array(':originalname' => $value, ':record_id' => $row['record_id']));
$stmt_original->execute(array(':originalname' => $value, ':record_id' => $row['record_id']));
} catch (Exception $e) {
}
@@ -200,8 +200,8 @@ class task_period_upgradetov32 extends task_abstract
$stmt->execute(array(
':record_id' => $record->get_record_id()
, ':name' => $name
, ':value' => $value
, ':name' => $name
, ':value' => $value
));
}
} catch (Exception $e) {
@@ -271,8 +271,8 @@ class task_period_upgradetov32 extends task_abstract
$metadatas[$databox_field->get_id()] = array(
'meta_struct_id' => $databox_field->get_id()
, 'meta_id' => null
, 'value' => $value
, 'meta_id' => null
, 'value' => $value
);
}
}

View File

@@ -452,7 +452,7 @@ class task_period_workflow01 extends task_databoxAbstract
phrasea::headers(200, true, 'text/json', 'UTF-8', false);
$retjs = array('result' => NULL,
$retjs = array('result' => NULL,
'date_fields' => array(),
'status_bits' => array(),
'collections' => array()
@@ -471,18 +471,18 @@ class task_period_workflow01 extends task_databoxAbstract
foreach ($status as $n => $s) {
$retjs['status_bits'][] = array(
'n' => $n,
'value' => 0,
'label' => $s['labeloff'] ? $s['labeloff'] : 'non ' . $s['name']);
'n' => $n,
'value' => 0,
'label' => $s['labeloff'] ? $s['labeloff'] : 'non ' . $s['name']);
$retjs['status_bits'][] = array(
'n' => $n,
'n' => $n,
'value' => 1,
'label' => $s['labelon'] ? $s['labelon'] : $s['name']);
}
$base_ids = $user->ACL()->get_granted_base(array(), array($sbas_id));
foreach ($base_ids as $base_id => $collection) {
$retjs['collections'][] = array('id' => (string) ($collection->get_coll_id()), 'name' => $collection->get_name());
$retjs['collections'][] = array('id' => (string) ($collection->get_coll_id()), 'name' => $collection->get_name());
}
} catch (Exception $e) {