]> git.mxchange.org Git - friendica.git/commitdiff
Fix errors in Database namespace
authorArt4 <art4@wlabs.de>
Tue, 3 Dec 2024 20:36:29 +0000 (20:36 +0000)
committerArt4 <art4@wlabs.de>
Tue, 3 Dec 2024 20:36:29 +0000 (20:36 +0000)
src/Database/DBA.php
src/Database/Database.php
src/Model/Attach.php
src/Model/Photo.php
src/Model/Post.php
src/Model/Post/Content.php
src/Model/Post/Origin.php
src/Model/Post/Thread.php
src/Model/Post/ThreadUser.php
src/Model/Post/User.php
src/Model/Post/UserNotification.php

index a357bd11d753a758b5e94a8d2b8d1b496562be7d..c001384f995f8e636cb0b47478ebabb14f357547 100644 (file)
@@ -233,7 +233,7 @@ class DBA
        /**
         * Returns the number of columns of a statement
         *
-        * @param object Statement object
+        * @param object $stmt Statement object
         * @return int Number of columns
         */
        public static function columnCount($stmt): int
@@ -243,7 +243,7 @@ class DBA
        /**
         * Returns the number of rows of a statement
         *
-        * @param PDOStatement|mysqli_result|mysqli_stmt Statement object
+        * @param PDOStatement|mysqli_result|mysqli_stmt $stmt Statement object
         * @return int Number of rows
         */
        public static function numRows($stmt): int
@@ -364,9 +364,9 @@ class DBA
         * @return boolean was the delete successful?
         * @throws \Exception
         */
-       public static function delete(string $table, array $conditions, array $options = []): bool
+       public static function delete(string $table, array $conditions): bool
        {
-               return DI::dba()->delete($table, $conditions, $options);
+               return DI::dba()->delete($table, $conditions);
        }
 
        /**
@@ -756,7 +756,7 @@ class DBA
        /**
         * Returns the error number of the last query
         *
-        * @return string Error number (0 if no error)
+        * @return int Error number (0 if no error)
         */
        public static function errorNo(): int
        {
@@ -813,8 +813,8 @@ class DBA
        /**
         * Acquire a lock to prevent a table optimization
         *
-        * @return bool 
-        * @throws LockPersistenceException 
+        * @return bool
+        * @throws LockPersistenceException
         */
        public static function acquireOptimizeLock(): bool
        {
@@ -823,8 +823,8 @@ class DBA
 
        /**
         * Release the table optimization lock
-        * @return bool 
-        * @throws LockPersistenceException 
+        * @return bool
+        * @throws LockPersistenceException
         */
        public static function releaseOptimizeLock(): bool
        {
index 15bb84765aa42b48ee09583201b444fcfefc423b..6ee4394901b039ccb54026a65ed6a14a597ef14f 100644 (file)
@@ -552,8 +552,10 @@ class Database
                                        break;
                                }
 
-                               /** @var $stmt mysqli_stmt|PDOStatement */
-                               if (!$stmt = $this->connection->prepare($sql)) {
+                               /** @var mysqli_stmt|PDOStatement $stmt */
+                               $stmt = $this->connection->prepare($sql);
+
+                               if (!$stmt) {
                                        $errorInfo     = $this->connection->errorInfo();
                                        $this->error   = (string)$errorInfo[2];
                                        $this->errorno = (int)$errorInfo[1];
@@ -889,7 +891,7 @@ class Database
        /**
         * Returns the number of columns of a statement
         *
-        * @param object Statement object
+        * @param object $stmt Statement object
         *
         * @return int Number of columns
         */
@@ -910,7 +912,7 @@ class Database
        /**
         * Returns the number of rows of a statement
         *
-        * @param PDOStatement|mysqli_result|mysqli_stmt Statement object
+        * @param PDOStatement|mysqli_result|mysqli_stmt $stmt Statement object
         *
         * @return int Number of rows
         */
@@ -1652,7 +1654,7 @@ class Database
        /**
         * Returns the error number of the last query
         *
-        * @return string Error number (0 if no error)
+        * @return int Error number (0 if no error)
         */
        public function errorNo(): int
        {
index bd5bd940d05621a492d9bb78b78edb76f9480d80..bd78fcd80ec36b51e766a1f44cbe550b39784dd2 100644 (file)
@@ -299,7 +299,7 @@ class Attach
         * @throws \Exception
         * @see   \Friendica\Database\DBA::delete
         */
-       public static function delete(array $conditions, array $options = []): bool
+       public static function delete(array $conditions): bool
        {
                // get items to delete data info
                $items = self::selectToArray(['backend-class', 'backend-ref'], $conditions);
@@ -315,7 +315,7 @@ class Attach
                        }
                }
 
-               return DBA::delete('attach', $conditions, $options);
+               return DBA::delete('attach', $conditions);
        }
 
        public static function setPermissionFromBody(array $post)
index e2d38241d88abbcd97e9f0027b36db876b9830f7..126edd379cef2bde39f71e5047fd3d383d026023 100644 (file)
@@ -496,7 +496,7 @@ class Photo
         * @throws \Exception
         * @see   \Friendica\Database\DBA::delete
         */
-       public static function delete(array $conditions, array $options = []): bool
+       public static function delete(array $conditions): bool
        {
                // get photo to delete data info
                $photos = DBA::select('photo', ['id', 'backend-class', 'backend-ref'], $conditions);
@@ -516,7 +516,7 @@ class Photo
 
                DBA::close($photos);
 
-               return DBA::delete('photo', $conditions, $options);
+               return DBA::delete('photo', $conditions);
        }
 
        /**
index 3439ce48467d4da09e049f319da6ab814a5d5b5c..111cd77cc45260c7b108e09023e6591afc8b9ec1 100644 (file)
@@ -774,8 +774,8 @@ class Post
         * @return boolean was the delete successful?
         * @throws \Exception
         */
-       public static function delete(array $conditions, array $options = []): bool
+       public static function delete(array $conditions): bool
        {
-               return DBA::delete('post', $conditions, $options);
+               return DBA::delete('post', $conditions);
        }
 }
index dcb7b9be7e41dacfdd8a2a6d78c194724fbff6e6..e0a037ad9df735fbef068d3a5a3c3f73e45f4809 100644 (file)
@@ -69,16 +69,13 @@ class Content
         * Delete a row from the post-content table
         *
         * @param array        $conditions Field condition(s)
-        * @param array        $options
-        *                           - cascade: If true we delete records in other tables that depend on the one we're deleting through
-        *                           relations (default: true)
         *
         * @return boolean was the delete successful?
         * @throws \Exception
         */
-       public static function delete(array $conditions, array $options = [])
+       public static function delete(array $conditions)
        {
-               return DBA::delete('post-content', $conditions, $options);
+               return DBA::delete('post-content', $conditions);
        }
 
 
index dafe52be6f66987374186cc542c4f93998c19d52..b3451fee8ef85a5fc873bc6766aead34f62e3604 100644 (file)
@@ -65,15 +65,12 @@ class Origin
         * Delete a row from the post-origin table
         *
         * @param array        $conditions Field condition(s)
-        * @param array        $options
-        *                           - cascade: If true we delete records in other tables that depend on the one we're deleting through
-        *                           relations (default: true)
         *
         * @return boolean was the delete successful?
         * @throws \Exception
         */
-       public static function delete(array $conditions, array $options = [])
+       public static function delete(array $conditions)
        {
-               return DBA::delete('post-origin', $conditions, $options);
+               return DBA::delete('post-origin', $conditions);
        }
 }
index fc714a5a76c01b4077fcabacd60184a3010f55e7..b7f51f920a1f97934de6fc80abd733031b39160a 100644 (file)
@@ -68,15 +68,12 @@ class Thread
         * Delete a row from the post-thread table
         *
         * @param array        $conditions Field condition(s)
-        * @param array        $options
-        *                           - cascade: If true we delete records in other tables that depend on the one we're deleting through
-        *                           relations (default: true)
         *
         * @return boolean was the delete successful?
         * @throws \Exception
         */
-       public static function delete(array $conditions, array $options = [])
+       public static function delete(array $conditions)
        {
-               return DBA::delete('post-thread', $conditions, $options);
+               return DBA::delete('post-thread', $conditions);
        }
 }
