mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 20:43:25 +00:00
Remove use of databox singleton
This commit is contained in:
@@ -74,7 +74,7 @@ return call_user_func(
|
|||||||
|
|
||||||
$app->get('/datafiles/{sbas_id}/{record_id}/{subdef}/', function($sbas_id, $record_id, $subdef, PhraseaApplication $app) use ($session, $deliver_content) {
|
$app->get('/datafiles/{sbas_id}/{record_id}/{subdef}/', function($sbas_id, $record_id, $subdef, PhraseaApplication $app) use ($session, $deliver_content) {
|
||||||
|
|
||||||
$databox = \databox::get_instance((int) $sbas_id);
|
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||||
$record = new \record_adapter($sbas_id, $record_id);
|
$record = new \record_adapter($sbas_id, $record_id);
|
||||||
|
|
||||||
if ( ! $session->is_authenticated()) {
|
if ( ! $session->is_authenticated()) {
|
||||||
@@ -140,7 +140,7 @@ return call_user_func(
|
|||||||
$app->get('/permalink/v1/{label}/{sbas_id}/{record_id}/{key}/{subdef}/view/'
|
$app->get('/permalink/v1/{label}/{sbas_id}/{record_id}/{key}/{subdef}/view/'
|
||||||
, function($label, $sbas_id, $record_id, $key, $subdef, PhraseaApplication $app) {
|
, function($label, $sbas_id, $record_id, $key, $subdef, PhraseaApplication $app) {
|
||||||
|
|
||||||
$databox = \databox::get_instance((int) $sbas_id);
|
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||||
|
|
||||||
$record = \media_Permalink_Adapter::challenge_token($databox, $key, $record_id, $subdef);
|
$record = \media_Permalink_Adapter::challenge_token($databox, $key, $record_id, $subdef);
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ return call_user_func(
|
|||||||
|
|
||||||
$app->get('/permalink/v1/{label}/{sbas_id}/{record_id}/{key}/{subdef}/'
|
$app->get('/permalink/v1/{label}/{sbas_id}/{record_id}/{key}/{subdef}/'
|
||||||
, function($label, $sbas_id, $record_id, $key, $subdef) use ($app, $session, $deliver_content) {
|
, function($label, $sbas_id, $record_id, $key, $subdef) use ($app, $session, $deliver_content) {
|
||||||
$databox = \databox::get_instance((int) $sbas_id);
|
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||||
$record = \media_Permalink_Adapter::challenge_token($databox, $key, $record_id, $subdef);
|
$record = \media_Permalink_Adapter::challenge_token($databox, $key, $record_id, $subdef);
|
||||||
if ( ! ($record instanceof \record_adapter))
|
if ( ! ($record instanceof \record_adapter))
|
||||||
throw new \Exception('bad luck');
|
throw new \Exception('bad luck');
|
||||||
|
@@ -108,7 +108,8 @@ class MetaField implements Attribute
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$databox = \databox::get_instance($datas['sbas_id']);
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
|
$databox = $appbox->get_databox($datas['sbas_id']);
|
||||||
$field = $databox->get_meta_structure()->get_element($datas['id']);
|
$field = $databox->get_meta_structure()->get_element($datas['id']);
|
||||||
} catch (\Exception_NotFound $e) {
|
} catch (\Exception_NotFound $e) {
|
||||||
throw new \InvalidArgumentException('Field does not exist anymore');
|
throw new \InvalidArgumentException('Field does not exist anymore');
|
||||||
|
@@ -40,7 +40,7 @@ class BorderManager extends ServiceAbstract
|
|||||||
*/
|
*/
|
||||||
protected function init()
|
protected function init()
|
||||||
{
|
{
|
||||||
|
$appbox = \appbox::get_instance($this->core);
|
||||||
$borderManager = new Border\Manager($this->core['EM'], $this->core['file-system']);
|
$borderManager = new Border\Manager($this->core['EM'], $this->core['file-system']);
|
||||||
|
|
||||||
if ($this->core['pdf-to-text']) {
|
if ($this->core['pdf-to-text']) {
|
||||||
@@ -86,7 +86,7 @@ class BorderManager extends ServiceAbstract
|
|||||||
$databoxes = array();
|
$databoxes = array();
|
||||||
foreach ($checker['databoxes'] as $sbas_id) {
|
foreach ($checker['databoxes'] as $sbas_id) {
|
||||||
try {
|
try {
|
||||||
$databoxes[] = \databox::get_instance($sbas_id);
|
$databoxes[] = $appbox->get_databox($sbas_id);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new \InvalidArgumentException('Invalid databox option');
|
throw new \InvalidArgumentException('Invalid databox option');
|
||||||
}
|
}
|
||||||
|
@@ -557,8 +557,8 @@ class appbox extends base
|
|||||||
$ret = array();
|
$ret = array();
|
||||||
foreach ($this->retrieve_sbas_ids() as $sbas_id) {
|
foreach ($this->retrieve_sbas_ids() as $sbas_id) {
|
||||||
try {
|
try {
|
||||||
$ret[$sbas_id] = databox::get_instance($sbas_id);
|
$ret[$sbas_id] = new \databox($sbas_id);
|
||||||
} catch (Exception $e) {
|
} catch (\Exception_DataboxNotFound $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -370,7 +370,8 @@ class collection implements cache_cacheableInterface
|
|||||||
if ( ! $sbas_id || ! $coll_id) {
|
if ( ! $sbas_id || ! $coll_id) {
|
||||||
throw new Exception_Databox_CollectionNotFound(sprintf("Collection could not be found"));
|
throw new Exception_Databox_CollectionNotFound(sprintf("Collection could not be found"));
|
||||||
}
|
}
|
||||||
$databox = databox::get_instance($sbas_id);
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
|
$databox = $appbox->get_databox($sbas_id);
|
||||||
|
|
||||||
return self::get_from_coll_id($databox, $coll_id);
|
return self::get_from_coll_id($databox, $coll_id);
|
||||||
}
|
}
|
||||||
|
@@ -100,13 +100,11 @@ class databox extends base
|
|||||||
protected $connection;
|
protected $connection;
|
||||||
protected $registry;
|
protected $registry;
|
||||||
|
|
||||||
/**
|
public function __construct($sbas_id)
|
||||||
*
|
|
||||||
* @param int $sbas_id
|
|
||||||
* @return databox
|
|
||||||
*/
|
|
||||||
protected function __construct($sbas_id)
|
|
||||||
{
|
{
|
||||||
|
assert(is_int($sbas_id));
|
||||||
|
assert($sbas_id > 0);
|
||||||
|
|
||||||
$this->registry = registry::get_instance();
|
$this->registry = registry::get_instance();
|
||||||
$this->connection = connection::getPDOConnection($sbas_id);
|
$this->connection = connection::getPDOConnection($sbas_id);
|
||||||
$this->Core = \bootstrap::getCore();
|
$this->Core = \bootstrap::getCore();
|
||||||
@@ -187,22 +185,6 @@ class databox extends base
|
|||||||
return phrasea::sbas_names($this->get_sbas_id());
|
return phrasea::sbas_names($this->get_sbas_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param int $sbas_id
|
|
||||||
* @return databox
|
|
||||||
*/
|
|
||||||
public static function get_instance($sbas_id)
|
|
||||||
{
|
|
||||||
assert(is_int($sbas_id));
|
|
||||||
assert($sbas_id > 0);
|
|
||||||
if ( ! array_key_exists($sbas_id, self::$_instances)) {
|
|
||||||
self::$_instances[$sbas_id] = new self($sbas_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return self::$_instances[$sbas_id];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return databox_status
|
* @return databox_status
|
||||||
|
@@ -856,7 +856,8 @@ class databox_field implements cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
public function __wakeup()
|
public function __wakeup()
|
||||||
{
|
{
|
||||||
$databox = databox::get_instance($this->sbas_id);
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
|
$databox = $appbox->get_databox($this->sbas_id);
|
||||||
$this->set_databox($databox);
|
$this->set_databox($databox);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@@ -61,6 +61,7 @@ class databox_status
|
|||||||
|
|
||||||
$path = $url = false;
|
$path = $url = false;
|
||||||
|
|
||||||
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
$sbas_params = phrasea::sbas_params();
|
$sbas_params = phrasea::sbas_params();
|
||||||
$registry = registry::get_instance();
|
$registry = registry::get_instance();
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@ class databox_status
|
|||||||
$path = $this->path = $registry->get('GV_RootPath') . "config/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]);
|
$path = $this->path = $registry->get('GV_RootPath') . "config/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]);
|
||||||
$url = $this->url = "/custom/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]);
|
$url = $this->url = "/custom/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]);
|
||||||
|
|
||||||
$databox = databox::get_instance((int) $sbas_id);
|
$databox = $appbox->get_databox((int) $sbas_id);
|
||||||
$xmlpref = $databox->get_structure();
|
$xmlpref = $databox->get_structure();
|
||||||
$sxe = simplexml_load_string($xmlpref);
|
$sxe = simplexml_load_string($xmlpref);
|
||||||
|
|
||||||
@@ -244,6 +245,7 @@ class databox_status
|
|||||||
public static function deleteStatus($sbas_id, $bit)
|
public static function deleteStatus($sbas_id, $bit)
|
||||||
{
|
{
|
||||||
$core = \bootstrap::getCore();
|
$core = \bootstrap::getCore();
|
||||||
|
$appbox = \appbox::get_instance($core);
|
||||||
|
|
||||||
$user = $core->getAuthenticatedUser();
|
$user = $core->getAuthenticatedUser();
|
||||||
|
|
||||||
@@ -256,7 +258,7 @@ class databox_status
|
|||||||
if (isset($status[$bit])) {
|
if (isset($status[$bit])) {
|
||||||
$connbas = connection::getPDOConnection($sbas_id);
|
$connbas = connection::getPDOConnection($sbas_id);
|
||||||
|
|
||||||
$databox = databox::get_instance((int) $sbas_id);
|
$databox = $appbox->get_databox((int) $sbas_id);
|
||||||
|
|
||||||
$doc = $databox->get_dom_structure();
|
$doc = $databox->get_dom_structure();
|
||||||
if ($doc) {
|
if ($doc) {
|
||||||
|
@@ -42,8 +42,9 @@ class module_console_fieldsDelete extends Command
|
|||||||
|
|
||||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
try {
|
try {
|
||||||
$databox = \databox::get_instance((int) $input->getArgument('sbas_id'));
|
$databox = $appbox->get_databox((int) $input->getArgument('sbas_id'));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$output->writeln("<error>Invalid databox id </error>");
|
$output->writeln("<error>Invalid databox id </error>");
|
||||||
|
|
||||||
|
@@ -54,8 +54,9 @@ class module_console_fieldsMerge extends Command
|
|||||||
{
|
{
|
||||||
$output->writeln("");
|
$output->writeln("");
|
||||||
|
|
||||||
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
try {
|
try {
|
||||||
$databox = \databox::get_instance((int) $input->getArgument('sbas_id'));
|
$databox = $appbox->get_databox((int) $input->getArgument('sbas_id'));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$output->writeln("<error>Invalid databox id </error>");
|
$output->writeln("<error>Invalid databox id </error>");
|
||||||
|
|
||||||
|
@@ -45,8 +45,9 @@ class module_console_fieldsRename extends Command
|
|||||||
{
|
{
|
||||||
$new_name = $input->getArgument('name');
|
$new_name = $input->getArgument('name');
|
||||||
|
|
||||||
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
try {
|
try {
|
||||||
$databox = \databox::get_instance((int) $input->getArgument('sbas_id'));
|
$databox = $appbox->get_databox((int) $input->getArgument('sbas_id'));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$output->writeln("<error>Invalid databox id </error>");
|
$output->writeln("<error>Invalid databox id </error>");
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ class module_console_sphinxGenerateSuggestion extends Command
|
|||||||
|
|
||||||
$tmp_file = $registry->get('GV_RootPath') . 'tmp/dict' . $index . '.txt';
|
$tmp_file = $registry->get('GV_RootPath') . 'tmp/dict' . $index . '.txt';
|
||||||
|
|
||||||
$databox = databox::get_instance($sbas_id);
|
$databox = $appbox->get_databox($sbas_id);
|
||||||
|
|
||||||
$output->writeln("process Databox " . $databox->get_viewname() . " / $index\n");
|
$output->writeln("process Databox " . $databox->get_viewname() . " / $index\n");
|
||||||
|
|
||||||
|
@@ -290,7 +290,8 @@ class module_report_activity extends module_report
|
|||||||
$filter = $s->getFilters();
|
$filter = $s->getFilters();
|
||||||
$conn = $s->getConnBas();
|
$conn = $s->getConnBas();
|
||||||
|
|
||||||
$databox = \databox::get_instance($this->sbas_id);
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
|
$databox = $appbox->get_databox($this->sbas_id);
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
$date_filter = $filter->getDateFilter();
|
$date_filter = $filter->getDateFilter();
|
||||||
|
@@ -210,7 +210,8 @@ class module_report_download extends module_report
|
|||||||
|
|
||||||
public static function getTopDl($dmin, $dmax, $sbas_id, $list_coll_id)
|
public static function getTopDl($dmin, $dmax, $sbas_id, $list_coll_id)
|
||||||
{
|
{
|
||||||
$databox = \databox::get_instance((int) $sbas_id);
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
|
$databox = $appbox->get_databox((int) $sbas_id);
|
||||||
$conn = $databox->get_connection();
|
$conn = $databox->get_connection();
|
||||||
|
|
||||||
$registry = $databox->get_registry();
|
$registry = $databox->get_registry();
|
||||||
|
@@ -79,7 +79,7 @@ class p4file
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sbas_id = phrasea::sbasFromBas($base_id);
|
$sbas_id = phrasea::sbasFromBas($base_id);
|
||||||
$databox = databox::get_instance($sbas_id);
|
$databox = $appbox->get_databox($sbas_id);
|
||||||
$collection = collection::get_from_base_id($base_id);
|
$collection = collection::get_from_base_id($base_id);
|
||||||
|
|
||||||
$collprefs = simplexml_load_string($collection->get_prefs());
|
$collprefs = simplexml_load_string($collection->get_prefs());
|
||||||
@@ -131,13 +131,14 @@ class p4file
|
|||||||
throw new Exception('This method is deprecated');
|
throw new Exception('This method is deprecated');
|
||||||
|
|
||||||
$core = \bootstrap::getCore();
|
$core = \bootstrap::getCore();
|
||||||
|
$appbox = \appbox::get_instance($core);
|
||||||
$checks = array();
|
$checks = array();
|
||||||
|
|
||||||
$system_file = new system_file($filename);
|
$system_file = new system_file($filename);
|
||||||
|
|
||||||
$doctype = $system_file->get_phrasea_type();
|
$doctype = $system_file->get_phrasea_type();
|
||||||
|
|
||||||
$databox = databox::get_instance($sbas_id);
|
$databox = $appbox->get_databox($sbas_id);
|
||||||
|
|
||||||
if ($baseprefs = $databox->get_sxml_structure()) {
|
if ($baseprefs = $databox->get_sxml_structure()) {
|
||||||
|
|
||||||
|
@@ -427,7 +427,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
|
|||||||
if ($this->results[$sbas_id])
|
if ($this->results[$sbas_id])
|
||||||
$nbanswers += $this->results[$sbas_id]["nbanswers"];
|
$nbanswers += $this->results[$sbas_id]["nbanswers"];
|
||||||
|
|
||||||
$logger = $session->get_logger(databox::get_instance($sbas_id));
|
$logger = $session->get_logger($appbox->get_databox($sbas_id));
|
||||||
|
|
||||||
$conn2 = connection::getPDOConnection($sbas_id);
|
$conn2 = connection::getPDOConnection($sbas_id);
|
||||||
|
|
||||||
@@ -558,7 +558,6 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
|
|||||||
if ( ! isset($this->queries[$databox->get_sbas_id()]))
|
if ( ! isset($this->queries[$databox->get_sbas_id()]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//$databox = databox::get_instance($sbas_id);
|
|
||||||
$sbas_id = $databox->get_sbas_id();
|
$sbas_id = $databox->get_sbas_id();
|
||||||
$this->colls[$sbas_id] = array();
|
$this->colls[$sbas_id] = array();
|
||||||
foreach ($databox->get_collections() as $coll) {
|
foreach ($databox->get_collections() as $coll) {
|
||||||
|
@@ -97,9 +97,10 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i
|
|||||||
|
|
||||||
$filters = array();
|
$filters = array();
|
||||||
|
|
||||||
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
|
|
||||||
foreach ($sbas_ids as $sbas_id) {
|
foreach ($sbas_ids as $sbas_id) {
|
||||||
$databox = databox::get_instance($sbas_id);
|
$fields = $appbox->get_databox($sbas_id)->get_meta_structure();
|
||||||
$fields = $databox->get_meta_structure();
|
|
||||||
|
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
if ( ! in_array($field->get_id(), $options->get_fields()))
|
if ( ! in_array($field->get_id(), $options->get_fields()))
|
||||||
@@ -136,12 +137,12 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i
|
|||||||
$this->sphinx->SetFilter('crc_struct_id', $filters);
|
$this->sphinx->SetFilter('crc_struct_id', $filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
/**
|
/**
|
||||||
* @todo : enhance : check status better
|
* @todo : enhance : check status better
|
||||||
*/
|
*/
|
||||||
foreach ($sbas_ids as $sbas_id) {
|
foreach ($sbas_ids as $sbas_id) {
|
||||||
$databox = databox::get_instance($sbas_id);
|
$s_status = $appbox->get_databox($sbas_id)->get_statusbits();
|
||||||
$s_status = $databox->get_statusbits();
|
|
||||||
$status_opts = $options->get_status();
|
$status_opts = $options->get_status();
|
||||||
foreach ($s_status as $n => $status) {
|
foreach ($s_status as $n => $status) {
|
||||||
if ( ! array_key_exists($n, $status_opts))
|
if ( ! array_key_exists($n, $status_opts))
|
||||||
|
@@ -83,9 +83,10 @@ abstract class task_databoxAbstract extends task_abstract
|
|||||||
$this->sbas_id = (int) $row['sbas_id'];
|
$this->sbas_id = (int) $row['sbas_id'];
|
||||||
$this->log('This task works now on ' . phrasea::sbas_names($this->sbas_id));
|
$this->log('This task works now on ' . phrasea::sbas_names($this->sbas_id));
|
||||||
|
|
||||||
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
try {
|
try {
|
||||||
// get the records to process
|
// get the records to process
|
||||||
$databox = databox::get_instance((int) $row['sbas_id']);
|
$databox = $appbox->get_databox((int) $row['sbas_id']);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->log(sprintf('Warning : can\' connect to sbas(%s)', $row['sbas_id']));
|
$this->log(sprintf('Warning : can\' connect to sbas(%s)', $row['sbas_id']));
|
||||||
continue;
|
continue;
|
||||||
|
@@ -419,7 +419,8 @@ class task_period_RecordMover extends task_appboxAbstract
|
|||||||
protected function processOneContent(appbox $appbox, Array $row)
|
protected function processOneContent(appbox $appbox, Array $row)
|
||||||
{
|
{
|
||||||
$logsql = (int) ($this->sxTaskSettings->logsql) > 0;
|
$logsql = (int) ($this->sxTaskSettings->logsql) > 0;
|
||||||
$dbox = databox::get_instance($row['sbas_id']);
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
|
$databox = $appbox->get_databox($row['sbas_id']);
|
||||||
$rec = new record_adapter($row['sbas_id'], $row['record_id']);
|
$rec = new record_adapter($row['sbas_id'], $row['record_id']);
|
||||||
switch ($row['action']) {
|
switch ($row['action']) {
|
||||||
|
|
||||||
@@ -427,7 +428,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
|||||||
|
|
||||||
// change collection ?
|
// change collection ?
|
||||||
if (array_key_exists('coll', $row)) {
|
if (array_key_exists('coll', $row)) {
|
||||||
$coll = collection::get_from_coll_id($dbox, $row['coll']);
|
$coll = collection::get_from_coll_id($databox, $row['coll']);
|
||||||
$rec->move_to_collection($coll, $appbox);
|
$rec->move_to_collection($coll, $appbox);
|
||||||
if ($logsql) {
|
if ($logsql) {
|
||||||
$this->log(sprintf("on sbas %s move rid %s to coll %s \n", $row['sbas_id'], $row['record_id'], $coll->get_coll_id()));
|
$this->log(sprintf("on sbas %s move rid %s to coll %s \n", $row['sbas_id'], $row['record_id'], $coll->get_coll_id()));
|
||||||
|
@@ -270,7 +270,8 @@ class task_period_archive extends task_abstract
|
|||||||
{
|
{
|
||||||
$this->debug = false;
|
$this->debug = false;
|
||||||
|
|
||||||
$conn = \connection::getPDOConnection();
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
|
$conn = $appbox->get_connection();
|
||||||
|
|
||||||
$this->sxTaskSettings = simplexml_load_string($this->settings);
|
$this->sxTaskSettings = simplexml_load_string($this->settings);
|
||||||
|
|
||||||
@@ -283,7 +284,7 @@ class task_period_archive extends task_abstract
|
|||||||
return 'tostop';
|
return 'tostop';
|
||||||
}
|
}
|
||||||
|
|
||||||
$databox = \databox::get_instance($this->sbas_id);
|
$databox = $appbox->get_databox($this->sbas_id);
|
||||||
|
|
||||||
$this->TColls = array();
|
$this->TColls = array();
|
||||||
$collection = null;
|
$collection = null;
|
||||||
@@ -507,8 +508,9 @@ class task_period_archive extends task_abstract
|
|||||||
{
|
{
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
connection::getPDOConnection();
|
connection::getPDOConnection();
|
||||||
\databox::get_instance($this->sbas_id)->get_connection();
|
$appbox->get_databox($this->sbas_id)->get_connection();
|
||||||
|
|
||||||
$path_in = p4string::delEndSlash(trim((string) ($this->sxTaskSettings->hotfolder)));
|
$path_in = p4string::delEndSlash(trim((string) ($this->sxTaskSettings->hotfolder)));
|
||||||
if (false === $this->filesystem->exists($path_in . "/.phrasea.xml")) {
|
if (false === $this->filesystem->exists($path_in . "/.phrasea.xml")) {
|
||||||
@@ -1414,6 +1416,7 @@ class task_period_archive extends task_abstract
|
|||||||
*/
|
*/
|
||||||
private function archiveGrp(\DOMDocument $dom, \DOMElement $node, $path, $path_archived, $path_error, array &$nodesToDel)
|
private function archiveGrp(\DOMDocument $dom, \DOMElement $node, $path, $path_archived, $path_error, array &$nodesToDel)
|
||||||
{
|
{
|
||||||
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
$xpath = new DOMXPath($dom);
|
$xpath = new DOMXPath($dom);
|
||||||
|
|
||||||
// grp folders stay in place
|
// grp folders stay in place
|
||||||
@@ -1466,7 +1469,7 @@ class task_period_archive extends task_abstract
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$databox = \databox::get_instance($this->sbas_id);
|
$databox = $appbox->get_databox($this->sbas_id);
|
||||||
$collection = collection::get_from_coll_id($databox, (int) $cid);
|
$collection = collection::get_from_coll_id($databox, (int) $cid);
|
||||||
if ($captionFileName === null) {
|
if ($captionFileName === null) {
|
||||||
$story = $this->createStory($collection, $path . '/' . $representationFileName, null);
|
$story = $this->createStory($collection, $path . '/' . $representationFileName, null);
|
||||||
@@ -1838,6 +1841,7 @@ class task_period_archive extends task_abstract
|
|||||||
{
|
{
|
||||||
$ret = false;
|
$ret = false;
|
||||||
|
|
||||||
|
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||||
$file = $node->getAttribute('name');
|
$file = $node->getAttribute('name');
|
||||||
$cid = $node->getAttribute('cid');
|
$cid = $node->getAttribute('cid');
|
||||||
$captionFileName = $captionFileNode ? $captionFileNode->getAttribute('name') : null;
|
$captionFileName = $captionFileNode ? $captionFileNode->getAttribute('name') : null;
|
||||||
@@ -1868,7 +1872,7 @@ class task_period_archive extends task_abstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$databox = \databox::get_instance($this->sbas_id);
|
$databox = $appbox->get_databox($this->sbas_id);
|
||||||
$collection = collection::get_from_coll_id($databox, (int) $cid);
|
$collection = collection::get_from_coll_id($databox, (int) $cid);
|
||||||
|
|
||||||
if ($captionFileName === null) {
|
if ($captionFileName === null) {
|
||||||
|
Reference in New Issue
Block a user