]> source.dussan.org Git - nextcloud-server.git/commitdiff
Remove deprecated function OC_User::getManager
authorRoeland Jago Douma <rullzer@owncloud.com>
Thu, 17 Dec 2015 12:03:37 +0000 (13:03 +0100)
committerRoeland Jago Douma <rullzer@owncloud.com>
Thu, 17 Dec 2015 15:18:34 +0000 (16:18 +0100)
Private deprecated function => removed
Replaced all instances with suggested replacement

apps/files/appinfo/register_command.php
core/templates/internalmail.php
core/templates/mail.php
core/templates/untrustedDomain.php
lib/base.php
lib/private/user.php
lib/private/util.php
settings/templates/email.new_user.php
settings/users.php
tests/lib/group.php
tests/lib/user.php

index 3042c259872bf3d118222b15c01417f5724fdf7c..7e541ca26f227f18c8700ba6347ddde003cba092 100644 (file)
@@ -20,5 +20,5 @@
  *
  */
 
-$application->add(new OCA\Files\Command\Scan(OC_User::getManager()));
+$application->add(new OCA\Files\Command\Scan(\OC::$server->getUserManager()));
 $application->add(new OCA\Files\Command\DeleteOrphanedFiles(\OC::$server->getDatabaseConnection()));
index 0e73a6018571528b20930cab607a730e6c1d212a..c2d84184d383c3250effedfafb1a0c3bda4c13e8 100644 (file)
@@ -4,7 +4,7 @@
 <tr>
 <td bgcolor="<?php p($theme->getMailHeaderColor());?>" width="20px">&nbsp;</td>
 <td bgcolor="<?php p($theme->getMailHeaderColor());?>">
-<img src="<?php p(OC_Helper::makeURLAbsolute(image_path('', 'logo-mail.gif'))); ?>" alt="<?php p($theme->getName()); ?>"/>
+<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.gif'))); ?>" alt="<?php p($theme->getName()); ?>"/>
 </td>
 </tr>
 <tr><td colspan="2">&nbsp;</td></tr>
index 0e73a6018571528b20930cab607a730e6c1d212a..c2d84184d383c3250effedfafb1a0c3bda4c13e8 100644 (file)
@@ -4,7 +4,7 @@
 <tr>
 <td bgcolor="<?php p($theme->getMailHeaderColor());?>" width="20px">&nbsp;</td>
 <td bgcolor="<?php p($theme->getMailHeaderColor());?>">
-<img src="<?php p(OC_Helper::makeURLAbsolute(image_path('', 'logo-mail.gif'))); ?>" alt="<?php p($theme->getName()); ?>"/>
+<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.gif'))); ?>" alt="<?php p($theme->getName()); ?>"/>
 </td>
 </tr>
 <tr><td colspan="2">&nbsp;</td></tr>
index 361495636cd9a239c73d332b808b3009202136dd..46bad2168225fe237b32e857b116d7e254219586 100644 (file)
@@ -10,7 +10,7 @@
                        <?php p($l->t('Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain.')); ?>
                        <br><br>
                        <p style="text-align:center;">
-                               <a href="<?php print_unescaped(OC_Helper::makeURLAbsolute(\OCP\Util::linkToRoute('settings_admin'))); ?>?trustDomain=<?php p($_['domain']); ?>" class="button">
+                               <a href="<?php print_unescaped(\OC::$server->getURLGenerator()->getAbsoluteURL(\OCP\Util::linkToRoute('settings_admin'))); ?>?trustDomain=<?php p($_['domain']); ?>" class="button">
                                        <?php p($l->t('Add "%s" as trusted domain', array($_['domain']))); ?>
                                </a>
                        </p>
