]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/GServer.php
Update src/Model/Photo.php
[friendica.git] / src / Model / GServer.php
index 86893529177b1e078fb113889684e4c9d270059b..30a1acc02a3df74ff97d290b31dd6eeb4ef63a41 100644 (file)
@@ -1744,7 +1744,7 @@ class GServer
         * @return void 
         * @throws Exception 
         */
-       static function setProtocol(int $gsid, int $protocol)
+       public static function setProtocol(int $gsid, int $protocol)
        {
                if (empty($gsid)) {
                        return;
@@ -1793,7 +1793,28 @@ class GServer
                        }
                }
 
-               Logger::info('Protocol for server', ['protocol' => $protocol, 'old' => $old, 'id' => $gsid, 'url' => $gserver['url']]);
+               Logger::info('Protocol for server', ['protocol' => $protocol, 'old' => $old, 'id' => $gsid, 'url' => $gserver['url'], 'callstack' => System::callstack(20)]);
                DBA::update('gserver', ['protocol' => $protocol], ['id' => $gsid]);
        }
+
+       /**
+        * Fetch the protocol of the given server
+        *
+        * @param int $gsid Server id
+        * @return int 
+        * @throws Exception 
+        */
+       public static function getProtocol(int $gsid)
+       {
+               if (empty($gsid)) {
+                       return null;
+               }
+
+               $gserver = DBA::selectFirst('gserver', ['protocol'], ['id' => $gsid]);
+               if (DBA::isResult($gserver)) {
+                       return $gserver['protocol'];
+               }
+
+               return null;
+       }
 }