Mark escapeLike deprecated, since it is broken
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Thu, 29 Jul 2010 18:37:45 +0000 (18:37 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Thu, 29 Jul 2010 18:37:45 +0000 (18:37 +0000)
includes/db/Database.php

index 6c065b8..e5ae109 100644 (file)
@@ -1507,8 +1507,14 @@ abstract class DatabaseBase {
         * Escape string for safe LIKE usage.
         * WARNING: you should almost never use this function directly,
         * instead use buildLike() that escapes everything automatically
+        * Deprecated in 1.17, warnings in 1.17, removed in ???
         */
-       function escapeLike( $s ) {
+       public function escapeLike( $s ) {
+               wfDeprecated( __METHOD__ );
+               return $this->escapeLikeInternal( $s );
+       }
+
+       protected function escapeLikeInternal( $s ) {
                $s = str_replace( '\\', '\\\\', $s );
                $s = $this->strencode( $s );
                $s = str_replace( array( '%', '_' ), array( '\%', '\_' ), $s );
@@ -1524,7 +1530,7 @@ abstract class DatabaseBase {
         * for subpages of 'My page title'.
         * Alternatively: $pattern = array( 'My_page_title/', $dbr->anyString() ); $query .= $dbr->buildLike( $pattern );
         *
-        * @ return String: fully built LIKE statement
+        * @return String: fully built LIKE statement
         */
        function buildLike() {
                $params = func_get_args();
@@ -1537,7 +1543,7 @@ abstract class DatabaseBase {
                        if( $value instanceof LikeMatch ) {
                                $s .= $value->toString();
                        } else {
-                               $s .= $this->escapeLike( $value );
+                               $s .= $this->escapeLikeInternal( $value );
                        }
                }
                return " LIKE '" . $s . "' ";