index 038c259ecf604a219115dbcd7fa127e286116923..8f1432d6fb929a060bfc88580b9318ca1eac36e1 100644 (file)
@@ -875,7 +875,7 @@ class OC {
 
                // Handle redirect URL for logged in users
                if (isset($_REQUEST['redirect_url']) && OC_User::isLoggedIn()) {
-                       $location = OC_Helper::makeURLAbsolute(urldecode($_REQUEST['redirect_url']));
+                       $location = \OC::$server->getURLGenerator()->getAbsoluteURL(urldecode($_REQUEST['redirect_url']));
 
                        // Deny the redirect if the URL contains a @
                        // This prevents unvalidated redirects like ?redirect_url=:user@domain.com
index 74441d9175a0bfebe4d1c867ba71383a2cf1b4f1..9094f388f9e9dfd5250c289dd53ddf69ed86aa95 100644 (file)
@@ -66,14 +66,6 @@ class OC_User {
                return OC::$server->getUserSession();
        }
 
-       /**
-        * @return \OC\User\Manager
-        * @deprecated Use \OC::$server->getUserManager()
-        */
-       public static function getManager() {
-               return OC::$server->getUserManager();
-       }
-
        private static $_backends = array();
 
        private static $_usedBackends = array();
@@ -132,7 +124,7 @@ class OC_User {
        public static function useBackend($backend = 'database') {
                if ($backend instanceof OC_User_Interface) {
                        self::$_usedBackends[get_class($backend)] = $backend;
-                       self::getManager()->registerBackend($backend);
+                       \OC::$server->getUserManager()->registerBackend($backend);
                } else {
                        // You'll never know what happens
                        if (null === $backend OR !is_string($backend)) {
@@ -146,17 +138,17 @@ class OC_User {
                                case 'sqlite':
                                        \OCP\Util::writeLog('core', 'Adding user backend ' . $backend . '.', \OCP\Util::DEBUG);
                                        self::$_usedBackends[$backend] = new OC_User_Database();
-                                       self::getManager()->registerBackend(self::$_usedBackends[$backend]);
+                                       \OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]);
                                        break;
                                case 'dummy':
                                        self::$_usedBackends[$backend] = new \Test\Util\User\Dummy();
-                                       self::getManager()->registerBackend(self::$_usedBackends[$backend]);
+                                       \OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]);
                                        break;
                                default:
                                        \OCP\Util::writeLog('core', 'Adding default user backend ' . $backend . '.', \OCP\Util::DEBUG);
                                        $className = 'OC_USER_' . strToUpper($backend);
                                        self::$_usedBackends[$backend] = new $className();
-                                       self::getManager()->registerBackend(self::$_usedBackends[$backend]);
+                                       \OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]);
                                        break;
                        }
                }
