db: Use variable functions/callbacks instead of call_user_func()
authorDerick Alangi <alangiderick@gmail.com>
Sun, 24 Mar 2019 23:14:49 +0000 (00:14 +0100)
committerDerick Alangi <alangiderick@gmail.com>
Sun, 24 Mar 2019 23:17:22 +0000 (00:17 +0100)
Performance-wise, this gives a little boost in performance and also
it's more readable I think. But I could be wrong so please someone
let me know.

See: https://www.php.net/manual/en/function.call-user-func.php

Change-Id: I2f0a00408c29549a786b56792411f88998a5f003

includes/db/DatabaseOracle.php

index 16bde4b..cfc9e29 100644 (file)
@@ -969,7 +969,7 @@ class DatabaseOracle extends Database {
                // Defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}';
                while ( !feof( $fp ) ) {
                        if ( $lineCallback ) {
-                               call_user_func( $lineCallback );
+                               $lineCallback();
                        }
                        $line = trim( fgets( $fp, 1024 ) );
                        $sl = strlen( $line ) - 1;
@@ -1015,7 +1015,7 @@ class DatabaseOracle extends Database {
 
                                        $cmd = $this->replaceVars( $cmd );
                                        if ( $inputCallback ) {
-                                               call_user_func( $inputCallback, $cmd );
+                                               $inputCallback( $cmd );
                                        }
                                        $res = $this->doQuery( $cmd );
                                        if ( $resultCallback ) {