many renames to camelcase

This commit is contained in:
jygaulier
2012-05-07 11:08:59 +02:00
parent 1dc54a2e9d
commit a816387804
28 changed files with 2093 additions and 2465 deletions

View File

@@ -17,23 +17,21 @@
abstract class task_appboxAbstract extends task_abstract
{
abstract protected function retrieve_content(appbox $appbox);
abstract protected function retrieveContent(appbox $appbox);
abstract protected function process_one_content(appbox $appbox, Array $row);
abstract protected function processOneContent(appbox $appbox, Array $row);
abstract protected function post_process_one_content(appbox $appbox, Array $row);
abstract protected function postProcessOneContent(appbox $appbox, Array $row);
protected function run2()
{
// printf("%s(%d)\n", __FILE__, __LINE__);
$this->running = TRUE;
while ($this->running) {
// printf("%s(%d)\n", __FILE__, __LINE__);
try {
$conn = connection::getPDOConnection();
} catch (Exception $e) {
$this->log($e->getMessage());
if ($this->get_runner() == self::RUNNER_SCHEDULER) {
if ($this->getRunner() == self::RUNNER_SCHEDULER) {
$this->log(("Warning : abox connection lost, restarting in 10 min."));
for ($t = 60 * 10; $this->running && $t; $t -- ) // DON'T do sleep(600) because it prevents ticks !
@@ -45,60 +43,57 @@ abstract class task_appboxAbstract extends task_abstract
// runner = manual : can't restart so simply quit
}
$this->running = FALSE;
return;
}
// printf("%s(%d)\n", __FILE__, __LINE__);
$this->set_last_exec_time();
$this->setLastExecTime();
try {
$sql = 'SELECT task2.* FROM task2 WHERE task_id = :taskid LIMIT 1';
$stmt = $conn->prepare($sql);
$stmt->execute(array(':taskid' => $this->get_task_id()));
$stmt->execute(array(':taskid' => $this->getID()));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$this->records_done = 0;
$duration = time();
} catch (Exception $e) {
// printf("%s(%d)\n", __FILE__, __LINE__);
// failed sql, simply return
$this->running = FALSE;
return;
}
// printf("%s(%d)\n", __FILE__, __LINE__);
if ($row) {
if ( ! $this->running)
break;
$appbox = appbox::get_instance(\bootstrap::getCore());
try {
$this->load_settings(simplexml_load_string($row['settings']));
$this->loadSettings(simplexml_load_string($row['settings']));
} catch (Exception $e) {
$this->log($e->getMessage());
continue;
}
// printf("%s(%d)\n", __FILE__, __LINE__);
$process_ret = $this->process($appbox);
// printf("%s (%d) process_ret=%s \n", __FILE__, __LINE__, var_export($process_ret, true));
// $this->check_current_xxxstate();
switch ($process_ret) {
case self::STATE_MAXMEGSREACHED:
case self::STATE_MAXRECSDONE:
if ($this->get_runner() == self::RUNNER_SCHEDULER) {
$this->set_status(self::STATUS_TORESTART);
if ($this->getRunner() == self::RUNNER_SCHEDULER) {
$this->setState(self::STATUS_TORESTART);
$this->running = FALSE;
}
break;
case self::STATUS_TOSTOP:
$this->set_status(self::STATUS_TOSTOP);
$this->setState(self::STATUS_TOSTOP);
$this->running = FALSE;
break;
case self::STATUS_TODELETE: // formal 'suicidable'
$this->set_status(self::STATUS_TODELETE);
$this->setState(self::STATUS_TODELETE);
$this->running = FALSE;
break;
@@ -107,7 +102,7 @@ abstract class task_appboxAbstract extends task_abstract
}
} // if(row)
$this->increment_loops();
$this->incrementLoops();
$this->pause($duration);
} // while running
@@ -120,20 +115,17 @@ abstract class task_appboxAbstract extends task_abstract
*/
protected function process(appbox $appbox)
{
// printf("%s(%d)\n", __FILE__, __LINE__);
$ret = self::STATE_OK;
$conn = $appbox->get_connection();
$tsub = array();
try {
// get the records to process
// printf("%s(%d)\n", __FILE__, __LINE__);
$rs = $this->retrieve_content($appbox);
$rs = $this->retrieveContent($appbox);
} catch (Exception $e) {
$this->log('Error : ' . $e->getMessage());
$rs = array();
}
// printf("%s(%d)\n", __FILE__, __LINE__);
$rowstodo = count($rs);
$rowsdone = 0;
@@ -144,7 +136,7 @@ abstract class task_appboxAbstract extends task_abstract
foreach ($rs as $row) {
try {
// process one record
$this->process_one_content($appbox, $row);
$this->processOneContent($appbox, $row);
} catch (Exception $e) {
$this->log("Exception : " . $e->getMessage() . " " . basename($e->getFile()) . " " . $e->getLine());
}
@@ -153,7 +145,7 @@ abstract class task_appboxAbstract extends task_abstract
$this->setProgress($rowsdone, $rowstodo);
// post-process
$this->post_process_one_content($appbox, $row);
$this->post_processOneContent($appbox, $row);
// $this->check_memory_usage();
$current_memory = memory_get_usage();
@@ -163,7 +155,6 @@ abstract class task_appboxAbstract extends task_abstract
$ret = self::STATE_MAXMEGSREACHED;
}
// $this->check_records_done();
if ($this->records_done >= (int) ($this->maxrecs)) {
$this->log(sprintf("Max records done (%s) reached (actual is %s)", $this->maxrecs, $this->records_done));
$this->running = FALSE;
@@ -172,8 +163,7 @@ abstract class task_appboxAbstract extends task_abstract
// $this->check_task_status();
try {
$status = $this->get_status();
// printf("%s (%d) status=%s \n", __FILE__, __LINE__, var_export($status, true));
$status = $this->getState();
if ($status == self::STATUS_TOSTOP) {
$this->running = FALSE;
$ret = self::STATUS_TOSTOP;
@@ -196,7 +186,6 @@ abstract class task_appboxAbstract extends task_abstract
$ret = self::STATE_MAXMEGSREACHED;
}
// $this->check_records_done();
if ($this->records_done >= (int) ($this->maxrecs)) {
$this->log(sprintf("Max records done (%s) reached (actual is %s)", $this->maxrecs, $this->records_done));
$this->running = FALSE;
@@ -205,8 +194,7 @@ abstract class task_appboxAbstract extends task_abstract
// $this->check_task_status();
try {
$status = $this->get_status();
// printf("%s (%d) status=%s \n", __FILE__, __LINE__, var_export($status, true));
$status = $this->getState();
if ($status == self::STATUS_TOSTOP) {
$this->running = FALSE;
$ret = self::STATUS_TOSTOP;