mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
Avoid errors by explicitely namespacing root exception
This commit is contained in:
@@ -135,7 +135,7 @@ abstract class task_abstract
|
||||
|
||||
try {
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log(("Warning : abox connection lost : ".$e->getMessage().", restarting in 10 min."), self::LOG_ERROR);
|
||||
|
||||
$this->sleep(60 * 10);
|
||||
@@ -691,7 +691,7 @@ abstract class task_abstract
|
||||
try {
|
||||
// process one record
|
||||
$this->processOneContent($box, $row);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log("Exception : " . $e->getMessage() . " " . basename($e->getFile()) . " " . $e->getLine(), self::LOG_ERROR);
|
||||
}
|
||||
|
||||
@@ -721,7 +721,7 @@ abstract class task_abstract
|
||||
$this->running = FALSE;
|
||||
$ret = self::STATE_TOSTOP;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->running = FALSE;
|
||||
}
|
||||
|
||||
@@ -752,7 +752,7 @@ abstract class task_abstract
|
||||
$this->running = FALSE;
|
||||
$ret = self::STATE_TOSTOP;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->running = FALSE;
|
||||
}
|
||||
}
|
||||
@@ -917,7 +917,7 @@ abstract class task_abstract
|
||||
));
|
||||
$stmt->closeCursor();
|
||||
$this->completed_percentage = $p;
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
|
@@ -29,7 +29,7 @@ abstract class task_appboxAbstract extends task_abstract
|
||||
while ($this->running) {
|
||||
try {
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log($e->getMessage());
|
||||
if ($this->getRunner() == self::RUNNER_SCHEDULER) {
|
||||
$this->log(("Warning : abox connection lost, restarting in 10 min."));
|
||||
@@ -59,7 +59,7 @@ abstract class task_appboxAbstract extends task_abstract
|
||||
$stmt->closeCursor();
|
||||
$this->records_done = 0;
|
||||
$duration = time();
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// failed sql, simply return
|
||||
$this->running = FALSE;
|
||||
|
||||
@@ -73,7 +73,7 @@ abstract class task_appboxAbstract extends task_abstract
|
||||
|
||||
try {
|
||||
$this->loadSettings(simplexml_load_string($row['settings']));
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log($e->getMessage());
|
||||
continue;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ abstract class task_appboxAbstract extends task_abstract
|
||||
|
||||
// process the records
|
||||
$ret = $this->processLoop($appbox, $rs);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log('Error : ' . $e->getMessage());
|
||||
}
|
||||
|
||||
|
@@ -69,7 +69,7 @@ abstract class task_databoxAbstract extends task_abstract
|
||||
$stmt->closeCursor();
|
||||
$this->records_done = 0;
|
||||
$duration = time();
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// failed sql, simply return
|
||||
$this->running = FALSE;
|
||||
|
||||
@@ -87,7 +87,7 @@ abstract class task_databoxAbstract extends task_abstract
|
||||
try {
|
||||
// get the records to process
|
||||
$databox = $this->dependencyContainer['phraseanet.appbox']->get_databox((int) $row['sbas_id']);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log(sprintf('can\'t connect to sbas(%s) because "%s"',
|
||||
$row['sbas_id'],
|
||||
$e->getMessage()),
|
||||
@@ -98,7 +98,7 @@ abstract class task_databoxAbstract extends task_abstract
|
||||
|
||||
try {
|
||||
$this->loadSettings(simplexml_load_string($row['settings']));
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log(sprintf('can\'t get get settings of task because "%s"',
|
||||
$e->getMessage()),
|
||||
self::LOG_WARNING
|
||||
@@ -167,7 +167,7 @@ abstract class task_databoxAbstract extends task_abstract
|
||||
|
||||
// process the records
|
||||
$ret = $this->processLoop($databox, $rs);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log($e->getMessage(), self::LOG_ERROR);
|
||||
}
|
||||
|
||||
|
@@ -108,7 +108,7 @@ class task_manager
|
||||
}
|
||||
try {
|
||||
$tasks[$row['task_id']] = new $classname($row['task_id'], $this->app, $this->logger);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@ class task_manager
|
||||
"err" => null
|
||||
);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -351,7 +351,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
|
||||
try {
|
||||
$connbas = connection::getPDOConnection($this->dependencyContainer, $task['sbas_id']);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log(sprintf("can't connect sbas %s", $task['sbas_id']), self::LOG_ERROR);
|
||||
continue;
|
||||
}
|
||||
@@ -513,7 +513,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
$ret['err_htmlencoded'] = htmlentities($ret['err']);
|
||||
break;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$ret['err'] = "bad sbas '" . $sbas_id . "'";
|
||||
$ret['err_htmlencoded'] = htmlentities($ret['err']);
|
||||
}
|
||||
|
@@ -77,7 +77,7 @@ class task_period_apibridge extends task_appboxAbstract
|
||||
} else {
|
||||
$this->update_element($element);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$sql = 'UPDATE bridge_elements SET status = :status WHERE id = :id';
|
||||
|
||||
$params = array(
|
||||
@@ -117,7 +117,7 @@ class task_period_apibridge extends task_appboxAbstract
|
||||
try {
|
||||
$dist_id = $account->get_api()->upload($element->get_record(), $element->get_datas());
|
||||
$element->set_uploaded_on(new DateTime());
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log('Error while uploading : ' . $e->getMessage());
|
||||
$element->set_status(Bridge_Element::STATUS_ERROR);
|
||||
}
|
||||
|
@@ -379,7 +379,7 @@ class task_period_archive extends task_abstract
|
||||
while ($this->running) {
|
||||
try {
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log($e->getMessage());
|
||||
if ($this->getRunner() == self::RUNNER_SCHEDULER) {
|
||||
$this->log(("Warning : abox connection lost, restarting in 10 min."));
|
||||
@@ -436,7 +436,7 @@ class task_period_archive extends task_abstract
|
||||
$cold = 30;
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
if ($this->getRunner() == self::RUNNER_SCHEDULER) {
|
||||
$this->log(sprintf(('Warning : error fetching or reading settings of the task \'%d\', restarting in 10 min.'), $this->getID()));
|
||||
|
||||
@@ -787,7 +787,7 @@ class task_period_archive extends task_abstract
|
||||
|
||||
$n->setAttribute('temperature', 'hot');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
@@ -893,7 +893,7 @@ class task_period_archive extends task_abstract
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1585,7 +1585,7 @@ class task_period_archive extends task_abstract
|
||||
$this->movedFiles++;
|
||||
}
|
||||
$node->setAttribute('grp', 'tocomplete');
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->addDebug($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
@@ -241,7 +241,7 @@ class task_period_ftp extends task_appboxAbstract
|
||||
$stmt->closeCursor();
|
||||
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -362,7 +362,7 @@ class task_period_ftp extends task_appboxAbstract
|
||||
if ($ftp_export["passif"] == "1") {
|
||||
try {
|
||||
$ftp_client->passive(true);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->addDebug($e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -371,7 +371,7 @@ class task_period_ftp extends task_appboxAbstract
|
||||
try {
|
||||
$ftp_client->chdir($ftp_export["destfolder"]);
|
||||
$ftp_export["destfolder"] = '/' . $ftp_export["destfolder"];
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->addDebug($e->getMessage());
|
||||
}
|
||||
} else {
|
||||
@@ -381,14 +381,14 @@ class task_period_ftp extends task_appboxAbstract
|
||||
if (trim($ftp_export["foldertocreate"]) != '') {
|
||||
try {
|
||||
$ftp_client->mkdir($ftp_export["foldertocreate"]);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->addDebug($e->getMessage());
|
||||
}
|
||||
try {
|
||||
$new_dir = $ftp_client->add_end_slash($ftp_export["destfolder"])
|
||||
. $ftp_export["foldertocreate"];
|
||||
$ftp_client->chdir($new_dir);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->addDebug($e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -451,7 +451,7 @@ class task_period_ftp extends task_appboxAbstract
|
||||
if ($ftp_client->pwd() != $current_folder) {
|
||||
try {
|
||||
$ftp_client->chdir($current_folder);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->addDebug($e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -473,7 +473,7 @@ class task_period_ftp extends task_appboxAbstract
|
||||
$stmt->execute(array(':file_id' => $file['id']));
|
||||
$stmt->closeCursor();
|
||||
$this->logexport($record, $obj, $ftpLog);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$state .= $line = sprintf(_('task::ftp:File "%1$s" (record %2$s) de la base "%3$s"' .
|
||||
' (Export du Document) : Transfert cancelled (le document n\'existe plus)')
|
||||
, basename($localfile), $record_id
|
||||
@@ -533,7 +533,7 @@ class task_period_ftp extends task_appboxAbstract
|
||||
|
||||
$ftp_client->close();
|
||||
unset($ftp_client);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$state .= $line = $e . "\n";
|
||||
|
||||
$this->logger->addDebug($line);
|
||||
|
@@ -325,7 +325,7 @@ class task_period_ftpPull extends task_appboxAbstract
|
||||
$stmt->closeCursor();
|
||||
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -423,7 +423,7 @@ class task_period_ftpPull extends task_appboxAbstract
|
||||
|
||||
$ftp->get($finalpath, $filepath);
|
||||
$ftp->delete($filepath);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->addDebug("Erreur lors du rappatriement de $filepath : " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -431,7 +431,7 @@ class task_period_ftpPull extends task_appboxAbstract
|
||||
$ftp->close();
|
||||
|
||||
$this->setProgress(0, 0);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
if (isset($ftp) && $ftp instanceof ftpclient) {
|
||||
$ftp->close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user