diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php index 98f0fe13dc..ab345baa0c 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php @@ -946,7 +946,7 @@ class Databox implements ControllerProviderInterface $ret['xml_indexed'] = $datas['xml_indexed']; $ret['thesaurus_indexed'] = $datas['thesaurus_indexed']; - if ($app['filesystem']->exists($app['phraseanet.registry']->get('GV_RootPath') . 'config/minilogos/logopdf_' . $databox_id . '.jpg')) { + if ($app['filesystem']->exists($app['root.path'] . '/config/minilogos/logopdf_' . $databox_id . '.jpg')) { $ret['printLogoURL'] = '/custom/minilogos/logopdf_' . $databox_id . '.jpg'; } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php index 1c5de2ef0a..8fef608c36 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php @@ -181,7 +181,7 @@ class Databoxes implements ControllerProviderInterface $upgrader = new \Setup_Upgrade($app); return $app['twig']->render('admin/databases.html.twig', array( - 'files' => new \DirectoryIterator($app['phraseanet.registry']->get('GV_RootPath') . 'lib/conf.d/data_templates'), + 'files' => new \DirectoryIterator($app['root.path'] . '/lib/conf.d/data_templates'), 'sbas' => $sbas, 'error_msg' => $errorMsg, 'recommendations' => $upgrader->getRecommendations(), @@ -217,7 +217,7 @@ class Databoxes implements ControllerProviderInterface $user = $connexion['user']; $password = $connexion['password']; - $dataTemplate = new \SplFileInfo($app['phraseanet.registry']->get('GV_RootPath') . 'lib/conf.d/data_templates/' . $dataTemplate . '.xml'); + $dataTemplate = new \SplFileInfo($app['root.path'] . '/lib/conf.d/data_templates/' . $dataTemplate . '.xml'); try { $connbas = new \connection_pdo('databox_creation', $hostname, $port, $user, $password, $dbName, array(), $app['debug']); @@ -245,7 +245,7 @@ class Databoxes implements ControllerProviderInterface && (null !== $dataTemplate = $request->request->get('new_data_template'))) { try { - $data_template = new \SplFileInfo($app['phraseanet.registry']->get('GV_RootPath') . 'lib/conf.d/data_templates/' . $dataTemplate . '.xml'); + $data_template = new \SplFileInfo($app['root.path'] . '/lib/conf.d/data_templates/' . $dataTemplate . '.xml'); $connbas = new \connection_pdo('databox_creation', $hostname, $port, $userDb, $passwordDb, $dbName, array(), $app['debug']); try { $base = \databox::create($app, $connbas, $data_template, $app['phraseanet.registry']); diff --git a/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php b/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php index 59400b8202..815725be54 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php @@ -76,7 +76,7 @@ class TaskManager implements ControllerProviderInterface })->bind('admin_tasks_scheduler_stop'); $controllers->get('/scheduler/log', function(Application $app, Request $request) { - $logdir = \p4string::addEndSlash($app['phraseanet.registry']->get('GV_RootPath') . 'logs'); + $logdir = $app['root.path'] . '/logs/'; $rname = '/scheduler((\.log)|(-.*\.log))$/'; @@ -114,7 +114,7 @@ class TaskManager implements ControllerProviderInterface })->bind('admin_tasks_scheduler_log'); $controllers->get('/task/{id}/log', function(Application $app, Request $request, $id) { - $logdir = \p4string::addEndSlash($app['phraseanet.registry']->get('GV_RootPath') . 'logs'); + $logdir = $app['root.path'] . '/logs/'; $rname = '/task_' . $id . '((\.log)|(-.*\.log))$/'; diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Users.php b/lib/Alchemy/Phrasea/Controller/Admin/Users.php index d0e95cecd0..744a59ddea 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Users.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Users.php @@ -832,7 +832,7 @@ class Users implements ControllerProviderInterface $controllers->get('/import/example/csv/', function(Application $app, Request $request) { - $file = new \SplFileInfo($app['phraseanet.registry']->get('GV_RootPath') . 'lib/Fixtures/exampleImportUsers.csv'); + $file = new \SplFileInfo($app['root.path'] . '/lib/Fixtures/exampleImportUsers.csv'); if (!$file->isFile()) { $app->abort(400); @@ -851,7 +851,7 @@ class Users implements ControllerProviderInterface $controllers->get('/import/example/rtf/', function(Application $app, Request $request) { - $file = new \SplFileInfo($app['phraseanet.registry']->get('GV_RootPath') . 'lib/Fixtures/Fields.rtf'); + $file = new \SplFileInfo($app['root.path'] . '/lib/Fixtures/Fields.rtf'); if (!$file->isFile()) { $app->abort(400); diff --git a/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php b/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php index 4f2d913a2b..5b3cb5be25 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php +++ b/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php @@ -61,8 +61,8 @@ class Oauth2 implements ControllerProviderInterface $template = "api/auth/end_user_authorization.html.twig"; $custom_template = sprintf( - "%sconfig/templates/web/api/auth/end_user_authorization/%s.html.twig" - , $app['phraseanet.registry']->get('GV_RootPath') + "%s/config/templates/web/api/auth/end_user_authorization/%s.html.twig" + , $app['root.path'] , $client->get_id() ); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Export.php b/lib/Alchemy/Phrasea/Controller/Prod/Export.php index 088c064c6e..fc299acc9c 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Export.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Export.php @@ -275,7 +275,7 @@ class Export implements ControllerProviderInterface $app, $token, $list, - $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/download/' . $token . '.zip' + $app['root.path'] . '/tmp/download/' . $token . '.zip' ); $remaingEmails = $destMails; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php index cd3772d6b3..25ee33e071 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php @@ -218,7 +218,7 @@ class Lazaret implements ControllerProviderInterface 'base_id' => $lazaretFile->getBaseId(), 'created' => $lazaretFile->getCreated()->format(\DateTime::ATOM), 'updated' => $lazaretFile->getUpdated()->format(\DateTime::ATOM), - 'pathname' => $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . $lazaretFile->getFilename(), + 'pathname' => $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getFilename(), 'sha256' => $lazaretFile->getSha256(), 'uuid' => $lazaretFile->getUuid(), ); @@ -262,8 +262,8 @@ class Lazaret implements ControllerProviderInterface return $app->json($ret); } - $lazaretFileName = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . $lazaretFile->getFilename(); - $lazaretThumbFileName = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . $lazaretFile->getThumbFilename(); + $lazaretFileName = $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getFilename(); + $lazaretThumbFileName = $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getThumbFilename(); try { $borderFile = Border\File::buildFromPathfile( @@ -382,8 +382,8 @@ class Lazaret implements ControllerProviderInterface protected function denyLazaretFile(Application $app, LazaretFile $lazaretFile) { - $lazaretFileName = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . $lazaretFile->getFilename(); - $lazaretThumbFileName = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . $lazaretFile->getThumbFilename(); + $lazaretFileName = $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getFilename(); + $lazaretThumbFileName = $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getThumbFilename(); $app['EM']->remove($lazaretFile); $app['EM']->flush(); @@ -474,8 +474,8 @@ class Lazaret implements ControllerProviderInterface return $app->json($ret); } - $lazaretFileName = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . $lazaretFile->getFilename(); - $lazaretThumbFileName = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . $lazaretFile->getThumbFilename(); + $lazaretFileName = $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getFilename(); + $lazaretThumbFileName = $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getThumbFilename(); try { $media = $app['mediavorus']->guess($lazaretFileName); @@ -519,7 +519,7 @@ class Lazaret implements ControllerProviderInterface return new Response(null, 404); } - $lazaretThumbFileName = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . $lazaretFile->getThumbFilename(); + $lazaretThumbFileName = $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getThumbFilename(); return \set_export::stream_file( $app, $lazaretThumbFileName, $lazaretFile->getOriginalName(), 'image/jpeg', 'inline' diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Root.php b/lib/Alchemy/Phrasea/Controller/Prod/Root.php index c4a278907f..336830d138 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Root.php @@ -46,7 +46,7 @@ class Root implements ControllerProviderInterface return $app->redirectPath('logout'); } - $cssPath = $app['phraseanet.registry']->get('GV_RootPath') . 'www/skins/prod/'; + $cssPath = $app['root.path'] . '/www/skins/prod/'; $css = array(); $cssfile = false; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php index 87b58e51d9..873ded0ec5 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php @@ -242,7 +242,7 @@ class Tools implements ControllerProviderInterface $dataUri = DataURI\Parser::parse($request->request->get('image', '')); - $path = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp'; + $path = $app['root.path'] . '/tmp'; $name = sprintf('extractor_thumb_%s', $record->get_serialize_key()); diff --git a/lib/Alchemy/Phrasea/Controller/Root/Account.php b/lib/Alchemy/Phrasea/Controller/Root/Account.php index 39bb3c2cf3..6839330895 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Account.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Account.php @@ -238,7 +238,7 @@ class Account implements ControllerProviderInterface */ public function accountAccess(Application $app, Request $request) { - require_once $app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php'; + require_once $app['root.path'] . '/lib/classes/deprecated/inscript.api.php'; return $app['twig']->render('account/access.html.twig', array( 'inscriptions' => giveMeBases($app, $app['authentication']->getUser()->get_id()) diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php index 7c21d11a28..cb40dc6ff5 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Login.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php @@ -262,7 +262,7 @@ class Login implements ControllerProviderInterface throw new FormProcessingException(_('Invalid captcha answer.')); } - require_once($app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php'); + require_once $app['root.path'] . '/lib/classes/deprecated/inscript.api.php'; $selected = isset($data['collections']) ? $data['collections'] : null; $inscriptions = giveMeBases($app); @@ -684,7 +684,7 @@ class Login implements ControllerProviderInterface */ public function login(PhraseaApplication $app, Request $request) { - require_once($app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php'); + require_once $app['root.path'] . '/lib/classes/deprecated/inscript.api.php'; try { $app['phraseanet.appbox']->get_connection(); diff --git a/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php b/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php index 94b0bdd313..6bbb08053e 100644 --- a/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php +++ b/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php @@ -441,9 +441,9 @@ class Thesaurus implements ControllerProviderInterface } elseif ($request->get("ofm") == 'tofiles') { $fname = 'topics_' . $lng . '.xml'; - @rename($app['phraseanet.registry']->get('GV_RootPath') . 'config/topics/' . $fname, $app['phraseanet.registry']->get('GV_RootPath') . 'config/topics/topics_' . $lng . '_BKP_' . $now . '.xml'); + @rename($app['root.path'] . '/config/topics/' . $fname, $app['root.path'] . '/config/topics/topics_' . $lng . '_BKP_' . $now . '.xml'); - if ($dom->save($app['phraseanet.registry']->get('GV_RootPath') . 'config/topics/' . $fname)) { + if ($dom->save($app['root.path'] . '/config/topics/' . $fname)) { $lngs[$lng] = \p4string::MakeString(sprintf(_('thesaurus:: fichier genere : %s'), $fname)); } else { $lngs[$lng] = \p4string::MakeString(_('thesaurus:: erreur lors de l\'enregsitrement du fichier')); diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php index bd17b8201f..b7d17c8387 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php @@ -69,7 +69,7 @@ class PhraseaRegisterForm extends AbstractType $builder->add('provider-id', 'hidden'); - require_once($this->app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php'); + require_once $this->app['root.path'] . '/lib/classes/deprecated/inscript.api.php'; $choices = array(); $baseIds = array(); diff --git a/lib/Alchemy/Phrasea/Out/Module/PDF.php b/lib/Alchemy/Phrasea/Out/Module/PDF.php index 7e26613f23..0761623052 100644 --- a/lib/Alchemy/Phrasea/Out/Module/PDF.php +++ b/lib/Alchemy/Phrasea/Out/Module/PDF.php @@ -334,8 +334,7 @@ class PDF $RIGHT_TEXT = ""; $RIGHT_IMG = NULL; - $LEFT__IMG = $this->app['phraseanet.registry']->get('GV_RootPath') . "config/minilogos/logopdf_" - . $rec->get_sbas_id() . ""; + $LEFT__IMG = $this->app['root.path'] . "/config/minilogos/logopdf_" . $rec->get_sbas_id(); if (!is_file($LEFT__IMG)) { $databox = $rec->get_databox(); @@ -356,7 +355,7 @@ class PDF if ($vn == "" || $vn == "1") { $RIGHT_TEXT = \phrasea::bas_labels($rec->get_base_id(), $this->app); } elseif ($vn == "2") { - $RIGHT_IMG = $this->app['phraseanet.registry']->get('GV_RootPath') . "config/minilogos/" . $rec->get_base_id(); + $RIGHT_IMG = $this->app['root.path'] . "/config/minilogos/" . $rec->get_base_id(); } $xtmp = $this->pdf->GetX(); diff --git a/lib/classes/Feed/Adapter.php b/lib/classes/Feed/Adapter.php index 5a65261c4f..796f5d3089 100644 --- a/lib/classes/Feed/Adapter.php +++ b/lib/classes/Feed/Adapter.php @@ -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); diff --git a/lib/classes/appbox.php b/lib/classes/appbox.php index 6a01bd753e..6f94a6af4c 100644 --- a/lib/classes/appbox.php +++ b/lib/classes/appbox.php @@ -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); diff --git a/lib/classes/base.php b/lib/classes/base.php index 8b5f7b27d0..d1982bb4c7 100644 --- a/lib/classes/base.php +++ b/lib/classes/base.php @@ -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()) { diff --git a/lib/classes/collection.php b/lib/classes/collection.php index 0db1b9fdc1..f22d97259a 100644 --- a/lib/classes/collection.php +++ b/lib/classes/collection.php @@ -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] = '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); diff --git a/lib/classes/media/subdef.php b/lib/classes/media/subdef.php index 1aec2939fe..7792f028f8 100644 --- a/lib/classes/media/subdef.php +++ b/lib/classes/media/subdef.php @@ -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; } diff --git a/lib/classes/module/console/sphinxGenerateSuggestion.php b/lib/classes/module/console/sphinxGenerateSuggestion.php index bcba9388d2..86394eb07b 100644 --- a/lib/classes/module/console/sphinxGenerateSuggestion.php +++ b/lib/classes/module/console/sphinxGenerateSuggestion.php @@ -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); diff --git a/lib/classes/patch/370a7.php b/lib/classes/patch/370a7.php index 9b6b10fd25..4c24db0c5d 100644 --- a/lib/classes/patch/370a7.php +++ b/lib/classes/patch/370a7.php @@ -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'] diff --git a/lib/classes/recordutils/image.php b/lib/classes/recordutils/image.php index 2422255ce2..0aa650079b 100644 --- a/lib/classes/recordutils/image.php +++ b/lib/classes/recordutils/image.php @@ -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 diff --git a/lib/classes/registry.php b/lib/classes/registry.php index 2117fc2550..a946423cb0 100644 --- a/lib/classes/registry.php +++ b/lib/classes/registry.php @@ -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']); diff --git a/lib/classes/set/export.php b/lib/classes/set/export.php index 2cfbfc4eeb..a3c792239d 100644 --- a/lib/classes/set/export.php +++ b/lib/classes/set/export.php @@ -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') . '/', diff --git a/lib/classes/task/Scheduler.php b/lib/classes/task/Scheduler.php index 707c4c9b64..208ca08b54 100644 --- a/lib/classes/task/Scheduler.php +++ b/lib/classes/task/Scheduler.php @@ -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) ); diff --git a/lib/classes/task/abstract.php b/lib/classes/task/abstract.php index f5551f7466..66a060aa17 100644 --- a/lib/classes/task/abstract.php +++ b/lib/classes/task/abstract.php @@ -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; diff --git a/lib/classes/task/manager.php b/lib/classes/task/manager.php index 493d7a6d8c..d6fa19a298 100644 --- a/lib/classes/task/manager.php +++ b/lib/classes/task/manager.php @@ -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 ! diff --git a/lib/classes/task/period/archive.php b/lib/classes/task/period/archive.php index 7e97af8ada..b8b7c50f93 100644 --- a/lib/classes/task/period/archive.php +++ b/lib/classes/task/period/archive.php @@ -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()); } diff --git a/lib/classes/task/period/cindexer.php b/lib/classes/task/period/cindexer.php index b562e92e24..bb246322e7 100644 --- a/lib/classes/task/period/cindexer.php +++ b/lib/classes/task/period/cindexer.php @@ -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 diff --git a/lib/classes/task/period/ftp.php b/lib/classes/task/period/ftp.php index f89be9d870..c3491e0d76 100644 --- a/lib/classes/task/period/ftp.php +++ b/lib/classes/task/period/ftp.php @@ -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); diff --git a/templates/web/admin/setup.html.twig b/templates/web/admin/setup.html.twig index f0f902986c..3ac5606822 100644 --- a/templates/web/admin/setup.html.twig +++ b/templates/web/admin/setup.html.twig @@ -14,7 +14,7 @@
- +
diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/LazaretTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/LazaretTest.php index 806e52ef81..6c237ebbd1 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/LazaretTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/LazaretTest.php @@ -170,8 +170,8 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $lazaretFile = $this->getOneLazaretFile(); - $lazaretFileName = self::$DI['app']['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . $lazaretFile->getFilename(); - $lazaretThumbFileName = self::$DI['app']['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . $lazaretFile->getThumbFilename(); + $lazaretFileName = self::$DI['app']['root.path'] . '/tmp/lazaret/' . $lazaretFile->getFilename(); + $lazaretThumbFileName = self::$DI['app']['root.path'] . '/tmp/lazaret/' . $lazaretFile->getThumbFilename(); copy(__DIR__ . '/../../../../../files/cestlafete.jpg', $lazaretFileName); copy(__DIR__ . '/../../../../../files/cestlafete.jpg', $lazaretThumbFileName); diff --git a/tests/classes/PhraseanetWebTestCaseAuthenticatedAbstract.php b/tests/classes/PhraseanetWebTestCaseAuthenticatedAbstract.php index 9c795efce8..bbb9b4f70b 100644 --- a/tests/classes/PhraseanetWebTestCaseAuthenticatedAbstract.php +++ b/tests/classes/PhraseanetWebTestCaseAuthenticatedAbstract.php @@ -111,7 +111,7 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU } $databox = \databox::create( - self::$DI['app'], $conn, new \SplFileInfo(self::$DI['app']['phraseanet.registry']->get('GV_RootPath') . 'lib/conf.d/data_templates/fr-simple.xml'), self::$DI['app']['phraseanet.registry'] + self::$DI['app'], $conn, new \SplFileInfo(self::$DI['app']['root.path'] . '/lib/conf.d/data_templates/fr-simple.xml'), self::$DI['app']['phraseanet.registry'] ); self::$createdDataboxes[] = $databox;