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

@@ -133,8 +133,8 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea
$url = '/skins/icons/rss32.gif';
$file = $this->app['phraseanet.registry']->get('GV_RootPath')
. 'www/custom/feed_' . $this->get_id() . '.jpg';
$file = $this->app['root.path']
. '/www/custom/feed_' . $this->get_id() . '.jpg';
if (file_exists($file)) {
$url = '/custom/feed_' . $this->get_id() . '.jpg';
@@ -156,8 +156,8 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea
throw new \Alchemy\Phrasea\Exception\InvalidArgumentException('File does not exists');
}
$config_file = $this->app['phraseanet.registry']->get('GV_RootPath') . 'config/feed_' . $this->get_id() . '.jpg';
$www_file = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/feed_' . $this->get_id() . '.jpg';
$config_file = $this->app['root.path'] . '/config/feed_' . $this->get_id() . '.jpg';
$www_file = $this->app['root.path'] . '/www/custom/feed_' . $this->get_id() . '.jpg';
copy($file, $config_file);
copy($file, $www_file);
@@ -185,10 +185,10 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea
public function reset_icon()
{
$config_file = $this->app['phraseanet.registry']->get('GV_RootPath')
. 'config/feed_' . $this->get_id() . '.jpg';
$www_file = $this->app['phraseanet.registry']->get('GV_RootPath')
. 'www/custom/feed_' . $this->get_id() . '.jpg';
$config_file = $this->app['root.path']
. '/config/feed_' . $this->get_id() . '.jpg';
$www_file = $this->app['root.path']
. '/www/custom/feed_' . $this->get_id() . '.jpg';
if (is_file($config_file))
unlink($config_file);

View File

@@ -148,8 +148,8 @@ class appbox extends base
$collection->update_logo($pathfile);
}
$file = $this->app['phraseanet.registry']->get('GV_RootPath') . 'config/' . $pic_type . '/' . $collection->get_base_id();
$custom_path = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/' . $pic_type . '/' . $collection->get_base_id();
$file = $this->app['root.path'] . '/config/' . $pic_type . '/' . $collection->get_base_id();
$custom_path = $this->app['root.path'] . '/www/custom/' . $pic_type . '/' . $collection->get_base_id();
foreach (array($file, $custom_path) as $target) {
@@ -206,8 +206,8 @@ class appbox extends base
}
}
$file = $this->app['phraseanet.registry']->get('GV_RootPath') . 'config/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg';
$custom_path = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg';
$file = $this->app['root.path'] . '/config/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg';
$custom_path = $this->app['root.path'] . '/www/custom/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg';
foreach (array($file, $custom_path) as $target) {
@@ -329,8 +329,8 @@ class appbox extends base
$finder = new Finder();
$finder->in(array(
$this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/cache_minify/',
$this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/cache_twig/',
$this->app['root.path'] . '/tmp/cache_minify/',
$this->app['root.path'] . '/tmp/cache_twig/',
))
->depth(0)
->ignoreVCS(true)
@@ -354,7 +354,7 @@ class appbox extends base
'config/status/' => 'www/custom/status/',
'config/wm/' => 'www/custom/wm/',
) as $source => $target) {
$app['filesystem']->mirror($this->app['phraseanet.registry']->get('GV_RootPath') . $source, $this->app['phraseanet.registry']->get('GV_RootPath') . $target);
$app['filesystem']->mirror($this->app['root.path'] . '/' . $source, $this->app['root.path'] . '/' . $target);
}
$upgrader->add_steps_complete(1);

View File

