Merge "Fix regular expression"
[lhc/web/wiklou.git] / includes / libs / rdbms / database / DatabasePostgres.php
index e1cd764..5f04e39 100644 (file)
@@ -670,9 +670,8 @@ __INDEXATTR__;
         * @param array $insertOptions
         * @param array $selectOptions
         * @param array $selectJoinConds
-        * @return bool
         */
-       public function nativeInsertSelect(
+       protected function nativeInsertSelect(
                $destTable, $srcTable, $varMap, $conds, $fname = __METHOD__,
                $insertOptions = [], $selectOptions = [], $selectJoinConds = []
        ) {
@@ -697,18 +696,18 @@ __INDEXATTR__;
                                $sql = "INSERT INTO $destTable (" . implode( ',', array_keys( $varMap ) ) . ') ' .
                                        $selectSql . ' ON CONFLICT DO NOTHING';
 
-                               return $this->query( $sql, $fname );
+                               $this->query( $sql, $fname );
                        } else {
                                // IGNORE and we don't have ON CONFLICT DO NOTHING, so just use the non-native version
-                               return $this->nonNativeInsertSelect(
+                               $this->nonNativeInsertSelect(
                                        $destTable, $srcTable, $varMap, $conds, $fname,
                                        $insertOptions, $selectOptions, $selectJoinConds
                                );
                        }
+               } else {
+                       parent::nativeInsertSelect( $destTable, $srcTable, $varMap, $conds, $fname,
+                               $insertOptions, $selectOptions, $selectJoinConds );
                }
-
-               return parent::nativeInsertSelect( $destTable, $srcTable, $varMap, $conds, $fname,
-                       $insertOptions, $selectOptions, $selectJoinConds );
        }
 
        public function tableName( $name, $format = 'quoted' ) {
@@ -917,22 +916,22 @@ __INDEXATTR__;
         * @return string[]
         */
        private function pg_array_parse( $text, &$output, $limit = false, $offset = 1 ) {
-               if ( false === $limit ) {
+               if ( $limit === false ) {
                        $limit = strlen( $text ) - 1;
                        $output = [];
                }
-               if ( '{}' == $text ) {
+               if ( $text == '{}' ) {
                        return $output;
                }
                do {
-                       if ( '{' != $text[$offset] ) {
+                       if ( $text[$offset] != '{' ) {
                                preg_match( "/(\\{?\"([^\"\\\\]|\\\\.)*\"|[^,{}]+)+([,}]+)/",
                                        $text, $match, 0, $offset );
                                $offset += strlen( $match[0] );
-                               $output[] = ( '"' != $match[1][0]
+                               $output[] = ( $match[1][0] != '"'
                                        ? $match[1]
                                        : stripcslashes( substr( $match[1], 1, -1 ) ) );
-                               if ( '},' == $match[3] ) {
+                               if ( $match[3] == '},' ) {
                                        return $output;
                                }
                        } else {