mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Fix CS
This commit is contained in:
@@ -638,7 +638,7 @@ abstract class task_abstract
|
||||
|
||||
// if something went wrong, report
|
||||
if ($exception) {
|
||||
throw($exception);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -88,11 +88,10 @@ abstract class task_databoxAbstract extends task_abstract
|
||||
// get the records to process
|
||||
$databox = $this->dependencyContainer['phraseanet.appbox']->get_databox((int) $row['sbas_id']);
|
||||
} catch (Exception $e) {
|
||||
$this->log(sprintf(
|
||||
'can\'t connect to sbas(%s) because "%s"'
|
||||
, $row['sbas_id']
|
||||
, $e->getMessage())
|
||||
, self::LOG_WARNING
|
||||
$this->log(sprintf('can\'t connect to sbas(%s) because "%s"',
|
||||
$row['sbas_id'],
|
||||
$e->getMessage()),
|
||||
self::LOG_WARNING
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@@ -100,10 +99,9 @@ abstract class task_databoxAbstract extends task_abstract
|
||||
try {
|
||||
$this->loadSettings(simplexml_load_string($row['settings']));
|
||||
} catch (Exception $e) {
|
||||
$this->log(sprintf(
|
||||
'can\'t get get settings of task because "%s"'
|
||||
, $e->getMessage())
|
||||
, self::LOG_WARNING
|
||||
$this->log(sprintf('can\'t get get settings of task because "%s"',
|
||||
$e->getMessage()),
|
||||
self::LOG_WARNING
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
@@ -44,10 +44,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
{
|
||||
$request = http_request::getInstance();
|
||||
|
||||
$parm2 = $request->get_parms(
|
||||
'period'
|
||||
, 'logsql'
|
||||
);
|
||||
$parm2 = $request->get_parms('period', 'logsql');
|
||||
$dom = new DOMDocument();
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->formatOutput = true;
|
||||
@@ -164,8 +161,6 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
{
|
||||
period.value = xml2.find("period").text();
|
||||
logsql.checked = Number(xml2.find("logsql").text()) > 0;
|
||||
// maxrecs.value = xml.find("maxrecs").text();
|
||||
// maxmegs.value = xml.find("maxmegs").text();
|
||||
}
|
||||
|
||||
var data = {};
|
||||
|
@@ -2065,73 +2065,6 @@ class task_period_archive extends task_abstract
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a bag of metadatas indexed by **FieldNames** to an array ready for
|
||||
* \record_adapter metadatas submission
|
||||
*
|
||||
* @param \databox_descriptionStructure $metadatasStructure The databox structure related
|
||||
* @param MetadataBag $metadatas The metadata bag
|
||||
* @return array
|
||||
*/
|
||||
protected function bagToArray(\databox_descriptionStructure $metadatasStructure, MetadataBag $metadatas)
|
||||
{
|
||||
$metas = array();
|
||||
$unicode = new \unicode();
|
||||
|
||||
foreach ($metadatasStructure as $databox_field) {
|
||||
if ($metadatas->containsKey($databox_field->get_tag()->getTagname())) {
|
||||
|
||||
if ($databox_field->is_multi()) {
|
||||
|
||||
$values = $metadatas->get($databox_field->get_tag()->getTagname())->getValue()->asArray();
|
||||
|
||||
$tmp = array();
|
||||
|
||||
foreach ($values as $value) {
|
||||
foreach (\caption_field::get_multi_values($value, $databox_field->get_separator()) as $v) {
|
||||
$tmp[] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$values = array_unique($tmp);
|
||||
|
||||
foreach ($values as $value) {
|
||||
|
||||
$value = $unicode->substituteCtrlCharacters($value, ' ');
|
||||
$value = $unicode->toUTF8($value);
|
||||
if ($databox_field->get_type() == 'date') {
|
||||
$value = $unicode->parseDate($value);
|
||||
}
|
||||
|
||||
$metas[] = array(
|
||||
'meta_struct_id' => $databox_field->get_id(),
|
||||
'value' => $value,
|
||||
'meta_id' => null
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$value = $metadatas->get($databox_field->get_tag()->getTagname())->getValue()->asString();
|
||||
|
||||
$value = $unicode->substituteCtrlCharacters($value, ' ');
|
||||
$value = $unicode->toUTF8($value);
|
||||
if ($databox_field->get_type() == 'date') {
|
||||
$value = $unicode->parseDate($value);
|
||||
}
|
||||
|
||||
$metas[] = array(
|
||||
'meta_struct_id' => $databox_field->get_id(),
|
||||
'value' => $metadatas->get($databox_field->get_tag()->getTagname())->getValue()->asString(),
|
||||
'meta_id' => null
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($unicode);
|
||||
|
||||
return $metas;
|
||||
}
|
||||
|
||||
protected function readXMLForDatabox(\databox_descriptionStructure $metadatasStructure, $pathfile)
|
||||
{
|
||||
if (false === $this->dependencyContainer['filesystem']->exists($pathfile)) {
|
||||
@@ -2207,7 +2140,7 @@ class CListFolder
|
||||
{
|
||||
$this->list = array();
|
||||
if ($hdir = opendir($path)) {
|
||||
while (false !== ($file = readdir($hdir))) {
|
||||
while (false !== $file = readdir($hdir)) {
|
||||
$this->list[] = $file;
|
||||
}
|
||||
closedir($hdir);
|
||||
|
@@ -45,23 +45,13 @@ class task_period_ftp extends task_appboxAbstract
|
||||
{
|
||||
$request = http_request::getInstance();
|
||||
|
||||
$parm2 = $request->get_parms(
|
||||
'proxy'
|
||||
, 'proxyport'
|
||||
, 'period'
|
||||
, 'syslog'
|
||||
);
|
||||
$parm2 = $request->get_parms('proxy', 'proxyport', 'period', 'syslog');
|
||||
$dom = new DOMDocument();
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->formatOutput = true;
|
||||
if ((@$dom->loadXML($oldxml)) != FALSE) {
|
||||
$xmlchanged = false;
|
||||
foreach (array(
|
||||
'str:proxy'
|
||||
, 'str:proxyport'
|
||||
, 'str:period'
|
||||
, 'pop:syslog'
|
||||
) as $pname) {
|
||||
foreach (array('str:proxy', 'str:proxyport', 'str:period', 'pop:syslog') as $pname) {
|
||||
$ptype = substr($pname, 0, 3);
|
||||
$pname = substr($pname, 4);
|
||||
$pvalue = $parm2[$pname];
|
||||
@@ -354,17 +344,6 @@ class task_period_ftp extends task_appboxAbstract
|
||||
|
||||
$this->logger->addDebug($line);
|
||||
|
||||
if (($ses_id = phrasea_create_session($usr_id)) == null) {
|
||||
$this->logger->addDebug("Unable to create session");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!($ph_session = phrasea_open_session($ses_id, $usr_id))) {
|
||||
$this->logger->addDebug("Unable to open session");
|
||||
phrasea_close_session($ses_id);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$ssl = ($ftp_export['ssl'] == '1');
|
||||
$ftp_client = $this->dependencyContainer['phraseanet.ftp.client']($ftp_server, 21, 300, $ssl, $this->proxy, $this->proxyport);
|
||||
@@ -558,7 +537,6 @@ class task_period_ftp extends task_appboxAbstract
|
||||
unset($ftp_client);
|
||||
}
|
||||
$this->finalize($appbox, $id);
|
||||
// phrasea_close_session($ses_id);
|
||||
}
|
||||
|
||||
protected function postProcessOneContent(appbox $appbox, Array $row)
|
||||
|
@@ -8,14 +8,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
|
||||
use Monolog\Logger;
|
||||
|
||||
class task_period_subdef extends task_databoxAbstract
|
||||
{
|
||||
const MINMEGS = 20;
|
||||
@@ -70,24 +62,14 @@ class task_period_subdef extends task_databoxAbstract
|
||||
{
|
||||
$request = http_request::getInstance();
|
||||
|
||||
$parm2 = $request->get_parms(
|
||||
'period'
|
||||
, 'flush'
|
||||
, 'maxrecs'
|
||||
, 'maxmegs'
|
||||
);
|
||||
$parm2 = $request->get_parms('period', 'flush', 'maxrecs', 'maxmegs');
|
||||
$dom = new DOMDocument();
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->formatOutput = true;
|
||||
if (@$dom->loadXML($oldxml)) {
|
||||
$xmlchanged = false;
|
||||
|
||||
foreach (array(
|
||||
'str:period'
|
||||
, 'str:flush'
|
||||
, 'str:maxrecs'
|
||||
, 'str:maxmegs'
|
||||
) as $pname) {
|
||||
foreach (array('str:period', 'str:flush', 'str:maxrecs', 'str:maxmegs') as $pname) {
|
||||
$ptype = substr($pname, 0, 3);
|
||||
$pname = substr($pname, 4);
|
||||
$pvalue = $parm2[$pname];
|
||||
@@ -327,7 +309,7 @@ class task_period_subdef extends task_databoxAbstract
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->log($e->getMessage(), self::LOG_CRITICAL);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user