From 9e464aea259eaa75c3e1de81ae1e6e89d96d8f03 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Fri, 28 Sep 2012 13:47:51 +0200 Subject: [PATCH] Update appbox --- .../Phrasea/Controller/Setup/Installer.php | 4 +++- lib/classes/appbox.class.php | 22 ++++--------------- lib/classes/patch/370a7.class.php | 2 +- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Setup/Installer.php b/lib/Alchemy/Phrasea/Controller/Setup/Installer.php index 9bab4ff8b0..9e6e48f31f 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup/Installer.php +++ b/lib/Alchemy/Phrasea/Controller/Setup/Installer.php @@ -180,9 +180,11 @@ class Installer implements ControllerProviderInterface \setup::rollback($conn, $connbas); + $app['phraseanet.registry'] = $setupRegistry; + try { - $appbox = \appbox::create($app, $setupRegistry, $conn, $appbox_name, $app['phraseanet.appbox'], true); + $appbox = \appbox::create($app, $conn, $appbox_name, $app['phraseanet.appbox'], true); $configuration = Configuration::build(); diff --git a/lib/classes/appbox.class.php b/lib/classes/appbox.class.php index baec1bc6e0..39520c4bb4 100644 --- a/lib/classes/appbox.class.php +++ b/lib/classes/appbox.class.php @@ -55,26 +55,12 @@ class appbox extends base const CACHE_LIST_BASES = 'list_bases'; const CACHE_SBAS_IDS = 'sbas_ids'; - /** - * Singleton pattern - * - * @return appbox - */ - public static function get_instance(Application $app, registryInterface $registry = null) - { - if (!self::$_instance instanceof self) { - self::$_instance = new static($app, $registry); - } - - return self::$_instance; - } - /** * Constructor * * @return appbox */ - public function __construct(Application $app, registryInterface $registry = null) + public function __construct(Application $app) { $this->app = $app; $this->connection = connection::getPDOConnection($app, null, $app['phraseanet.registry']); @@ -465,7 +451,7 @@ class appbox extends base * @param type $write_file * @return type */ - public static function create(Application $app, registryInterface $registry, connection_interface $conn, $dbname, Version $version, $write_file = false) + public static function create(Application $app, connection_interface $conn, $dbname, Version $version, $write_file = false) { $credentials = $conn->get_credentials(); @@ -487,7 +473,7 @@ class appbox extends base $connexionINI['driver'] = 'pdo_mysql'; $connexionINI['charset'] = 'UTF8'; - $serverName = $registry->get('GV_ServerName'); + $serverName = $app['phraseanet.registry']->get('GV_ServerName'); $root = __DIR__ . '/../../'; @@ -550,7 +536,7 @@ class appbox extends base } try { - $appbox = static::get_instance($app, $registry); + $appbox = new self($app); $appbox->insert_datas($version); } catch (Exception $e) { throw new Exception('Error while installing ' . $e->getMessage()); diff --git a/lib/classes/patch/370a7.class.php b/lib/classes/patch/370a7.class.php index 65276e1e91..d05419bc10 100644 --- a/lib/classes/patch/370a7.class.php +++ b/lib/classes/patch/370a7.class.php @@ -95,7 +95,7 @@ class patch_370a7 implements patchInterface $spec->setResizeMode(ImageSpec::RESIZE_MODE_INBOUND_FIXEDRATIO); $spec->setDimensions(375, 275); - $thumbPath = $app['phraseanet.registry']->getRegistry()->get('GV_RootPath') . 'tmp/lazaret/' . sprintf("thumb_%s", $row['filepath']); + $thumbPath = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/lazaret/' . sprintf("thumb_%s", $row['filepath']); try { $app['media-alchemyst']