@@ -765,7 +765,7 @@ abstract class base implements cache_cacheableInterface
$upgrader->add_steps(1)->set_current_message(_('Looking for patches'));
$iterator = new DirectoryIterator($this->app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/patch/');
$iterator = new DirectoryIterator($this->app['root.path'] . '/lib/classes/patch/');
foreach ($iterator as $fileinfo) {
if ( ! $fileinfo->isDot()) {

View File

@@ -648,7 +648,7 @@ class collection implements cache_cacheableInterface
if ( ! isset(self::$_logos[$base_id_key])) {
if (is_file($app['phraseanet.registry']->get('GV_RootPath') . 'config/minilogos/' . $base_id)) {
if (is_file($app['root.path'] . '/config/minilogos/' . $base_id)) {
$name = phrasea::bas_labels($base_id, $app);
self::$_logos[$base_id_key] = '<img title="' . $name
. '" src="' . $app['phraseanet.registry']->get('GV_STATIC_URL')

View File

@@ -1002,7 +1002,7 @@ class databox extends base
$base_ids[] = $base_id = $conn->lastInsertId();
if ( ! empty($row['logo'])) {
file_put_contents($this->app['phraseanet.registry']->get('GV_RootPath') . 'config/minilogos/' . $base_id, $row['logo']);
file_put_contents($this->app['root.path'] . '/config/minilogos/' . $base_id, $row['logo']);
}
} catch (Exception $e) {
unset($e);

View File

@@ -69,7 +69,7 @@ class databox_status
return;
}
$path = $this->path = $app['phraseanet.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 = $app['root.path'] . "/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"]);
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
@@ -431,12 +431,12 @@ class databox_status
$name = "-stat_" . $bit . "_" . ($switch == 'on' ? '1' : '0') . ".gif";
try {
$file = $file->move($app['phraseanet.registry']->get('GV_RootPath') . "config/status/", $path.$name);
$file = $file->move($app['root.path'] . "/config/status/", $path.$name);
} catch (FileException $e) {
throw new Exception_Upload_CannotWriteFile();
}
$custom_path = $app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/status/';
$custom_path = $app['root.path'] . '/www/custom/status/';
$app['filesystem']->mkdir($custom_path, 0750);

View File

@@ -278,7 +278,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$this->mime = 'image/png';
$this->width = 256;
$this->height = 256;
$this->path = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/skins/icons/substitution/';
$this->path = $this->app['root.path'] . '/www/skins/icons/substitution/';
$this->file = 'regroup_thumb.png';
$this->url = '/skins/icons/substitution/regroup_thumb.png';
} else {
@@ -288,7 +288,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$this->mime = 'image/png';
$this->width = 256;
$this->height = 256;
$this->path = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/skins/icons/substitution/';
$this->path = $this->app['root.path'] . '/www/skins/icons/substitution/';
$this->file = str_replace('+', '%20', $mime) . '.png';
$this->url = '/skins/icons/substitution/' . $this->file;
}
@@ -296,7 +296,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$this->is_physically_present = false;
if ( ! file_exists($this->path . $this->file)) {
$this->path = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/skins/icons/';
$this->path = $this->app['root.path'] . '/www/skins/icons/';
$this->file = 'substitution.png';
$this->url = '/skins/icons/' . $this->file;
}

View File

@@ -49,7 +49,7 @@ class module_console_sphinxGenerateSuggestion extends Command
)
));
$tmp_file = $this->container['phraseanet.registry']->get('GV_RootPath') . 'tmp/dict' . $index . '.txt';
$tmp_file = $this->container['root.path'] . '/tmp/dict' . $index . '.txt';
$databox = $this->getService('phraseanet.appbox')->get_databox($sbas_id);

View File

@@ -87,7 +87,7 @@ class patch_370a7 implements patchInterface
try {
foreach ($rs as $row) {
$filePath = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . $row['filepath'];
$filePath = $app['root.path'] . '/tmp/lazaret/' . $row['filepath'];
if (file_exists($filePath)) {
@@ -96,7 +96,7 @@ class patch_370a7 implements patchInterface
$spec->setResizeMode(ImageSpec::RESIZE_MODE_INBOUND_FIXEDRATIO);
$spec->setDimensions(375, 275);
$thumbPath = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . sprintf("thumb_%s", $row['filepath']);
$thumbPath = $app['root.path'] . '/tmp/lazaret/' . sprintf("thumb_%s", $row['filepath']);
try {
$app['media-alchemyst']

View File

@@ -102,7 +102,7 @@ class recordutils_image extends recordutils
$pathIn = $subdef->get_path() . $subdef->get_file();
$pathOut = $subdef->get_path() . 'stamp_' . $subdef->get_file();
$pathTmpStamp = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/' . time() . '-stamptmp_' . $subdef->get_file();
$pathTmpStamp = $app['root.path'] . '/tmp/' . time() . '-stamptmp_' . $subdef->get_file();
if ($xpprefs->query('/baseprefs/stamp')->length == 0) {
return $subdef->get_pathfile();
@@ -158,7 +158,7 @@ class recordutils_image extends recordutils
$text_xpos = 0;
$text_width = $image_width;
$logofile = $app['phraseanet.registry']->get('GV_RootPath') . 'config/stamp/' . $base_id;
$logofile = $app['root.path'] . '/config/stamp/' . $base_id;
$logopos = null;
$imlogo = null; // gd image
$logo_phywidth = $logo_phyheight = 0; // physical size
@@ -342,11 +342,11 @@ class recordutils_image extends recordutils
}
if ($app['phraseanet.registry']->get('composite_binary') &&
file_exists($app['phraseanet.registry']->get('GV_RootPath') . 'config/wm/' . $base_id)) {
file_exists($app['root.path'] . '/config/wm/' . $base_id)) {
$builder = ProcessBuilder::create(array(
$app['phraseanet.registry']->get('composite_binary'),
$app['phraseanet.registry']->get('GV_RootPath') . 'config/wm/' . $base_id,
$app['root.path'] . '/config/wm/' . $base_id,
$pathIn,
'-strip', '-watermark', '90%', '-gravity', 'center',
$pathOut

View File

@@ -46,7 +46,6 @@ class registry implements registryInterface
$this->app = $app;
$this->cache = new ArrayCache();
$this->cache->save('GV_RootPath', dirname(dirname(__DIR__)) . '/');
if ($app['phraseanet.configuration-tester']->isInstalled()) {
$this->cache->save('GV_ServerName', $app['phraseanet.configuration']['main']['servername']);
$this->cache->save('GV_debug', $app['debug']);

View File

@@ -640,7 +640,7 @@ class set_export extends set_abstract
$files[$id]["export_name"] = $tmp_name;
if (in_array('caption', $subdefs)) {
$caption_dir = $this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/desc_tmp/'
$caption_dir = $this->app['root.path'] . '/tmp/desc_tmp/'
. time() . $this->app['authentication']->getUser()->get_id() . '/';
$filesystem->mkdir($caption_dir, 0750);
@@ -662,7 +662,7 @@ class set_export extends set_abstract
}
if (in_array('caption-yaml', $subdefs)) {
$caption_dir = $this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/desc_tmp/'
$caption_dir = $this->app['root.path'] . '/tmp/desc_tmp/'
. time() . $this->app['authentication']->getUser()->get_id() . '/';
$filesystem->mkdir($caption_dir, 0750);
@@ -785,8 +785,8 @@ class set_export extends set_abstract
$file_xaccel = str_replace(
array(
$app['phraseanet.registry']->get('GV_X_Accel_Redirect'),
$app['phraseanet.registry']->get('GV_RootPath') . 'tmp/download/',
$app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/'
$app['root.path'] . '/tmp/download/',
$app['root.path'] . '/tmp/lazaret/'
)
, array(
'/' . $app['phraseanet.registry']->get('GV_X_Accel_Redirect_mount_point') . '/',

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);