]> git.mxchange.org Git - friendica.git/commitdiff
Move Model\Profile::getMyUrl to UserSessions
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 30 Oct 2022 01:33:15 +0000 (21:33 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 30 Oct 2022 14:49:47 +0000 (10:49 -0400)
src/Core/Session/Capability/IHandleUserSessions.php
src/Core/Session/Model/UserSession.php
src/Model/Profile.php

index 307b694923af2e834c8ded59e74b3bdd8bf22062..e65749c8dfcc746a8c58333e9cbb58f63e117d55 100644 (file)
@@ -65,6 +65,13 @@ interface IHandleUserSessions extends IHandleSessions
         */
        public function getUserIDForVisitorContactID(int $cid): int;
 
+       /**
+        * Returns the account URL of the currently logged in user
+        *
+        * @return string
+        */
+       public function getMyUrl(): string;
+
        /**
         * Returns if the current visitor is authenticated
         *
index 79f5b2aaefb5c94cdf5860269a057f721b2592e6..959ca1af2d405c4d8bb5654eb2e764d38011e029 100644 (file)
@@ -110,6 +110,12 @@ class UserSession implements IHandleUserSessions
                return array_search($cid, $this->session->get('remote'));
        }
 
+       /** {@inheritDoc} */
+       public function getMyUrl(): string
+       {
+               return $this->session->get('my_url', '');
+       }
+
        /** {@inheritDoc} */
        public function isAuthenticated(): bool
        {
index 96932cdb0475b20b1242491c667a5c8b7168ed16..2129e92bd10d5172e4793a6cb0a0c5734eec2d93 100644 (file)
@@ -679,10 +679,11 @@ class Profile
         * Retrieves the my_url session variable
         *
         * @return string
+        * @deprecated since version 2022.12, please use UserSession->getMyUrl instead
         */
        public static function getMyURL(): string
        {
-               return DI::session()->get('my_url') ?? '';
+               return DI::userSession()->getMyUrl();
        }
 
        /**