]> source.dussan.org Git - nextcloud-server.git/commitdiff
Reduce call of legacy wrapper by call the OCP directly
authorMorris Jobke <hey@morrisjobke.de>
Sat, 18 Apr 2015 22:29:09 +0000 (00:29 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Sat, 18 Apr 2015 22:29:09 +0000 (00:29 +0200)
* ref #15734
* reduces the call depth, because the private methods just call OCP stuff

lib/public/db.php
lib/public/files.php
lib/public/util.php

index c188352d77bc203c7254eca0f2d0073427fcf187..6e6c5222ec4666a2707c0b53f709a984714d0cf0 100644 (file)
@@ -85,7 +85,7 @@ class DB {
         * @since 4.5.0
         */
        public static function insertid($table=null) {
-               return(\OC_DB::insertid($table));
+               return \OC::$server->getDatabaseConnection()->lastInsertId($table);
        }
 
        /**
@@ -93,7 +93,7 @@ class DB {
         * @since 4.5.0
         */
        public static function beginTransaction() {
-               \OC_DB::beginTransaction();
+               \OC::$server->getDatabaseConnection()->beginTransaction();
        }
 
        /**
@@ -101,7 +101,7 @@ class DB {
         * @since 4.5.0
         */
        public static function commit() {
-               \OC_DB::commit();
+               \OC::$server->getDatabaseConnection()->commit();
        }
 
        /**
@@ -109,7 +109,7 @@ class DB {
         * @since 8.0.0
         */
        public static function rollback() {
-               \OC_DB::rollback();
+               \OC::$server->getDatabaseConnection()->rollback();
        }
 
        /**
@@ -119,7 +119,8 @@ class DB {
         * @since 4.5.0
         */
        public static function isError($result) {
-               return(\OC_DB::isError($result));
+               // Doctrine returns false on error (and throws an exception)
+               return $result === false;
        }
 
        /**
@@ -129,7 +130,7 @@ class DB {
         * @since 6.0.0
         */
        public static function getErrorMessage() {
-               return(\OC_DB::getErrorMessage());
+               return \OC::$server->getDatabaseConnection()->getError();
        }
 
 }
index 57747a4c354d4808a381f0cbc882f3d20c7dce74..157d4a0a1ee13fb2d42d5cfce8fd14ef60002cc7 100644 (file)
@@ -94,7 +94,7 @@ class Files {
         * @since 5.0.0
         */
        public static function tmpFile( $postfix='' ) {
-               return(\OC_Helper::tmpFile( $postfix ));
+               return \OC::$server->getTempManager()->getTemporaryFile($postfix);
        }
 
        /**
@@ -105,7 +105,7 @@ class Files {
         * @since 5.0.0
         */
        public static function tmpFolder() {
-               return(\OC_Helper::tmpFolder());
+               return \OC::$server->getTempManager()->getTemporaryFolder();
        }
 
        /**
index bc7f1b1f443846f2f5d4eedfd2e20bf18e56306f..130cacd726483b7fe2911d7041b5be605f94ca44 100644 (file)
@@ -395,7 +395,7 @@ class Util {
         * @since 4.0.0
         */
        public static function imagePath( $app, $image ) {
-               return(\OC_Helper::imagePath( $app, $image ));
+               return \OC::$server->getURLGenerator()->imagePath($app, $image);
        }
 
        /**