[BUGFIX] Add missing method getPidOfUid to RecyclerUtility 95/46795/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sun, 21 Feb 2016 12:40:54 +0000 (13:40 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Mon, 22 Feb 2016 15:07:14 +0000 (16:07 +0100)
The backport of #70863 requires the method ``RecyclerUtility:: getPidOfUid()``
introduced with an earlier feature for TYPO3 v8 is missed for the released
7.6 branch. This patch backports the method to TYPO3 CMS 7.6.

Change-Id: I393b663633b680ee8ab5cbfd705c098ebbfa550c
Resolves: #73553
Related: #70863
Releases: 7.6
Reviewed-on: https://review.typo3.org/46795
Reviewed-by: Stephan GroƟberndt <stephan@grossberndt.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/recycler/Classes/Utility/RecyclerUtility.php

index 50cb352..a71b28f 100644 (file)
@@ -133,6 +133,24 @@ class RecyclerUtility
     }
 
     /**
+     * Get pid of uid
+     *
+     * @param int $uid
+     * @param string $table
+     * @return int
+     */
+    public static function getPidOfUid($uid, $table)
+    {
+        $db = static::getDatabaseConnection();
+        $res = $db->exec_SELECTquery('pid', $table, 'uid=' . (int)$uid);
+        if ($res !== false) {
+            $record = $db->sql_fetch_assoc($res);
+            return $record['pid'];
+        }
+        return 0;
+    }
+
+    /**
      * Gets the TCA of the table used in the current context.
      *
      * @param string $tableName Name of the table to get TCA for