mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 03:23:19 +00:00
Update tasks
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Monolog\Logger;
|
||||
|
||||
@@ -46,20 +47,13 @@ class task_Scheduler
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected static function get_connection()
|
||||
{
|
||||
return appbox::get_instance(\bootstrap::getCore())->get_connection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception if scheduler is already running
|
||||
* @todo doc all possible exception
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$registry = $appbox->get_registry();
|
||||
$registry = $this->dependencyContainer['phraseanet.registry'];
|
||||
|
||||
//prevent scheduler to fail if GV_cli is not provided
|
||||
if ( ! is_executable($registry->get('GV_cli'))) {
|
||||
@@ -115,7 +109,7 @@ class task_Scheduler
|
||||
|
||||
$this->log(sprintf("running scheduler with method %s", $this->method));
|
||||
|
||||
$conn = appbox::get_instance(\bootstrap::getCore())->get_connection();
|
||||
$conn = $this->dependencyContainer['phraseanet.appbox']->get_connection();
|
||||
|
||||
$taskPoll = array(); // the poll of tasks
|
||||
|
||||
@@ -124,10 +118,10 @@ class task_Scheduler
|
||||
$sql = "UPDATE sitepreff SET schedstatus='started'";
|
||||
$conn->exec($sql);
|
||||
|
||||
$task_manager = new task_manager($appbox);
|
||||
$task_manager = new task_manager($this->dependencyContainer);
|
||||
|
||||
// set every 'auto-start' task to start
|
||||
foreach ($task_manager->getTasks($this->dependencyContainer) as $task) {
|
||||
foreach ($task_manager->getTasks() as $task) {
|
||||
if ($task->isActive()) {
|
||||
if ( ! $task->getPID()) {
|
||||
/* @var $task task_abstract */
|
||||
@@ -161,7 +155,7 @@ class task_Scheduler
|
||||
sleep(1);
|
||||
}
|
||||
try {
|
||||
$conn = appbox::get_instance(\bootstrap::getCore())->get_connection();
|
||||
$conn = $this->dependencyContainer['phraseanet.appbox']->get_connection();
|
||||
} catch (ErrorException $e) {
|
||||
$ping = false;
|
||||
}
|
||||
@@ -214,7 +208,7 @@ class task_Scheduler
|
||||
$taskPoll[$tkey]["todel"] = true;
|
||||
}
|
||||
|
||||
foreach ($task_manager->getTasks($this->dependencyContainer, true) as $task) {
|
||||
foreach ($task_manager->getTasks(true) as $task) {
|
||||
$tkey = "t_" . $task->getID();
|
||||
$status = $task->getState();
|
||||
|
||||
|
@@ -107,12 +107,12 @@ abstract class task_abstract
|
||||
|
||||
$this->taskid = (integer) $taskid;
|
||||
|
||||
phrasea::use_i18n(Session_Handler::get_locale());
|
||||
phrasea::use_i18n($this->dependencyContainer['locale']);
|
||||
|
||||
$this->launched_by = array_key_exists("REQUEST_URI", $_SERVER) ? self::LAUCHED_BY_BROWSER : self::LAUCHED_BY_COMMANDLINE;
|
||||
|
||||
try {
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
} catch (Exception $e) {
|
||||
$this->log($e->getMessage());
|
||||
$this->log(("Warning : abox connection lost, restarting in 10 min."));
|
||||
@@ -163,7 +163,7 @@ abstract class task_abstract
|
||||
public function getState()
|
||||
{
|
||||
static $stmt = NULL;
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
if ( ! $stmt) {
|
||||
$sql = 'SELECT status FROM task2 WHERE task_id = :taskid';
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -225,7 +225,7 @@ abstract class task_abstract
|
||||
throw new Exception_InvalidArgument(sprintf('unknown status `%s`', $status));
|
||||
}
|
||||
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
|
||||
$sql = 'UPDATE task2 SET status = :status WHERE task_id = :taskid';
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -241,7 +241,7 @@ abstract class task_abstract
|
||||
*/
|
||||
public function setActive($active)
|
||||
{
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
|
||||
$sql = 'UPDATE task2 SET active = :active WHERE task_id = :taskid';
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -261,7 +261,7 @@ abstract class task_abstract
|
||||
public function setTitle($title)
|
||||
{
|
||||
$title = strip_tags($title);
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
|
||||
$sql = 'UPDATE task2 SET name = :title WHERE task_id = :taskid';
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -289,7 +289,7 @@ abstract class task_abstract
|
||||
throw new Exception_InvalidArgument('Bad XML');
|
||||
}
|
||||
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
|
||||
$sql = 'UPDATE task2 SET settings = :settings WHERE task_id = :taskid';
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -309,7 +309,7 @@ abstract class task_abstract
|
||||
*/
|
||||
public function resetCrashCounter()
|
||||
{
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
|
||||
$sql = 'UPDATE task2 SET crashed = 0 WHERE task_id = :taskid';
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -336,7 +336,7 @@ abstract class task_abstract
|
||||
*/
|
||||
public function incrementCrashCounter()
|
||||
{
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
|
||||
$sql = 'UPDATE task2 SET crashed = crashed + 1 WHERE task_id = :taskid';
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -402,7 +402,7 @@ abstract class task_abstract
|
||||
|
||||
$this->runner = $runner;
|
||||
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
$sql = 'UPDATE task2 SET runner = :runner WHERE task_id = :taskid';
|
||||
|
||||
$params = array(
|
||||
@@ -432,14 +432,13 @@ abstract class task_abstract
|
||||
public function delete()
|
||||
{
|
||||
if ( ! $this->getPID()) { // do not delete a running task
|
||||
$conn = connection::getPDOConnection();
|
||||
$registry = registry::get_instance();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
$sql = "DELETE FROM task2 WHERE task_id = :task_id";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute(array(':task_id' => $this->getID()));
|
||||
$stmt->closeCursor();
|
||||
|
||||
$lock_file = $registry->get('GV_RootPath') . 'tmp/locks/task_' . $this->getID() . '.lock';
|
||||
$lock_file = __DIR__ . '/../../../tmp/locks/task_' . $this->getID() . '.lock';
|
||||
@unlink($lock_file);
|
||||
}
|
||||
}
|
||||
@@ -449,7 +448,7 @@ abstract class task_abstract
|
||||
*/
|
||||
public function setLastExecTime()
|
||||
{
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
$sql = 'UPDATE task2 SET last_exec_time=NOW() WHERE task_id = :taskid';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute(array(':taskid' => $this->getID()));
|
||||
@@ -463,7 +462,7 @@ abstract class task_abstract
|
||||
*/
|
||||
public function getLastExecTime()
|
||||
{
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
|
||||
$sql = 'SELECT last_exec_time FROM task2 WHERE task_id = :taskid';
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -558,9 +557,7 @@ abstract class task_abstract
|
||||
*/
|
||||
private function getLockfilePath()
|
||||
{
|
||||
$core = \bootstrap::getCore();
|
||||
|
||||
$lockdir = $core->getRegistry()->get('GV_RootPath') . 'tmp/locks/';
|
||||
$lockdir = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/locks/';
|
||||
$lockfilePath = ($lockdir . 'task_' . $this->getID() . '.lock');
|
||||
|
||||
return $lockfilePath;
|
||||
@@ -849,9 +846,7 @@ abstract class task_abstract
|
||||
|
||||
$tid = $app['phraseanet.appbox']->get_connection()->lastInsertId();
|
||||
|
||||
$core = \bootstrap::getCore();
|
||||
|
||||
return new $class_name($tid, $app, $core['monolog']);
|
||||
return new $class_name($tid, $app, $app['monolog']);
|
||||
}
|
||||
|
||||
public function getUsage()
|
||||
@@ -885,7 +880,7 @@ abstract class task_abstract
|
||||
$p = ($todo > 0) ? ((100 * $done) / $todo) : -1;
|
||||
|
||||
try {
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
$sql = 'UPDATE task2 SET completed = :p WHERE task_id = :taskid';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute(array(
|
||||
|
@@ -9,6 +9,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
@@ -28,7 +30,7 @@ abstract class task_appboxAbstract extends task_abstract
|
||||
$this->running = TRUE;
|
||||
while ($this->running) {
|
||||
try {
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
} catch (Exception $e) {
|
||||
$this->log($e->getMessage());
|
||||
if ($this->getRunner() == self::RUNNER_SCHEDULER) {
|
||||
@@ -71,7 +73,7 @@ abstract class task_appboxAbstract extends task_abstract
|
||||
break;
|
||||
}
|
||||
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
try {
|
||||
$this->loadSettings(simplexml_load_string($row['settings']));
|
||||
} catch (Exception $e) {
|
||||
|
@@ -9,6 +9,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
@@ -32,7 +34,7 @@ abstract class task_databoxAbstract extends task_abstract
|
||||
$this->running = TRUE;
|
||||
while ($this->running) {
|
||||
try {
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
} catch (PDOException $e) {
|
||||
$this->log($e->getMessage());
|
||||
if ($this->getRunner() == self::RUNNER_SCHEDULER) {
|
||||
@@ -81,9 +83,9 @@ abstract class task_databoxAbstract extends task_abstract
|
||||
}
|
||||
|
||||
$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, $app));
|
||||
|
||||
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
try {
|
||||
// get the records to process
|
||||
$databox = $appbox->get_databox((int) $row['sbas_id']);
|
||||
|
@@ -9,7 +9,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use \Monolog\Logger;
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
use Monolog\Logger;
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
/**
|
||||
@@ -24,12 +25,12 @@ class task_manager
|
||||
const STATE_STARTED = 'started';
|
||||
const STATE_TOSTOP = 'tostop';
|
||||
|
||||
protected $appbox;
|
||||
protected $app;
|
||||
protected $tasks;
|
||||
|
||||
public function __construct(appbox &$appbox)
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
$this->appbox = $appbox;
|
||||
$this->app = $app;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -68,18 +69,16 @@ class task_manager
|
||||
|
||||
public function getTasks($refresh = false, Logger $logger = null)
|
||||
{
|
||||
if ($this->tasks && ! $refresh) {
|
||||
if ($this->tasks && !$refresh) {
|
||||
return $this->tasks;
|
||||
}
|
||||
|
||||
$core = \bootstrap::getCore();
|
||||
|
||||
if ( ! $logger) {
|
||||
$logger = $core['monolog'];
|
||||
if (!$logger) {
|
||||
$logger = $this->app['monolog'];
|
||||
}
|
||||
|
||||
$sql = "SELECT task2.* FROM task2 ORDER BY task_id ASC";
|
||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
@@ -90,11 +89,11 @@ class task_manager
|
||||
$row['pid'] = NULL;
|
||||
|
||||
$classname = $row['class'];
|
||||
if ( ! class_exists($classname)) {
|
||||
if (!class_exists($classname)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
$tasks[$row['task_id']] = new $classname($row['task_id'], $app, $logger);
|
||||
$tasks[$row['task_id']] = new $classname($row['task_id'], $this->app, $logger);
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
@@ -110,17 +109,15 @@ class task_manager
|
||||
* @param int $task_id
|
||||
* @return task_abstract
|
||||
*/
|
||||
public function getTask(Application $app, $task_id, Logger $logger = null)
|
||||
public function getTask($task_id, Logger $logger = null)
|
||||
{
|
||||
$core = \bootstrap::getCore();
|
||||
|
||||
if ( ! $logger) {
|
||||
$logger = $core['monolog'];
|
||||
if (!$logger) {
|
||||
$logger = $this->app['monolog'];
|
||||
}
|
||||
|
||||
$tasks = $this->getTasks($app, false, $logger);
|
||||
$tasks = $this->getTasks(false, $logger);
|
||||
|
||||
if ( ! isset($tasks[$task_id])) {
|
||||
if (!isset($tasks[$task_id])) {
|
||||
throw new Exception_NotFound('Unknown task_id ' . $task_id);
|
||||
}
|
||||
|
||||
@@ -145,11 +142,11 @@ class task_manager
|
||||
self::STATE_TOSTOP
|
||||
);
|
||||
|
||||
if ( ! in_array($status, $av_status))
|
||||
if (!in_array($status, $av_status))
|
||||
throw new Exception(sprintf('unknown status `%s` ', $status));
|
||||
|
||||
$sql = "UPDATE sitepreff SET schedstatus = :schedstatus, schedqtime=NOW()";
|
||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':schedstatus' => $status));
|
||||
$stmt->closeCursor();
|
||||
|
||||
@@ -158,19 +155,17 @@ class task_manager
|
||||
|
||||
public function getSchedulerState()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
|
||||
$sql = "SELECT UNIX_TIMESTAMP()-UNIX_TIMESTAMP(schedqtime) AS qdelay
|
||||
, schedqtime AS updated_on
|
||||
, schedstatus AS status FROM sitepreff";
|
||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$ret = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$pid = NULL;
|
||||
|
||||
$lockdir = $appbox->get_registry()->get('GV_RootPath') . 'tmp/locks/';
|
||||
$lockdir = $this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/locks/';
|
||||
if (($schedlock = fopen($lockdir . 'scheduler.lock', 'a+')) != FALSE) {
|
||||
if (flock($schedlock, LOCK_EX | LOCK_NB) === FALSE) {
|
||||
// already locked : running !
|
||||
@@ -190,7 +185,7 @@ class task_manager
|
||||
|
||||
if ($pid === NULL && $ret['status'] !== 'stopped') {
|
||||
// auto fix
|
||||
$this->appbox->get_connection()->exec('UPDATE sitepreff SET schedstatus=\'stopped\'');
|
||||
$this->app['phraseanet.appbox']->get_connection()->exec('UPDATE sitepreff SET schedstatus=\'stopped\'');
|
||||
$ret['status'] = 'stopped';
|
||||
}
|
||||
$ret['pid'] = $pid;
|
||||
@@ -200,17 +195,17 @@ class task_manager
|
||||
|
||||
public static function getAvailableTasks()
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$taskdir = array($registry->get('GV_RootPath') . "lib/classes/task/period/"
|
||||
, $registry->get('GV_RootPath') . "config/classes/task/period/"
|
||||
$taskdir = array(
|
||||
__DIR__ . "/period/",
|
||||
__DIR__ . "/../../../config/classes/task/period/",
|
||||
);
|
||||
|
||||
$tasks = array();
|
||||
foreach ($taskdir as $path) {
|
||||
if (($hdir = @opendir($path)) != FALSE) {
|
||||
$max = 9999;
|
||||
while (($max -- > 0) && (($file = readdir($hdir)) !== false)) {
|
||||
if ( ! is_file($path . '/' . $file) || substr($file, 0, 1) == "." || substr($file, -10) != ".class.php") {
|
||||
while (($max-- > 0) && (($file = readdir($hdir)) !== false)) {
|
||||
if (!is_file($path . '/' . $file) || substr($file, 0, 1) == "." || substr($file, -10) != ".class.php") {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -8,6 +8,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
@@ -445,7 +447,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
}
|
||||
|
||||
try {
|
||||
$connbas = connection::getPDOConnection($task['sbas_id']);
|
||||
$connbas = connection::getPDOConnection($this->dependencyContainer, $task['sbas_id']);
|
||||
} catch (Exception $e) {
|
||||
$this->log(sprintf("can't connect sbas %s", $task['sbas_id']));
|
||||
continue;
|
||||
@@ -457,7 +459,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
|
||||
$tmp = array('sbas_id' => $task['sbas_id'], 'record_id' => $row['record_id'], 'action' => $task['action']);
|
||||
|
||||
$rec = new record_adapter($task['sbas_id'], $row['record_id']);
|
||||
$rec = new record_adapter($this->dependencyContainer, $task['sbas_id'], $row['record_id']);
|
||||
switch ($task['action']) {
|
||||
|
||||
case 'UPDATE':
|
||||
@@ -500,16 +502,16 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
protected function processOneContent(appbox $appbox, Array $row)
|
||||
{
|
||||
$logsql = (int) ($this->sxTaskSettings->logsql) > 0;
|
||||
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$databox = $appbox->get_databox($row['sbas_id']);
|
||||
$rec = new record_adapter($row['sbas_id'], $row['record_id']);
|
||||
$rec = new record_adapter($this->dependencyContainer, $row['sbas_id'], $row['record_id']);
|
||||
switch ($row['action']) {
|
||||
|
||||
case 'UPDATE':
|
||||
|
||||
// change collection ?
|
||||
if (array_key_exists('coll', $row)) {
|
||||
$coll = collection::get_from_coll_id($databox, $row['coll']);
|
||||
$coll = collection::get_from_coll_id($this->dependencyContainer, $databox, $row['coll']);
|
||||
$rec->move_to_collection($coll, $appbox);
|
||||
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()));
|
||||
@@ -572,7 +574,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
*/
|
||||
private function calcSQL($sxtask, $playTest = false)
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
|
||||
$sbas_id = (int) ($sxtask['sbas_id']);
|
||||
|
||||
@@ -741,7 +743,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
*/
|
||||
private function calcWhere($sbas_id, &$sxtask)
|
||||
{
|
||||
$connbas = connection::getPDOConnection($sbas_id);
|
||||
$connbas = connection::getPDOConnection($this->dependencyContainer, $sbas_id);
|
||||
|
||||
$tw = array();
|
||||
$join = '';
|
||||
@@ -845,7 +847,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
*/
|
||||
private function playTest($sbas_id, $sql)
|
||||
{
|
||||
$connbas = connection::getPDOConnection($sbas_id);
|
||||
$connbas = connection::getPDOConnection($this->dependencyContainer, $sbas_id);
|
||||
$result = array('rids' => array(), 'err' => '', 'n' => null);
|
||||
|
||||
$result['n'] = $connbas->query('SELECT COUNT(*) AS n FROM (' . $sql . ') AS x')->fetchColumn();
|
||||
|
@@ -9,6 +9,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
@@ -72,8 +74,8 @@ class task_period_apibridge extends task_appboxAbstract
|
||||
protected function processOneContent(appbox $appbox, Array $row)
|
||||
{
|
||||
try {
|
||||
$account = Bridge_Account::load_account($appbox, $row['account_id']);
|
||||
$element = new Bridge_Element($appbox, $account, $row['id']);
|
||||
$account = Bridge_Account::load_account($this->dependencyContainer, $row['account_id']);
|
||||
$element = new Bridge_Element($this->dependencyContainer, $account, $row['id']);
|
||||
|
||||
$this->log("process " . $element->get_id() . " with status " . $element->get_status());
|
||||
|
||||
@@ -138,7 +140,6 @@ class task_period_apibridge extends task_appboxAbstract
|
||||
*/
|
||||
protected function update_element(Bridge_Element &$element)
|
||||
{
|
||||
$Core = bootstrap::getCore();
|
||||
$account = $element->get_account();
|
||||
$connector_status = $account->get_api()->get_element_status($element);
|
||||
|
||||
@@ -167,7 +168,7 @@ class task_period_apibridge extends task_appboxAbstract
|
||||
, 'sbas_id' => $element->get_record()->get_sbas_id()
|
||||
, 'record_id' => $element->get_record()->get_record_id()
|
||||
);
|
||||
$events_mngr = $Core['events-manager'];
|
||||
$events_mngr = $this->dependencyContainer['events-manager'];
|
||||
$events_mngr->trigger('__BRIDGE_UPLOAD_FAIL__', $params);
|
||||
|
||||
break;
|
||||
|
@@ -8,6 +8,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
use Alchemy\Phrasea\Metadata\Tag as PhraseaTag;
|
||||
use Alchemy\Phrasea\Border\Attribute as BorderAttribute;
|
||||
use MediaVorus\MediaVorus;
|
||||
@@ -196,7 +197,7 @@ class task_period_archive extends task_abstract
|
||||
*/
|
||||
public function getInterfaceHTML()
|
||||
{
|
||||
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
@@ -260,13 +261,13 @@ class task_period_archive extends task_abstract
|
||||
{
|
||||
$this->debug = false;
|
||||
|
||||
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$conn = $appbox->get_connection();
|
||||
|
||||
$this->sxTaskSettings = simplexml_load_string($this->settings);
|
||||
|
||||
$base_id = (int) ($this->sxTaskSettings->base_id);
|
||||
$this->sbas_id = \phrasea::sbasFromBas($base_id);
|
||||
$this->sbas_id = \phrasea::sbasFromBas($this->dependencyContainer, $base_id);
|
||||
|
||||
if ( ! $this->sbas_id) {
|
||||
$this->log('base_id unknown');
|
||||
@@ -349,7 +350,7 @@ class task_period_archive extends task_abstract
|
||||
$loop = 0;
|
||||
while ($this->running) {
|
||||
try {
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
} catch (Exception $e) {
|
||||
$this->log($e->getMessage());
|
||||
if ($this->getRunner() == self::RUNNER_SCHEDULER) {
|
||||
@@ -497,8 +498,8 @@ class task_period_archive extends task_abstract
|
||||
{
|
||||
clearstatcache();
|
||||
|
||||
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||
connection::getPDOConnection();
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
connection::getPDOConnection($this->dependencyContainer);
|
||||
$appbox->get_databox($this->sbas_id)->get_connection();
|
||||
|
||||
$path_in = p4string::delEndSlash(trim((string) ($this->sxTaskSettings->hotfolder)));
|
||||
@@ -1407,7 +1408,7 @@ class task_period_archive extends task_abstract
|
||||
*/
|
||||
private function archiveGrp(\DOMDocument $dom, \DOMElement $node, $path, $path_archived, $path_error, array &$nodesToDel)
|
||||
{
|
||||
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$xpath = new DOMXPath($dom);
|
||||
|
||||
// grp folders stay in place
|
||||
@@ -1432,7 +1433,7 @@ class task_period_archive extends task_abstract
|
||||
// if the .grp does not have a representative doc, let's use a generic file
|
||||
if ( ! ($rep = $node->getAttribute('grp_representation'))) {
|
||||
|
||||
$registry = registry::get_instance();
|
||||
$registry = $this->dependencyContainer['phraseanet.registry'];
|
||||
|
||||
try {
|
||||
$this->dependencyContainer['filesystem']->copy(p4string::addEndSlash($registry->get('GV_RootPath')) . 'www/skins/icons/substitution/regroup_doc.png', $genericdoc = ($path . '/group.jpg'), true);
|
||||
@@ -1461,7 +1462,7 @@ class task_period_archive extends task_abstract
|
||||
try {
|
||||
|
||||
$databox = $appbox->get_databox($this->sbas_id);
|
||||
$collection = collection::get_from_coll_id($databox, (int) $cid);
|
||||
$collection = collection::get_from_coll_id($this->dependencyContainer, $databox, (int) $cid);
|
||||
if ($captionFileName === null) {
|
||||
$story = $this->createStory($collection, $path . '/' . $representationFileName, null);
|
||||
} else {
|
||||
@@ -1614,20 +1615,19 @@ class task_period_archive extends task_abstract
|
||||
$stat1 = '0';
|
||||
}
|
||||
|
||||
$core = \bootstrap::getCore();
|
||||
$media = $core['mediavorus']->guess(new \SplFileInfo($pathfile));
|
||||
$media = $this->dependencyContainer['mediavorus']->guess($pathfile);
|
||||
|
||||
$databox = $collection->get_databox();
|
||||
$metadatasStructure = $databox->get_meta_structure();
|
||||
|
||||
$metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getEntity()->getMetadatas());
|
||||
$metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getMetadatas());
|
||||
|
||||
if ($captionFile !== null && true === $this->dependencyContainer['filesystem']->exists($captionFile)) {
|
||||
$caption = $this->readXMLForDatabox($metadatasStructure, $captionFile);
|
||||
$captionStatus = $this->parseStatusBit(simplexml_load_file($captionFile));
|
||||
|
||||
if ($captionStatus) {
|
||||
$status = databox_status::operation_or($status, $captionStatus);
|
||||
$status = databox_status::operation_or($this->dependencyContainer, $status, $captionStatus);
|
||||
}
|
||||
|
||||
$metadatas = $this->mergeForDatabox($metadatasStructure, $metadatas, $caption);
|
||||
@@ -1635,11 +1635,11 @@ class task_period_archive extends task_abstract
|
||||
|
||||
$metas = $this->bagToArray($metadatasStructure, $metadatas);
|
||||
|
||||
$story = record_adapter::createStory($collection);
|
||||
$story->substitute_subdef('document', $media, $this->dependencyContainer['filesystem'], $core['media-alchemyst'], $core['mediavorus']);
|
||||
$story = record_adapter::createStory($this->dependencyContainer, $collection);
|
||||
$story->substitute_subdef('document', $media, $this->dependencyContainer);
|
||||
|
||||
$story->set_metadatas($metas, true);
|
||||
$story->set_binary_status(databox_status::operation_or($stat0, $stat1));
|
||||
$story->set_binary_status(databox_status::operation_or($this->dependencyContainer, $stat0, $stat1));
|
||||
$story->rebuild_subdefs();
|
||||
$story->reindex();
|
||||
|
||||
@@ -1678,29 +1678,28 @@ class task_period_archive extends task_abstract
|
||||
$stat1 = '0';
|
||||
}
|
||||
|
||||
$core = \bootstrap::getCore();
|
||||
$status = databox_status::operation_or($stat0, $stat1);
|
||||
$status = databox_status::operation_or($this->dependencyContainer, $stat0, $stat1);
|
||||
|
||||
$media = $core['mediavorus']->guess(new \SplFileInfo($pathfile));
|
||||
$media = $this->dependencyContainer['mediavorus']->guess($pathfile);
|
||||
|
||||
$databox = $collection->get_databox();
|
||||
$metadatasStructure = $databox->get_meta_structure();
|
||||
|
||||
$metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getEntity()->getMetadatas());
|
||||
$metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getMetadatas());
|
||||
|
||||
if ($captionFile !== null && true === $this->dependencyContainer['filesystem']->exists($captionFile)) {
|
||||
$caption = $this->readXMLForDatabox($metadatasStructure, $captionFile);
|
||||
$captionStatus = $this->parseStatusBit(simplexml_load_file($captionFile));
|
||||
|
||||
if ($captionStatus) {
|
||||
$status = databox_status::operation_or($status, $captionStatus);
|
||||
$status = databox_status::operation_or($this->dependencyContainer, $status, $captionStatus);
|
||||
}
|
||||
|
||||
$metadatas = $this->mergeForDatabox($metadatasStructure, $metadatas, $caption);
|
||||
}
|
||||
$file = new \Alchemy\Phrasea\Border\File($media, $collection);
|
||||
|
||||
$file->addAttribute(new BorderAttribute\Status($status));
|
||||
$file->addAttribute(new BorderAttribute\Status($this->dependencyContainer, $status));
|
||||
|
||||
$file->addAttribute(new BorderAttribute\Metadata(new Metadata(new PhraseaTag\TfFilepath(), new \PHPExiftool\Driver\Value\Mono($media->getFile()->getRealPath()))));
|
||||
$file->addAttribute(new BorderAttribute\Metadata(new Metadata(new PhraseaTag\TfDirname(), new \PHPExiftool\Driver\Value\Mono(dirname($media->getFile()->getRealPath())))));
|
||||
@@ -1714,7 +1713,7 @@ class task_period_archive extends task_abstract
|
||||
}
|
||||
|
||||
if ($grp_rid) {
|
||||
$file->addAttribute(new BorderAttribute\Story(new record_adapter($databox->get_sbas_id(), $grp_rid)));
|
||||
$file->addAttribute(new BorderAttribute\Story(new record_adapter($this->dependencyContainer, $databox->get_sbas_id(), $grp_rid)));
|
||||
}
|
||||
|
||||
$record = null;
|
||||
@@ -1723,7 +1722,7 @@ class task_period_archive extends task_abstract
|
||||
$record = $element;
|
||||
};
|
||||
|
||||
$core['border-manager']->process($this->getLazaretSession(), $file, $postProcess, $force);
|
||||
$this->dependencyContainer['border-manager']->process($this->getLazaretSession(), $file, $postProcess, $force);
|
||||
|
||||
return $record;
|
||||
}
|
||||
@@ -1828,11 +1827,11 @@ class task_period_archive extends task_abstract
|
||||
* @param integer $grp_rid
|
||||
* @param array $nodesToDel out, filled with files to delete
|
||||
*/
|
||||
private function archiveFileAndCaption(\DOMDOcument$dom, \DOMElement $node, \DOMElement $captionFileNode = null, $path, $path_archived, $path_error, $grp_rid, array &$nodesToDel)
|
||||
private function archiveFileAndCaption(\DOMDocument $dom, \DOMElement $node, \DOMElement $captionFileNode = null, $path, $path_archived, $path_error, $grp_rid, array &$nodesToDel)
|
||||
{
|
||||
$ret = false;
|
||||
|
||||
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$file = $node->getAttribute('name');
|
||||
$cid = $node->getAttribute('cid');
|
||||
$captionFileName = $captionFileNode ? $captionFileNode->getAttribute('name') : null;
|
||||
@@ -1864,7 +1863,7 @@ class task_period_archive extends task_abstract
|
||||
|
||||
try {
|
||||
$databox = $appbox->get_databox($this->sbas_id);
|
||||
$collection = collection::get_from_coll_id($databox, (int) $cid);
|
||||
$collection = collection::get_from_coll_id($this->dependencyContainer, $databox, (int) $cid);
|
||||
|
||||
if ($captionFileName === null) {
|
||||
$record = $this->createRecord($collection, $path . '/' . $file, null, $grp_rid);
|
||||
@@ -2043,12 +2042,10 @@ class task_period_archive extends task_abstract
|
||||
return $this->lazaretSession;
|
||||
}
|
||||
|
||||
$core = \bootstrap::getCore();
|
||||
|
||||
$lazaretSession = new \Entities\LazaretSession();
|
||||
|
||||
$core['EM']->persist($lazaretSession);
|
||||
$core['EM']->flush();
|
||||
$this->dependencyContainer['EM']->persist($lazaretSession);
|
||||
$this->dependencyContainer['EM']->flush();
|
||||
|
||||
$this->lazaretSession = $lazaretSession;
|
||||
|
||||
|
@@ -435,7 +435,7 @@ class task_period_cindexer extends task_abstract
|
||||
$args_nopwd[] = '--run';
|
||||
}
|
||||
|
||||
$registry = registry::get_instance();
|
||||
$registry = $this->dependencyContainer['phraseanet.registry'];
|
||||
$logdir = p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
|
||||
|
||||
$this->new_status = NULL; // new status to set at the end
|
||||
|
@@ -48,7 +48,7 @@ class task_period_emptyColl extends task_appboxAbstract
|
||||
|
||||
return array();
|
||||
}
|
||||
$collection = collection::get_from_base_id($this->base_id);
|
||||
$collection = collection::get_from_base_id($this->dependencyContainer, $this->base_id);
|
||||
$this->total_records = $collection->get_record_amount();
|
||||
$collection->empty_collection(200);
|
||||
$this->records_done += $this->total_records;
|
||||
|
@@ -250,7 +250,7 @@ class task_period_ftp extends task_appboxAbstract
|
||||
$sql = "SELECT id FROM ftp_export WHERE crash>=nbretry
|
||||
AND date < :date";
|
||||
|
||||
$params = array(':date' => phraseadate::format_mysql(new DateTime('-30 days')));
|
||||
$params = array(':date' => $this->dependencyContainer['date-formatter']->format_mysql(new DateTime('-30 days')));
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -404,8 +404,8 @@ class task_period_ftp extends task_appboxAbstract
|
||||
$subdef = $file['subdef'];
|
||||
|
||||
try {
|
||||
$sbas_id = phrasea::sbasFromBas($base_id);
|
||||
$record = new record_adapter($sbas_id, $record_id);
|
||||
$sbas_id = phrasea::sbasFromBas($this->dependencyContainer, $base_id);
|
||||
$record = new record_adapter($this->dependencyContainer, $sbas_id, $record_id);
|
||||
|
||||
$sdcaption = $record->get_caption()->serialize(caption_record::SERIALIZE_XML, $ftp_export["businessfields"]);
|
||||
|
||||
@@ -464,12 +464,12 @@ class task_period_ftp extends task_appboxAbstract
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute(array(':file_id' => $file['id']));
|
||||
$stmt->closeCursor();
|
||||
$this->logexport($appbox->get_session(), $record, $obj, $ftpLog);
|
||||
$this->logexport($record, $obj, $ftpLog);
|
||||
} 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
|
||||
, phrasea::sbas_names(phrasea::sbasFromBas($base_id))) . "\n<br/>";
|
||||
, phrasea::sbas_names(phrasea::sbasFromBas($this->dependencyContainer, $base_id), $app)) . "\n<br/>";
|
||||
|
||||
$this->logger->addDebug($line);
|
||||
|
||||
@@ -601,7 +601,7 @@ class task_period_ftp extends task_appboxAbstract
|
||||
public function send_mails(appbox $appbox, $id)
|
||||
{
|
||||
$conn = $appbox->get_connection();
|
||||
$registry = registry::get_instance();
|
||||
$registry = $this->dependencyContainer['phraseanet.registry'];
|
||||
|
||||
$sql = 'SELECT filename, base_id, record_id, subdef, error, done'
|
||||
. ' FROM ftp_export_elements WHERE ftp_export_id = :export_id';
|
||||
@@ -620,13 +620,13 @@ class task_period_ftp extends task_appboxAbstract
|
||||
$transferts[] =
|
||||
'<li>' . sprintf(_('task::ftp:Record %1$s - %2$s de la base (%3$s - %4$s) - %5$s')
|
||||
, $row["record_id"], $row["filename"]
|
||||
, phrasea::sbas_names(phrasea::sbasFromBas($row["base_id"]))
|
||||
, phrasea::bas_names($row['base_id']), $row['subdef']) . ' : ' . _('Transfert OK') . '</li>';
|
||||
, phrasea::sbas_names(phrasea::sbasFromBas($this->dependencyContainer, $row["base_id"]), $app)
|
||||
, phrasea::bas_names($row['base_id'], $app), $row['subdef']) . ' : ' . _('Transfert OK') . '</li>';
|
||||
} else {
|
||||
$transferts[] =
|
||||
'<li>' . sprintf(_('task::ftp:Record %1$s - %2$s de la base (%3$s - %4$s) - %5$s')
|
||||
, $row["record_id"], $row["filename"]
|
||||
, phrasea::sbas_names(phrasea::sbasFromBas($row["base_id"])), phrasea::bas_names($row['base_id'])
|
||||
, phrasea::sbas_names(phrasea::sbasFromBas($this->dependencyContainer, $row["base_id"]), $app), phrasea::bas_names($row['base_id'], $app)
|
||||
, $row['subdef']) . ' : ' . _('Transfert Annule') . '</li>';
|
||||
$transfert_status = _('task::ftp:Certains documents n\'ont pas pu etre tranferes');
|
||||
}
|
||||
@@ -671,15 +671,15 @@ class task_period_ftp extends task_appboxAbstract
|
||||
, $registry->get('GV_homeTitle'), $ftp_server
|
||||
);
|
||||
|
||||
mail::ftp_sent($sendermail, $subject, $sender_message);
|
||||
mail::ftp_sent($this->dependencyContainer, $sendermail, $subject, $sender_message);
|
||||
|
||||
mail::ftp_receive($mail, $receiver_message);
|
||||
mail::ftp_receive($this->dependencyContainer, $mail, $receiver_message);
|
||||
}
|
||||
|
||||
public function logexport(Session_Handler $session, record_adapter $record, $obj, $ftpLog)
|
||||
public function logexport(record_adapter $record, $obj, $ftpLog)
|
||||
{
|
||||
foreach ($obj as $oneObj) {
|
||||
$session->get_logger($record->get_databox())
|
||||
$this->app['phraseanet.logger']($record->get_databox())
|
||||
->log($record, Session_Logger::EVENT_EXPORTFTP, $ftpLog, '');
|
||||
}
|
||||
|
||||
|
@@ -8,6 +8,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
@@ -310,9 +312,8 @@ class task_period_outofdate extends task_abstract
|
||||
// ====================================================================
|
||||
public function getInterfaceHTML()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$user = $this->dependencyContainer['phraseanet.user'];
|
||||
ob_start();
|
||||
|
||||
$sbas_list = $user->ACL()->get_granted_sbas(array('bas_manage'));
|
||||
@@ -437,13 +438,13 @@ class task_period_outofdate extends task_abstract
|
||||
protected function run2()
|
||||
{
|
||||
$ret = '';
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
|
||||
$this->sxTaskSettings = simplexml_load_string($this->settings);
|
||||
|
||||
$this->sbas_id = (int) ($this->sxTaskSettings->sbas_id);
|
||||
|
||||
$this->connbas = connection::getPDOConnection($this->sbas_id);
|
||||
$this->connbas = connection::getPDOConnection($this->dependencyContainer, $this->sbas_id);
|
||||
|
||||
$this->running = true;
|
||||
$this->tmask = array();
|
||||
@@ -465,7 +466,7 @@ class task_period_outofdate extends task_abstract
|
||||
}
|
||||
|
||||
try {
|
||||
$connbas = connection::getPDOConnection($this->sbas_id);
|
||||
$connbas = connection::getPDOConnection($this->dependencyContainer, $this->sbas_id);
|
||||
if ( ! $connbas->ping()) {
|
||||
throw new Exception('Mysql has gone away');
|
||||
}
|
||||
@@ -500,7 +501,7 @@ class task_period_outofdate extends task_abstract
|
||||
} else {
|
||||
$period = 60;
|
||||
}
|
||||
$this->connbas = connection::getPDOConnection($this->sbas_id);
|
||||
$this->connbas = connection::getPDOConnection($this->dependencyContainer, $this->sbas_id);
|
||||
|
||||
$duration = time();
|
||||
|
||||
@@ -519,7 +520,7 @@ class task_period_outofdate extends task_abstract
|
||||
$duration = time() - $duration;
|
||||
if ($duration < $period) {
|
||||
sleep($period - $duration);
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
}
|
||||
break;
|
||||
case 'MAXRECSDONE':
|
||||
@@ -731,7 +732,7 @@ class task_period_outofdate extends task_abstract
|
||||
{
|
||||
$ret = NULL;
|
||||
|
||||
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$request = http_request::getInstance();
|
||||
$parm2 = $request->get_parms(
|
||||
'ACT', 'bid'
|
||||
|
@@ -159,9 +159,9 @@ class task_period_subdef extends task_databoxAbstract
|
||||
, $this->sbas_id, $record_id));
|
||||
|
||||
try {
|
||||
$record = new record_adapter($this->sbas_id, $record_id);
|
||||
$record = new record_adapter($this->dependencyContainer, $this->sbas_id, $record_id);
|
||||
|
||||
$record->generate_subdefs($databox, $this->logger);
|
||||
$record->generate_subdefs($databox, $this->dependencyContainer);
|
||||
} catch (\Exception $e) {
|
||||
$this->log(
|
||||
sprintf(
|
||||
@@ -205,7 +205,7 @@ class task_period_subdef extends task_databoxAbstract
|
||||
));
|
||||
|
||||
try {
|
||||
$connbas = connection::getPDOConnection($this->sbas_id);
|
||||
$connbas = connection::getPDOConnection($this->dependencyContainer, $this->sbas_id);
|
||||
$sql = 'UPDATE record
|
||||
SET status=(status & ~0x03),
|
||||
jeton=(jeton | ' . JETON_WRITE_META_SUBDEF . ')
|
||||
|
@@ -8,6 +8,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
@@ -261,9 +263,8 @@ class task_period_workflow01 extends task_databoxAbstract
|
||||
|
||||
public function getInterfaceHTML()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$user = $this->dependencyContainer['phraseanet.user'];
|
||||
ob_start();
|
||||
?>
|
||||
<form name="graphicForm" onsubmit="return(false);" method="post">
|
||||
@@ -430,9 +431,8 @@ class task_period_workflow01 extends task_databoxAbstract
|
||||
{
|
||||
$request = http_request::getInstance();
|
||||
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$user = $this->dependencyContainer['phraseanet.user'];
|
||||
|
||||
$parm = $request->get_parms("bid");
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
use PHPExiftool\Driver\Metadata;
|
||||
use PHPExiftool\Driver\Value;
|
||||
use PHPExiftool\Driver\Tag;
|
||||
@@ -172,10 +173,8 @@ class task_period_writemeta extends task_databoxAbstract
|
||||
|
||||
public function getInterfaceHTML()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$sbas_ids = User_Adapter::getInstance($session->get_usr_id(), $appbox)
|
||||
->ACL()->get_granted_sbas(array('bas_manage'));
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$sbas_ids = $this->dependencyContainer['phraseanet.user']->ACL()->get_granted_sbas(array('bas_manage'));
|
||||
|
||||
ob_start();
|
||||
if (count($sbas_ids) > 0) {
|
||||
@@ -236,7 +235,7 @@ class task_period_writemeta extends task_databoxAbstract
|
||||
$record_id = $row['record_id'];
|
||||
$jeton = $row['jeton'];
|
||||
|
||||
$record = new record_adapter($this->sbas_id, $record_id);
|
||||
$record = new record_adapter($this->dependencyContainer, $this->sbas_id, $record_id);
|
||||
|
||||
$type = $record->get_type();
|
||||
$subdefs = $record->get_subdefs();
|
||||
@@ -312,7 +311,6 @@ class task_period_writemeta extends task_databoxAbstract
|
||||
$writer->write($file, $metadatas);
|
||||
|
||||
$this->log(sprintf('Success writing meta for sbas_id=%1$d - record_id=%2$d (%3$s)', $this->sbas_id, $record_id, $name));
|
||||
|
||||
} catch (\PHPExiftool\Exception\Exception $e) {
|
||||
$this->log(sprintf('Failure writing meta for sbas_id=%1$d - record_id=%2$d (%3$s)', $this->sbas_id, $record_id, $name));
|
||||
}
|
||||
|
Reference in New Issue
Block a user