@@ -168,7 +160,7 @@ class OC_User {
         */
        public static function clearBackends() {
                self::$_usedBackends = array();
-               self::getManager()->clearBackends();
+               \OC::$server->getUserManager()->clearBackends();
        }
 
        /**
@@ -213,7 +205,7 @@ class OC_User {
         * @deprecated Use \OC::$server->getUserManager()->createUser($uid, $password)
         */
        public static function createUser($uid, $password) {
-               return self::getManager()->createUser($uid, $password);
+               return \OC::$server->getUserManager()->createUser($uid, $password);
        }
 
        /**
@@ -226,7 +218,7 @@ class OC_User {
         * @deprecated Use \OC::$server->getUserManager()->get() and then run delete() on the return
         */
        public static function deleteUser($uid) {
-               $user = self::getManager()->get($uid);
+               $user = \OC::$server->getUserManager()->get($uid);
                if ($user) {
                        return $user->delete();
                } else {
@@ -343,7 +335,7 @@ class OC_User {
                if (is_null($displayName)) {
                        $displayName = $uid;
                }
-               $user = self::getManager()->get($uid);
+               $user = \OC::$server->getUserManager()->get($uid);
                if ($user) {
                        return $user->setDisplayName($displayName);
                } else {
@@ -452,7 +444,7 @@ class OC_User {
         */
        public static function getDisplayName($uid = null) {
                if ($uid) {
-                       $user = self::getManager()->get($uid);
+                       $user = \OC::$server->getUserManager()->get($uid);
                        if ($user) {
                                return $user->getDisplayName();
                        } else {
@@ -490,7 +482,7 @@ class OC_User {
         * Change the password of a user
         */
        public static function setPassword($uid, $password, $recoveryPassword = null) {
-               $user = self::getManager()->get($uid);
+               $user = \OC::$server->getUserManager()->get($uid);
                if ($user) {
                        return $user->setPassword($password, $recoveryPassword);
                } else {
@@ -507,7 +499,7 @@ class OC_User {
         * Check whether a specified user can change his avatar
         */
        public static function canUserChangeAvatar($uid) {
-               $user = self::getManager()->get($uid);
+               $user = \OC::$server->getUserManager()->get($uid);
                if ($user) {
                        return $user->canChangeAvatar();
                } else {
@@ -524,7 +516,7 @@ class OC_User {
         * Check whether a specified user can change his password
         */
        public static function canUserChangePassword($uid) {
-               $user = self::getManager()->get($uid);
+               $user = \OC::$server->getUserManager()->get($uid);
                if ($user) {
                        return $user->canChangePassword();
                } else {
@@ -541,7 +533,7 @@ class OC_User {
         * Check whether a specified user can change his display name
         */
        public static function canUserChangeDisplayName($uid) {
-               $user = self::getManager()->get($uid);
+               $user = \OC::$server->getUserManager()->get($uid);
                if ($user) {
                        return $user->canChangeDisplayName();
                } else {
@@ -560,7 +552,7 @@ class OC_User {
         * returns the user id or false
         */
        public static function checkPassword($uid, $password) {
-               $manager = self::getManager();
+               $manager = \OC::$server->getUserManager();
                $username = $manager->checkPassword($uid, $password);
                if ($username !== false) {
                        return $username->getUID();
@@ -576,7 +568,7 @@ class OC_User {
         * @deprecated Use \OC::$server->getUserManager->getHome()
         */
        public static function getHome($uid) {
-               $user = self::getManager()->get($uid);
+               $user = \OC::$server->getUserManager()->get($uid);
                if ($user) {
                        return $user->getHome();
                } else {
@@ -595,7 +587,7 @@ class OC_User {
         * @param integer $offset
         */
        public static function getUsers($search = '', $limit = null, $offset = null) {
-               $users = self::getManager()->search($search, $limit, $offset);
+               $users = \OC::$server->getUserManager()->search($search, $limit, $offset);
                $uids = array();
                foreach ($users as $user) {
                        $uids[] = $user->getUID();
@@ -616,7 +608,7 @@ class OC_User {
         */
        public static function getDisplayNames($search = '', $limit = null, $offset = null) {
                $displayNames = array();
-               $users = self::getManager()->searchDisplayName($search, $limit, $offset);
+               $users = \OC::$server->getUserManager()->searchDisplayName($search, $limit, $offset);
                foreach ($users as $user) {
                        $displayNames[$user->getUID()] = $user->getDisplayName();
                }
@@ -630,7 +622,7 @@ class OC_User {
         * @return boolean
         */
        public static function userExists($uid) {
-               return self::getManager()->userExists($uid);
+               return \OC::$server->getUserManager()->userExists($uid);
        }
 
        /**
@@ -639,7 +631,7 @@ class OC_User {
         * @param string $uid the user to disable
         */
        public static function disableUser($uid) {
-               $user = self::getManager()->get($uid);
+               $user = \OC::$server->getUserManager()->get($uid);
                if ($user) {
                        $user->setEnabled(false);
                }
@@ -651,7 +643,7 @@ class OC_User {
         * @param string $uid
         */
        public static function enableUser($uid) {
-               $user = self::getManager()->get($uid);
+               $user = \OC::$server->getUserManager()->get($uid);
                if ($user) {
                        $user->setEnabled(true);
                }
@@ -664,7 +656,7 @@ class OC_User {
         * @return bool
         */
        public static function isEnabled($uid) {
-               $user = self::getManager()->get($uid);
+               $user = \OC::$server->getUserManager()->get($uid);
                if ($user) {
                        return $user->isEnabled();
                } else {
index 578001988d4a05fd881208ab4e4acd1014d17fa5..c63befb3f32d090a7b0a5bf83c44c2e31df9ab77 100644 (file)
@@ -1250,7 +1250,7 @@ class OC_Util {
                fclose($fp);
 
                // accessing the file via http
-               $url = OC_Helper::makeURLAbsolute(OC::$WEBROOT . '/data' . $fileName);
+               $url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT . '/data' . $fileName);
                try {
                        $content = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody();
                } catch (\Exception $e) {
index 74149632cb81741fb6c31f65afa42be617ddbc2f..8b13ac753eb796c18386afae12da69076459e584 100644 (file)
@@ -4,7 +4,7 @@
                                <tr>
                                        <td bgcolor="<?php p($theme->getMailHeaderColor());?>" width="20px">&nbsp;</td>
                                        <td bgcolor="<?php p($theme->getMailHeaderColor());?>">
-                                               <img src="<?php p(OC_Helper::makeURLAbsolute(image_path('', 'logo-mail.gif'))); ?>" alt="<?php p($theme->getName()); ?>"/>
+                                               <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.gif'))); ?>" alt="<?php p($theme->getName()); ?>"/>
                                        </td>
                                </tr>
                                <tr><td colspan="2">&nbsp;</td></tr>
index ccf1bcd9e1a8ca1f08d71154b100798a9fbd58ba..0e9823e73e3e5944a3df2cdedd23922ce96ef9dd 100644 (file)
@@ -37,7 +37,7 @@ OC_Util::checkSubAdminUser();
 
 \OC::$server->getNavigationManager()->setActiveEntry('core_users');
 
-$userManager = \OC_User::getManager();
+$userManager = \OC::$server->getUserManager();
 $groupManager = \OC_Group::getManager();
 
 // Set the sort option: SORT_USERCOUNT or SORT_GROUPNAME
index 066dddc738e00571f20b07ed5558c4f20167dcb5..4bb888ed7255f2c60600e51bb0eacf0ea0128a61 100644 (file)
@@ -31,7 +31,7 @@ class Test_Group extends \Test\TestCase {
 
        public function testSingleBackend() {
                $userBackend = new \Test\Util\User\Dummy();
-               \OC_User::getManager()->registerBackend($userBackend);
+               \OC::$server->getUserManager()->registerBackend($userBackend);
                OC_Group::useBackend(new OC_Group_Dummy());
 
                $group1 = $this->getUniqueID();
@@ -113,7 +113,7 @@ class Test_Group extends \Test\TestCase {
        public function testUsersInGroup() {
                OC_Group::useBackend(new OC_Group_Dummy());
                $userBackend = new \Test\Util\User\Dummy();
-               \OC_User::getManager()->registerBackend($userBackend);
+               \OC::$server->getUserManager()->registerBackend($userBackend);
 
                $group1 = $this->getUniqueID();
                $group2 = $this->getUniqueID();
@@ -142,7 +142,7 @@ class Test_Group extends \Test\TestCase {
 
        public function testMultiBackend() {
                $userBackend = new \Test\Util\User\Dummy();
-               \OC_User::getManager()->registerBackend($userBackend);
+               \OC::$server->getUserManager()->registerBackend($userBackend);
                $backend1 = new OC_Group_Dummy();
                $backend2 = new OC_Group_Dummy();
                OC_Group::useBackend($backend1);
index bc1ba063c8febd1f7751e4ddf66c4b7881c4311b..5e9a38a43c0d2f4195ce280212662ce59f96b43e 100644 (file)
@@ -26,7 +26,7 @@ class User extends TestCase {
                parent::setUp();
 
                $this->backend = $this->getMock('\Test\Util\User\Dummy');
-               $manager = \OC_User::getManager();
+               $manager = \OC::$server->getUserManager();
                $manager->registerBackend($this->backend);
        }