mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 13:03:20 +00:00
Cleanup namepaces, variables uses
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Monolog\Logger;
|
||||
|
||||
@@ -53,10 +52,8 @@ class task_Scheduler
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$registry = $this->dependencyContainer['phraseanet.registry'];
|
||||
|
||||
//prevent scheduler to fail if GV_cli is not provided
|
||||
if ( ! is_executable($registry->get('GV_cli'))) {
|
||||
if ( ! is_executable($this->dependencyContainer['phraseanet.registry']->get('GV_cli'))) {
|
||||
throw new \RuntimeException('PHP cli is not provided in registry');
|
||||
}
|
||||
|
||||
@@ -75,7 +72,7 @@ class task_Scheduler
|
||||
$this->method = self::METHOD_FORK;
|
||||
}
|
||||
|
||||
$lockdir = $registry->get('GV_RootPath') . 'tmp/locks/';
|
||||
$lockdir = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/locks/';
|
||||
|
||||
for ($try = 1; true; $try ++ ) {
|
||||
$lockfile = ($lockdir . 'scheduler.lock');
|
||||
@@ -217,10 +214,10 @@ class task_Scheduler
|
||||
$taskPoll[$tkey] = array(
|
||||
"task" => $task,
|
||||
"current_status" => $status,
|
||||
"cmd" => $registry->get('GV_cli'),
|
||||
"cmd" => $this->dependencyContainer['phraseanet.registry']->get('GV_cli'),
|
||||
"args" => array(
|
||||
'-f',
|
||||
$registry->get('GV_RootPath') . 'bin/console',
|
||||
$this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'bin/console',
|
||||
'--',
|
||||
'-q',
|
||||
'task:run',
|
||||
@@ -331,7 +328,7 @@ class task_Scheduler
|
||||
$taskPoll[$tkey]["cmd"] . ' ' . implode(' ', $taskPoll[$tkey]["args"])
|
||||
, $descriptors
|
||||
, $taskPoll[$tkey]["pipes"]
|
||||
, $registry->get('GV_RootPath') . "bin/"
|
||||
, $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . "bin/"
|
||||
, null
|
||||
, array('bypass_shell' => true)
|
||||
);
|
||||
|
@@ -9,8 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
|
@@ -9,8 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
|
@@ -9,7 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
use Monolog\Logger;
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
|
@@ -8,8 +8,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
|
@@ -9,8 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
|
@@ -8,10 +8,8 @@
|
||||
* 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;
|
||||
use PHPExiftool\Driver\Metadata\Metadata;
|
||||
use PHPExiftool\Driver\Metadata\MetadataBag;
|
||||
use Symfony\Component\Filesystem\Exception\IOException;
|
||||
@@ -197,8 +195,6 @@ class task_period_archive extends task_abstract
|
||||
*/
|
||||
public function getInterfaceHTML()
|
||||
{
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<form id="graphicForm" name="graphicForm" onsubmit="return(false);" method="post">
|
||||
@@ -207,7 +203,7 @@ class task_period_archive extends task_abstract
|
||||
<select name="base_id">
|
||||
<option value="">...</option>
|
||||
<?php
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($this->dependencyContainer['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
print("<option value=\"" . $collection->get_base_id() . "\">" . $databox->get_viewname() . " / " . $collection->get_name() . "</option>");
|
||||
}
|
||||
@@ -261,8 +257,7 @@ class task_period_archive extends task_abstract
|
||||
{
|
||||
$this->debug = false;
|
||||
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$conn = $appbox->get_connection();
|
||||
$conn = $this->dependencyContainer['phraseanet.appbox']->get_connection();
|
||||
|
||||
$this->sxTaskSettings = simplexml_load_string($this->settings);
|
||||
|
||||
@@ -275,7 +270,7 @@ class task_period_archive extends task_abstract
|
||||
return 'tostop';
|
||||
}
|
||||
|
||||
$databox = $appbox->get_databox($this->sbas_id);
|
||||
$databox = $this->dependencyContainer['phraseanet.appbox']->get_databox($this->sbas_id);
|
||||
|
||||
$this->TColls = array();
|
||||
$collection = null;
|
||||
@@ -498,9 +493,8 @@ class task_period_archive extends task_abstract
|
||||
{
|
||||
clearstatcache();
|
||||
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
connection::getPDOConnection($this->dependencyContainer);
|
||||
$appbox->get_databox($this->sbas_id)->get_connection();
|
||||
$this->dependencyContainer['phraseanet.appbox']->get_databox($this->sbas_id)->get_connection();
|
||||
|
||||
$path_in = p4string::delEndSlash(trim((string) ($this->sxTaskSettings->hotfolder)));
|
||||
if (false === $this->dependencyContainer['filesystem']->exists($path_in . "/.phrasea.xml")) {
|
||||
@@ -1408,7 +1402,6 @@ class task_period_archive extends task_abstract
|
||||
*/
|
||||
private function archiveGrp(\DOMDocument $dom, \DOMElement $node, $path, $path_archived, $path_error, array &$nodesToDel)
|
||||
{
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$xpath = new DOMXPath($dom);
|
||||
|
||||
// grp folders stay in place
|
||||
@@ -1433,10 +1426,8 @@ 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 = $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);
|
||||
$this->dependencyContainer['filesystem']->copy(p4string::addEndSlash($this->dependencyContainer['phraseanet.registry']->get('GV_RootPath')) . 'www/skins/icons/substitution/regroup_doc.png', $genericdoc = ($path . '/group.jpg'), true);
|
||||
} catch (IOException $e) {
|
||||
$this->log($e->getMessage());
|
||||
}
|
||||
@@ -1461,7 +1452,7 @@ class task_period_archive extends task_abstract
|
||||
|
||||
try {
|
||||
|
||||
$databox = $appbox->get_databox($this->sbas_id);
|
||||
$databox = $this->dependencyContainer['phraseanet.appbox']->get_databox($this->sbas_id);
|
||||
$collection = collection::get_from_coll_id($this->dependencyContainer, $databox, (int) $cid);
|
||||
if ($captionFileName === null) {
|
||||
$story = $this->createStory($collection, $path . '/' . $representationFileName, null);
|
||||
@@ -1831,7 +1822,6 @@ class task_period_archive extends task_abstract
|
||||
{
|
||||
$ret = false;
|
||||
|
||||
$appbox = $this->dependencyContainer['phraseanet.appbox'];
|
||||
$file = $node->getAttribute('name');
|
||||
$cid = $node->getAttribute('cid');
|
||||
$captionFileName = $captionFileNode ? $captionFileNode->getAttribute('name') : null;
|
||||
@@ -1862,7 +1852,7 @@ class task_period_archive extends task_abstract
|
||||
}
|
||||
|
||||
try {
|
||||
$databox = $appbox->get_databox($this->sbas_id);
|
||||
$databox = $this->dependencyContainer['phraseanet.appbox']->get_databox($this->sbas_id);
|
||||
$collection = collection::get_from_coll_id($this->dependencyContainer, $databox, (int) $cid);
|
||||
|
||||
if ($captionFileName === null) {
|
||||
|
@@ -435,8 +435,7 @@ class task_period_cindexer extends task_abstract
|
||||
$args_nopwd[] = '--run';
|
||||
}
|
||||
|
||||
$registry = $this->dependencyContainer['phraseanet.registry'];
|
||||
$logdir = p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
|
||||
$logdir = p4string::addEndSlash($this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'logs');
|
||||
|
||||
$this->new_status = NULL; // new status to set at the end
|
||||
$this->exception = NULL; // exception to throw at the end
|
||||
|
@@ -304,7 +304,6 @@ class task_period_ftp extends task_appboxAbstract
|
||||
protected function processOneContent(appbox $appbox, Array $ftp_export)
|
||||
{
|
||||
$conn = $appbox->get_connection();
|
||||
$registry = $app['phraseanet.registry'];
|
||||
|
||||
$id = $ftp_export['id'];
|
||||
$ftp_export[$id]["crash"] = $ftp_export["crash"];
|
||||
@@ -340,13 +339,13 @@ class task_period_ftp extends task_appboxAbstract
|
||||
|
||||
if (($ses_id = phrasea_create_session($usr_id)) == null) {
|
||||
$this->logger->addDebug("Unable to create session");
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! ($ph_session = phrasea_open_session($ses_id, $usr_id))) {
|
||||
$this->logger->addDebug("Unable to open session");
|
||||
phrasea_close_session($ses_id);
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -417,14 +416,14 @@ class task_period_ftp extends task_appboxAbstract
|
||||
if ($subdef == 'caption') {
|
||||
$desc = $record->get_caption()->serialize(\caption_record::SERIALIZE_XML, $ftp_export["businessfields"]);
|
||||
|
||||
$localfile = $registry->get('GV_RootPath') . 'tmp/' . md5($desc . time() . mt_rand());
|
||||
$localfile = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/' . md5($desc . time() . mt_rand());
|
||||
if (file_put_contents($localfile, $desc) === false) {
|
||||
throw new Exception('Impossible de creer un fichier temporaire');
|
||||
}
|
||||
} elseif ($subdef == 'caption-yaml') {
|
||||
$desc = $record->get_caption()->serialize(\caption_record::SERIALIZE_YAML, $ftp_export["businessfields"]);
|
||||
|
||||
$localfile = $registry->get('GV_RootPath') . 'tmp/' . md5($desc . time() . mt_rand());
|
||||
$localfile = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/' . md5($desc . time() . mt_rand());
|
||||
if (file_put_contents($localfile, $desc) === false) {
|
||||
throw new Exception('Impossible de creer un fichier temporaire');
|
||||
}
|
||||
@@ -513,7 +512,7 @@ class task_period_ftp extends task_appboxAbstract
|
||||
$buffer .= $root . '/' . $folder . $filename . "\n";
|
||||
}
|
||||
|
||||
$tmpfile = $registry->get('GV_RootPath') . 'tmp/tmpftpbuffer' . $date->format('U') . '.txt';
|
||||
$tmpfile = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/tmpftpbuffer' . $date->format('U') . '.txt';
|
||||
|
||||
file_put_contents($tmpfile, $buffer);
|
||||
|
||||
@@ -604,7 +603,6 @@ class task_period_ftp extends task_appboxAbstract
|
||||
public function send_mails(appbox $appbox, $id)
|
||||
{
|
||||
$conn = $appbox->get_connection();
|
||||
$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';
|
||||
@@ -671,7 +669,7 @@ class task_period_ftp extends task_appboxAbstract
|
||||
|
||||
$subject = sprintf(
|
||||
_('task::ftp:Status about your FTP transfert from %1$s to %2$s')
|
||||
, $registry->get('GV_homeTitle'), $ftp_server
|
||||
, $this->dependencyContainer['phraseanet.registry']->get('GV_homeTitle'), $ftp_server
|
||||
);
|
||||
|
||||
mail::ftp_sent($this->dependencyContainer, $sendermail, $subject, $sender_message);
|
||||
|
@@ -8,8 +8,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
|
@@ -8,8 +8,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
|
@@ -8,7 +8,6 @@
|
||||
* 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;
|
||||
|
Reference in New Issue
Block a user