From 804a9137cf115b82e3e8688b6c68cad4e1329991 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Wed, 19 May 2010 13:20:30 -0400 Subject: [PATCH] Use injector for Horde_Share objects --- ansel/lib/Storage.php | 4 +- fima/lib/base.php | 2 +- folks/lib/Driver.php | 2 +- folks/lib/Friends/shared.php | 10 +-- folks/perms.php | 2 +- framework/Core/lib/Horde/Core/Binder/Share.php | 18 ++++ framework/Core/lib/Horde/Core/Factory/Share.php | 98 ++++++++++++++++++++++ framework/Core/lib/Horde/Registry.php | 1 + framework/Core/package.xml | 4 + framework/Group/Group/contactlists.php | 2 +- .../test/Horde/Kolab/Storage/Scenario.php | 2 +- framework/Prefs/lib/Horde/Prefs/KolabImap.php | 2 +- horde/lib/Api.php | 66 +++++++-------- horde/services/shares/edit.php | 2 +- ingo/lib/Application.php | 2 +- kronolith/lib/Application.php | 2 +- kronolith/perms.php | 2 +- mnemo/lib/Block/summary.php | 2 +- mnemo/lib/Mnemo.php | 2 +- nag/lib/Application.php | 2 +- nag/lib/Block/summary.php | 2 +- skoli/lib/base.php | 2 +- turba/lib/Application.php | 2 +- turba/lib/tests/KolabTestBase.php | 2 +- turba/scripts/import_squirrelmail_sql_abook.php | 2 +- whups/lib/Query.php | 2 +- 26 files changed, 179 insertions(+), 60 deletions(-) create mode 100644 framework/Core/lib/Horde/Core/Binder/Share.php create mode 100644 framework/Core/lib/Horde/Core/Factory/Share.php diff --git a/ansel/lib/Storage.php b/ansel/lib/Storage.php index 5afd1d7e4..d4355c14a 100644 --- a/ansel/lib/Storage.php +++ b/ansel/lib/Storage.php @@ -62,9 +62,7 @@ class Ansel_Storage } /* This is the only supported share backend for Ansel */ - $this->_shares = Horde_Share::singleton($this->_scope, - 'sql_hierarchical'); - + $this->_shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($this->_scope, 'Sql_Hierarchical'); /* Ansel_Gallery is just a subclass of Horde_Share_Object */ $this->_shares->setShareClass('Ansel_Gallery'); diff --git a/fima/lib/base.php b/fima/lib/base.php index 73ab3c530..f3ab5227f 100644 --- a/fima/lib/base.php +++ b/fima/lib/base.php @@ -48,6 +48,6 @@ Horde::compressOutput(); Horde_Nls::setTimeZone(); // Create a share instance. -$GLOBALS['fima_shares'] = Horde_Share::singleton($registry->getApp()); +$GLOBALS['fima_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); Fima::initialize(); diff --git a/folks/lib/Driver.php b/folks/lib/Driver.php index dd036587f..babe102b2 100644 --- a/folks/lib/Driver.php +++ b/folks/lib/Driver.php @@ -488,7 +488,7 @@ class Folks_Driver { // Delete groups if ($GLOBALS['conf']['friends']) { - $shares = Horde_Share::singleton('folks'); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $groups = $shares->listShares(Horde_Auth::getAuth(), Horde_Perms::SHOW, true); foreach ($groups as $share) { $result = $shares->removeShare($share); diff --git a/folks/lib/Friends/shared.php b/folks/lib/Friends/shared.php index 6947472e5..a85388715 100644 --- a/folks/lib/Friends/shared.php +++ b/folks/lib/Friends/shared.php @@ -42,7 +42,7 @@ class Folks_Friends_shared extends Folks_Friends_sql { */ public function getGroupOwner($group) { - $GLOBALS['folks_shares'] = Horde_Share::singleton('folks'); + $GLOBALS['folks_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $share = $GLOBALS['folks_shares']->getShareById($group); if ($share instanceof PEAR_Error) { @@ -57,7 +57,7 @@ class Folks_Friends_shared extends Folks_Friends_sql { */ protected function _getGroups() { - $GLOBALS['folks_shares'] = Horde_Share::singleton('folks'); + $GLOBALS['folks_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $groups = $GLOBALS['folks_shares']->listShares($this->_user, Horde_Perms::READ); if ($groups instanceof PEAR_Error) { @@ -83,7 +83,7 @@ class Folks_Friends_shared extends Folks_Friends_sql { return PEAR::raiseError(_("A group names cannot be empty")); } - $GLOBALS['folks_shares'] = Horde_Share::singleton('folks'); + $GLOBALS['folks_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $share = $GLOBALS['folks_shares']->getShareById($group); if ($share instanceof PEAR_Error) { @@ -115,7 +115,7 @@ class Folks_Friends_shared extends Folks_Friends_sql { */ public function removeGroup($group) { - $GLOBALS['folks_shares'] = Horde_Share::singleton('folks'); + $GLOBALS['folks_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $share = $GLOBALS['folks_shares']->getShareById($group); if ($share instanceof PEAR_Error) { @@ -165,7 +165,7 @@ class Folks_Friends_shared extends Folks_Friends_sql { return PEAR::raiseError(sprintf(_("You already have a group named \"%s\"."), $name)); } - $GLOBALS['folks_shares'] = Horde_Share::singleton('folks'); + $GLOBALS['folks_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $share = $GLOBALS['folks_shares']->newShare(hash('md5', microtime())); if ($share instanceof PEAR_Error) { diff --git a/folks/perms.php b/folks/perms.php index ef0046ecb..0d0e1b141 100644 --- a/folks/perms.php +++ b/folks/perms.php @@ -12,7 +12,7 @@ require_once dirname(__FILE__) . '/lib/base.php'; require_once 'Horde/Group.php'; -$shares = &Horde_Share::singleton('folks'); +$shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $groups = &Group::singleton(); $auth = Horde_Auth::singleton($conf['auth']['driver']); diff --git a/framework/Core/lib/Horde/Core/Binder/Share.php b/framework/Core/lib/Horde/Core/Binder/Share.php new file mode 100644 index 000000000..1a990460e --- /dev/null +++ b/framework/Core/lib/Horde/Core/Binder/Share.php @@ -0,0 +1,18 @@ + + */ + +/** + * A Horde_Injector:: based Horde_Identity:: factory. + * + * Copyright 2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. + * + * @category Horde + * @package Core + * @author Michael J. Rubinsky + */ +class Horde_Core_Factory_Share +{ + /** + * Instances. + * + * @var array + */ + private $_instances = array(); + + /** + * The injector. + * + * @var Horde_Injector + */ + private $_injector; + + /** + * Constructor. + * + * @param Horde_Injector $injector The injector to use. + */ + public function __construct(Horde_Injector $injector) + { + $this->_injector = $injector; + } + + /** + * Return the Horde_Share:: instance. + * + * @param string $app The application scope to use, if not the current + * app. + * @param string $driver The share driver. Either empty (use default + * driver from $conf) or a driver name. + * + * @return Horde_Share The Horde_Share instance. + * @throws Horde_Exception + */ + public function getScope($app = null, $driver = null) + { + if (empty($driver)) { + $driver = $GLOBALS['conf']['share']['driver']; + } + if (empty($app)) { + $app = $this->_injector->getInstance('Horde_Registry')->getApp(); + } + + $class = 'Horde_Share_' . ucfirst(basename($driver)); + $signature = $app . '_' . $driver; + if (!isset($this->_instances[$signature]) && + !empty($GLOBALS['conf']['share']['cache'])) { + + $session = new Horde_SessionObjects(); + $shares[$signature] = $session->query('horde_share_' . $app . '_' . $driver . '1'); + } + + if (empty($shares[$signature])) { + if (!class_exists($class)) { + throw new Horde_Exception((sprintf(_("\"%s\" share driver not found."), $driver))); + } + + $shares[$signature] = new $class($app); + } + + if (!isset($shares[$signature]) && + !empty($GLOBALS['conf']['share']['cache'])) { + $session = new Horde_SessionObjects(); + $shares[$signature] = $session->query('horde_share_' . $app . '_' . $driver . '1'); + } + + if (!empty($GLOBALS['conf']['share']['cache'])) { + register_shutdown_function(array($shares[$signature], 'shutdown')); + } + + return $shares[$signature]; + } + +} diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 77aa287ad..d0ae79ec7 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -248,6 +248,7 @@ class Horde_Registry 'Horde_Prefs_Identity' => new Horde_Core_Binder_Identity(), // 'Horde_Registry' - initialized below 'Horde_Secret' => new Horde_Core_Binder_Secret(), + 'Horde_Share' => new Horde_Core_Binder_Share(), 'Horde_SessionHandler' => new Horde_Core_Binder_SessionHandler(), 'Horde_Template' => new Horde_Core_Binder_Template(), 'Horde_Token' => new Horde_Core_Binder_Token(), diff --git a/framework/Core/package.xml b/framework/Core/package.xml index 17cb7c8a9..1e2550173 100644 --- a/framework/Core/package.xml +++ b/framework/Core/package.xml @@ -89,6 +89,7 @@ Application Framework. + @@ -99,6 +100,7 @@ Application Framework. + @@ -262,6 +264,7 @@ Application Framework. + @@ -270,6 +273,7 @@ Application Framework. + diff --git a/framework/Group/Group/contactlists.php b/framework/Group/Group/contactlists.php index 9ddcbcc62..52ea400d1 100644 --- a/framework/Group/Group/contactlists.php +++ b/framework/Group/Group/contactlists.php @@ -337,7 +337,7 @@ class Group_contactlists extends Group { if ($source['use_shares']) { if (empty($contact_shares)) { $scope = $GLOBALS['registry']->hasInterface('contacts'); - $shares = Horde_Share::singleton($scope); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); $this->_contact_shares = $shares->listShares(Horde_Auth::getAuth(), Horde_Perms::SHOW, Horde_Auth::getAuth()); } // Contruct a list of owner ids to use diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Scenario.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Scenario.php index 3a74ac208..84c99f39d 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Scenario.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Scenario.php @@ -88,7 +88,7 @@ class Horde_Kolab_Storage_Scenario extends Horde_Kolab_Server_Integration_Scenar $folder->setACL($arguments[0], 'alrid'); break; case 'retrieving the list of shares for the application': - $shares = Horde_Share::singleton($arguments[0], 'kolab'); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($arguments[0], 'kolab'); $world['list'] = $shares->listShares(Auth::getAuth()); break; diff --git a/framework/Prefs/lib/Horde/Prefs/KolabImap.php b/framework/Prefs/lib/Horde/Prefs/KolabImap.php index 1013d4513..4a98d45d2 100644 --- a/framework/Prefs/lib/Horde/Prefs/KolabImap.php +++ b/framework/Prefs/lib/Horde/Prefs/KolabImap.php @@ -38,7 +38,7 @@ class Horde_Prefs_KolabImap extends Horde_Prefs return; } - $shares = Horde_Share::singleton('h-prefs'); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope('h-prefs'); $default = $shares->getDefaultShare(); if ($default instanceof PEAR_Error) { Horde::logMessage($default, 'ERR'); diff --git a/horde/lib/Api.php b/horde/lib/Api.php index b9f3d9637..5b047628b 100644 --- a/horde/lib/Api.php +++ b/horde/lib/Api.php @@ -500,19 +500,19 @@ class Horde_Api extends Horde_Registry_Api /** * Adds a share to the shares system. * - * @param string $shareRoot The name of the share root, e.g. the + * @param string $scope The name of the share root, e.g. the * application that the share belongs to. * @param string $shareName The share's name. * @param string $shareTitle The share's human readable title. * @param string $userName The share's owner. */ - public function addShare($shareRoot, $shareName, $shareTitle, $userName) + public function addShare($scope, $shareName, $shareTitle, $userName) { if (!Horde_Auth::isAdmin()) { return PEAR::raiseError(_("You are not allowed to add shares.")); } - $shares = Horde_Share::singleton($shareRoot); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); if (is_a($share = &$shares->newShare($shareName), 'PEAR_Error')) { return $share; @@ -530,17 +530,17 @@ class Horde_Api extends Horde_Registry_Api /** * Removes a share from the shares system permanently. * - * @param string $shareRoot The name of the share root, e.g. the + * @param string $scope The name of the share root, e.g. the * application that the share belongs to. * @param string $shareName The share's name. */ - public function removeShare($shareRoot, $shareName) + public function removeShare($scope, $shareName) { if (!Horde_Auth::isAdmin()) { return PEAR::raiseError(_("You are not allowed to delete shares.")); } - $shares = Horde_Share::singleton($shareRoot); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) { return $share; @@ -556,19 +556,19 @@ class Horde_Api extends Horde_Registry_Api /** * Returns an array of all shares that $userName is the owner of. * - * @param string $shareRoot The name of the share root, e.g. the + * @param string $scope The name of the share root, e.g. the * application that the share belongs to. * @param string $userName The share's owner. * * @return array The list of shares. */ - public function listSharesOfOwner($shareRoot, $userName) + public function listSharesOfOwner($scope, $userName) { if (!Horde_Auth::isAdmin()) { return PEAR::raiseError(_("You are not allowed to list shares.")); } - $shares = Horde_Share::singleton($shareRoot); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); $share_list = &$shares->listShares($userName, Horde_Perms::SHOW, $userName); $myshares = array(); @@ -582,20 +582,20 @@ class Horde_Api extends Horde_Registry_Api /** * Gives a user certain privileges for a share. * - * @param string $shareRoot The name of the share root, e.g. the + * @param string $scope The name of the share root, e.g. the * application that the share belongs to. * @param string $shareName The share's name. * @param string $userName The user's name. * @param array $permissions A list of permissions (show, read, edit, delete). */ - public function addUserPermissions($shareRoot, $shareName, $userName, + public function addUserPermissions($scope, $shareName, $userName, $permissions) { if (!Horde_Auth::isAdmin()) { return PEAR::raiseError(_("You are not allowed to change shares.")); } - $shares = Horde_Share::singleton($shareRoot); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) { return $share; @@ -619,13 +619,13 @@ class Horde_Api extends Horde_Registry_Api /** * Gives a group certain privileges for a share. * - * @param string $shareRoot The name of the share root, e.g. the + * @param string $scope The name of the share root, e.g. the * application that the share belongs to. * @param string $shareName The share's name. * @param string $groupName The group's name. * @param array $permissions A list of permissions (show, read, edit, delete). */ - public function addGroupPermissions($shareRoot, $shareName, $groupName, + public function addGroupPermissions($scope, $shareName, $groupName, $permissions) { if (!Horde_Auth::isAdmin()) { @@ -633,7 +633,7 @@ class Horde_Api extends Horde_Registry_Api } require_once 'Horde/Group.php'; - $shares = Horde_Share::singleton($shareRoot); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); $groups = Group::singleton(); if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) { @@ -661,18 +661,18 @@ class Horde_Api extends Horde_Registry_Api /** * Removes a user from a share. * - * @param string $shareRoot The name of the share root, e.g. the + * @param string $scope The name of the share root, e.g. the * application that the share belongs to. * @param string $shareName The share's name. * @param string $userName The user's name. */ - public function removeUserPermissions($shareRoot, $shareName, $userName) + public function removeUserPermissions($scope, $shareName, $userName) { if (!Horde_Auth::isAdmin()) { return PEAR::raiseError(_("You are not allowed to change shares.")); } - $shares = Horde_Share::singleton($shareRoot); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) { return $share; @@ -688,19 +688,19 @@ class Horde_Api extends Horde_Registry_Api /** * Removes a group from a share. * - * @param string $shareRoot The name of the share root, e.g. the + * @param string $scope The name of the share root, e.g. the * application that the share belongs to. * @param string $shareName The share's name. * @param string $groupName The group's name. */ - public function removeGroupPermissions($shareRoot, $shareName, $groupName) + public function removeGroupPermissions($scope, $shareName, $groupName) { if (!Horde_Auth::isAdmin()) { return PEAR::raiseError(_("You are not allowed to change shares.")); } require_once 'Horde/Group.php'; - $shares = Horde_Share::singleton($shareRoot); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); $groups = Group::singleton(); if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) { @@ -720,14 +720,14 @@ class Horde_Api extends Horde_Registry_Api /** * Returns an array of all user permissions on a share. * - * @param string $shareRoot The name of the share root, e.g. the + * @param string $scope The name of the share root, e.g. the * application that the share belongs to. * @param string $shareName The share's name. * @param string $userName The user's name. * * @return array All user permissions for this share. */ - public function listUserPermissions($shareRoot, $shareName, $userName) + public function listUserPermissions($scope, $shareName, $userName) { if (!Horde_Auth::isAdmin()) { return PEAR::raiseError(_("You are not allowed to list share permissions.")); @@ -738,7 +738,7 @@ class Horde_Api extends Horde_Registry_Api Horde_Perms::EDIT => 'edit', Horde_Perms::DELETE => 'delete'); - $shares = Horde_Share::singleton($shareRoot); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) { return $share; @@ -761,14 +761,14 @@ class Horde_Api extends Horde_Registry_Api /** * Returns an array of all group permissions on a share. * - * @param string $shareRoot The name of the share root, e.g. the + * @param string $scope The name of the share root, e.g. the * application that the share belongs to. * @param string $shareName The share's name. * @param string $groupName The group's name. * * @return array All group permissions for this share. */ - public function listGroupPermissions($shareRoot, $shareName, $groupName) + public function listGroupPermissions($scope, $shareName, $groupName) { if (!Horde_Auth::isAdmin()) { return PEAR::raiseError(_("You are not allowed to list share permissions.")); @@ -779,7 +779,7 @@ class Horde_Api extends Horde_Registry_Api Horde_Perms::EDIT => 'edit', Horde_Perms::DELETE => 'delete'); - $shares = Horde_Share::singleton($shareRoot); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) { return $share; @@ -802,20 +802,20 @@ class Horde_Api extends Horde_Registry_Api /** * Returns a list of users which have have certain permissions on a share. * - * @param string $shareRoot The name of the share root, e.g. the + * @param string $scope The name of the share root, e.g. the * application that the share belongs to. * @param string $shareName The share's name. * @param array $permissions A list of permissions (show, read, edit, delete). * * @return array List of users with the specified permissions. */ - public function listUsersOfShare($shareRoot, $shareName, $permissions) + public function listUsersOfShare($scope, $shareName, $permissions) { if (!Horde_Auth::isAdmin()) { return PEAR::raiseError(_("You are not allowed to list users of shares.")); } - $shares = Horde_Share::singleton($shareRoot); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) { return $share; @@ -835,20 +835,20 @@ class Horde_Api extends Horde_Registry_Api /** * Returns a list of groups which have have certain permissions on a share. * - * @param string $shareRoot The name of the share root, e.g. the + * @param string $scope The name of the share root, e.g. the * application that the share belongs to. * @param string $shareName The share's name. * @param array $permissions A list of permissions (show, read, edit, delete). * * @return array List of groups with the specified permissions. */ - public function listGroupsOfShare($shareRoot, $shareName, $permissions) + public function listGroupsOfShare($scope, $shareName, $permissions) { if (!Horde_Auth::isAdmin()) { return PEAR::raiseError(_("You are not allowed to list groups of shares.")); } - $shares = Horde_Share::singleton($shareRoot); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($scope); if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) { return $share; diff --git a/horde/services/shares/edit.php b/horde/services/shares/edit.php index 903463e91..a5b9e04ec 100644 --- a/horde/services/shares/edit.php +++ b/horde/services/shares/edit.php @@ -26,7 +26,7 @@ $fieldsList = array( ); $app = Horde_Util::getFormData('app'); -$shares = Horde_Share::singleton($app); +$shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope($app); $groups = Group::singleton(); $auth = Horde_Auth::singleton($conf['auth']['driver']); if ($registry->hasMethod('shareHelp', $app)) { diff --git a/ingo/lib/Application.php b/ingo/lib/Application.php index 01d640c66..332489310 100644 --- a/ingo/lib/Application.php +++ b/ingo/lib/Application.php @@ -64,7 +64,7 @@ class Ingo_Application extends Horde_Registry_Application // Create shares if necessary. $driver = Ingo::getDriver(); if ($driver->supportShares()) { - $GLOBALS['ingo_shares'] = Horde_Share::singleton($registry->getApp()); + $GLOBALS['ingo_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $GLOBALS['all_rulesets'] = Ingo::listRulesets(); /* If personal share doesn't exist then create it. */ diff --git a/kronolith/lib/Application.php b/kronolith/lib/Application.php index 2eec8bca0..523efaeb2 100644 --- a/kronolith/lib/Application.php +++ b/kronolith/lib/Application.php @@ -68,7 +68,7 @@ class Kronolith_Application extends Horde_Registry_Application Horde_Nls::setTimeZone(); /* Create a share instance. */ - $GLOBALS['kronolith_shares'] = Horde_Share::singleton($GLOBALS['registry']->getApp()); + $GLOBALS['kronolith_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); Kronolith::initialize(); } diff --git a/kronolith/perms.php b/kronolith/perms.php index 62d994bde..f571fd869 100644 --- a/kronolith/perms.php +++ b/kronolith/perms.php @@ -19,7 +19,7 @@ if (!empty($conf['share']['no_sharing'])) { throw new Horde_Exception('Permission denied.'); } -$shares = Horde_Share::singleton('kronolith'); +$shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $groups = Group::singleton(); $auth = Horde_Auth::singleton($conf['auth']['driver']); diff --git a/mnemo/lib/Block/summary.php b/mnemo/lib/Block/summary.php index 1a09ba683..5d46cb23f 100644 --- a/mnemo/lib/Block/summary.php +++ b/mnemo/lib/Block/summary.php @@ -57,7 +57,7 @@ class Horde_Block_Mnemo_summary extends Horde_Block { $fgcolors = $cManager->fgColors(); if (!empty($this->_params['show_notepad'])) { - $shares = &Horde_Share::singleton('mnemo'); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); } $html = ''; diff --git a/mnemo/lib/Mnemo.php b/mnemo/lib/Mnemo.php index c2b3c7780..760aa8308 100644 --- a/mnemo/lib/Mnemo.php +++ b/mnemo/lib/Mnemo.php @@ -401,7 +401,7 @@ class Mnemo { */ public static function initialize() { - $GLOBALS['mnemo_shares'] = Horde_Share::singleton($GLOBALS['injector']->getInstance('Horde_Registry')->getApp()); + $GLOBALS['mnemo_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); // Update the preference for which notepads to display. If the // user doesn't have any selected notepads for view then fall diff --git a/nag/lib/Application.php b/nag/lib/Application.php index 0205bfbb1..657a287ed 100644 --- a/nag/lib/Application.php +++ b/nag/lib/Application.php @@ -51,7 +51,7 @@ class Nag_Application extends Horde_Registry_Application Horde_Nls::setTimeZone(); // Create a share instance. - $GLOBALS['nag_shares'] = Horde_Share::singleton($GLOBALS['registry']->getApp()); + $GLOBALS['nag_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); Nag::initialize(); } diff --git a/nag/lib/Block/summary.php b/nag/lib/Block/summary.php index 42b52af28..9dace3aa7 100644 --- a/nag/lib/Block/summary.php +++ b/nag/lib/Block/summary.php @@ -202,7 +202,7 @@ class Horde_Block_nag_summary extends Horde_Block { if (!empty($this->_params['show_tasklist'])) { $owner = $task->tasklist; - $shares = &Horde_Share::singleton($registry->getApp()); + $shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $share = $shares->getShare($owner); if (!is_a($share, 'PEAR_Error')) { $owner = $share->get('name'); diff --git a/skoli/lib/base.php b/skoli/lib/base.php index 54260656f..a04f8aacd 100644 --- a/skoli/lib/base.php +++ b/skoli/lib/base.php @@ -32,6 +32,6 @@ $conf = &$GLOBALS['conf']; Horde::compressOutput(); // Create a share instance. -$GLOBALS['skoli_shares'] = Horde_Share::singleton($registry->getApp()); +$GLOBALS['skoli_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); Skoli::initialize(); diff --git a/turba/lib/Application.php b/turba/lib/Application.php index da6ddb575..ed34da516 100644 --- a/turba/lib/Application.php +++ b/turba/lib/Application.php @@ -69,7 +69,7 @@ class Turba_Application extends Horde_Registry_Application if (!empty($cfg['use_shares'])) { // Create a share instance. $_SESSION['turba']['has_share'] = true; - $GLOBALS['turba_shares'] = Horde_Share::singleton('turba'); + $GLOBALS['turba_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $cfgSources = Turba::getConfigFromShares($cfgSources); break; } diff --git a/turba/lib/tests/KolabTestBase.php b/turba/lib/tests/KolabTestBase.php index 5675602cb..226131551 100644 --- a/turba/lib/tests/KolabTestBase.php +++ b/turba/lib/tests/KolabTestBase.php @@ -156,7 +156,7 @@ class Turba_KolabTestBase extends Horde_Kolab_Test_Storage $this->prepareNewFolder($world['storage'], 'test2', 'contact'); $_SESSION['turba']['has_share'] = true; - $GLOBALS['turba_shares'] = &Horde_Share::singleton('turba'); + $GLOBALS['turba_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $GLOBALS['cfgSources'] = Turba::getConfigFromShares($cfgSources); } diff --git a/turba/scripts/import_squirrelmail_sql_abook.php b/turba/scripts/import_squirrelmail_sql_abook.php index 77e1ac08a..ec4afa16d 100755 --- a/turba/scripts/import_squirrelmail_sql_abook.php +++ b/turba/scripts/import_squirrelmail_sql_abook.php @@ -40,7 +40,7 @@ $handle = $db->query('SELECT owner, nickname, firstname, lastname, email, label if (is_a($handle, 'PEAR_Error')) { $cli->fatal($handle->toString()); } -$turba_shares = Horde_Share::singleton('turba'); +$turba_shares = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); $user = null; $count = 0; while ($row = $handle->fetchRow(DB_FETCHMODE_ASSOC)) { diff --git a/whups/lib/Query.php b/whups/lib/Query.php index 07c503a0b..c1c563c5d 100644 --- a/whups/lib/Query.php +++ b/whups/lib/Query.php @@ -876,7 +876,7 @@ class Whups_QueryManager { */ function Whups_QueryManager() { - $this->_shareManager = &Horde_Share::singleton('whups'); + $this->_shareManager = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); } /** -- 2.11.0