Remove registry's GV_RootPath calls

This commit is contained in:
Romain Neutron
2013-06-19 19:21:49 +02:00
parent 98bb412575
commit 3f47cc248d
35 changed files with 79 additions and 81 deletions

View File

@@ -83,7 +83,7 @@ class task_Scheduler
$this->method = self::METHOD_FORK;
}
$lockdir = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/locks/';
$lockdir = $this->dependencyContainer['root.path'] . '/tmp/locks/';
for ($try = 1; true; $try ++) {
$lockfile = ($lockdir . 'scheduler.lock');
@@ -228,7 +228,7 @@ class task_Scheduler
"cmd" => $this->dependencyContainer['phraseanet.registry']->get('php_binary'),
"args" => array(
'-f',
$this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'bin/console',
$this->dependencyContainer['root.path'] . '/bin/console',
'--',
'-q',
'task:run',
@@ -339,7 +339,7 @@ class task_Scheduler
escapeshellarg($taskPoll[$tkey]["cmd"]) . ' ' . implode(' ', array_map('escapeshellarg', $taskPoll[$tkey]["args"]))
, $descriptors
, $taskPoll[$tkey]["pipes"]
, $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . "bin/"
, $this->dependencyContainer['root.path'] . "/bin/"
, null
, array('bypass_shell' => true)
);

View File

@@ -574,7 +574,7 @@ abstract class task_abstract
*/
private function getLockfilePath()
{
$lockdir = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/locks/';
$lockdir = $this->dependencyContainer['root.path'] . '/tmp/locks/';
$lockfilePath = ($lockdir . 'task_' . $this->getID() . '.lock');
return $lockfilePath;

View File

@@ -128,7 +128,7 @@ class task_manager
{
$phpcli = $this->app['phraseanet.registry']->get('php_binary');
$cmd = $phpcli . ' -f ' . $this->app['phraseanet.registry']->get('GV_RootPath') . "bin/console scheduler:start";
$cmd = $phpcli . ' -f ' . $this->app['root.path'] . "/bin/console scheduler:start";
return new Process($cmd);
}
@@ -165,7 +165,7 @@ class task_manager
$pid = NULL;
$lockdir = $this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/locks/';
$lockdir = $this->app['root.path'] . '/tmp/locks/';
if (($schedlock = fopen($lockdir . 'scheduler.lock', 'a+')) != FALSE) {
if (flock($schedlock, LOCK_EX | LOCK_NB) === FALSE) {
// already locked : running !

View File

@@ -1426,7 +1426,7 @@ class task_period_archive extends task_abstract
if (!($rep = $node->getAttribute('grp_representation'))) {
try {
$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);
$this->dependencyContainer['filesystem']->copy($this->dependencyContainer['root.path'] . '/www/skins/icons/substitution/regroup_doc.png', $genericdoc = ($path . '/group.jpg'), true);
} catch (IOException $e) {
$this->log($e->getMessage());
}

View File

@@ -442,7 +442,7 @@ class task_period_cindexer extends task_abstract
$args_nopwd[] = '--run';
}
$logdir = p4string::addEndSlash($this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'logs');
$logdir = $this->dependencyContainer['root.path'] . '/logs/';
$this->new_status = NULL; // new status to set at the end
$this->exception = NULL; // exception to throw at the end

View File

@@ -411,14 +411,14 @@ class task_period_ftp extends task_appboxAbstract
if ($subdef == 'caption') {
$desc = $record->get_caption()->serialize(\caption_record::SERIALIZE_XML, $ftp_export["businessfields"]);
$localfile = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/' . md5($desc . time() . mt_rand());
$localfile = $this->dependencyContainer['root.path'] . '/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 = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/' . md5($desc . time() . mt_rand());
$localfile = $this->dependencyContainer['root.path'] . '/tmp/' . md5($desc . time() . mt_rand());
if (file_put_contents($localfile, $desc) === false) {
throw new Exception('Impossible de creer un fichier temporaire');
}
@@ -507,7 +507,7 @@ class task_period_ftp extends task_appboxAbstract
$buffer .= $root . '/' . $folder . $filename . "\n";
}
$tmpfile = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/tmpftpbuffer' . $date->format('U') . '.txt';
$tmpfile = $this->dependencyContainer['root.path'] . '/tmp/tmpftpbuffer' . $date->format('U') . '.txt';
file_put_contents($tmpfile, $buffer);