index 6e06879cd80408f44c35d1cd4a261e349d119da3..8a5baf51fffe5aba9b5f1de38afdde39d27d4cc7 100644 (file)
@@ -79,9 +79,9 @@ class ThreadUser
         * @return boolean was the delete successful?
         * @throws \Exception
         */
-       public static function delete(array $conditions, array $options = [])
+       public static function delete(array $conditions)
        {
-               return DBA::delete('post-thread-user', $conditions, $options);
+               return DBA::delete('post-thread-user', $conditions);
        }
 
        /**
index c1a74427cc622fc4c02075b120268544966683e9..ec7f6b2c0f9853e8c727503a6eb54ac6a5689bda 100644 (file)
@@ -109,15 +109,12 @@ class User
         * Delete a row from the post-user table
         *
         * @param array        $conditions Field condition(s)
-        * @param array        $options
-        *                           - cascade: If true we delete records in other tables that depend on the one we're deleting through
-        *                           relations (default: true)
         *
         * @return boolean was the delete successful?
         * @throws \Exception
         */
-       public static function delete(array $conditions, array $options = [])
+       public static function delete(array $conditions)
        {
-               return DBA::delete('post-user', $conditions, $options);
+               return DBA::delete('post-user', $conditions);
        }
 }
index f20d947c074a2c845c959f74941052c91b511e06..35c3d7891c06e68fcff521aa5058874fbccc145b 100644 (file)
@@ -95,15 +95,13 @@ class UserNotification
         * Delete a row from the post-user-notification table
         *
         * @param array $conditions  Field condition(s)
-        * @param array $options     - cascade: If true we delete records in other tables that depend on the one we're deleting through
-        *                           relations (default: true)
         *
         * @return boolean was the deletion successful?
         * @throws Exception
         */
-       public static function delete(array $conditions, array $options = []): bool
+       public static function delete(array $conditions): bool
        {
-               return DBA::delete('post-user-notification', $conditions, $options);
+               return DBA::delete('post-user-notification', $conditions);
        }
 
        /**