SearchResult: clean up construction
authorChad Horohoe <chadh@wikimedia.org>
Fri, 12 Sep 2014 19:37:35 +0000 (12:37 -0700)
committerChad Horohoe <chadh@wikimedia.org>
Fri, 12 Sep 2014 19:39:44 +0000 (12:39 -0700)
- Remove old pre-1.17 constructor format. No core or extension callers
- Remove only usage of newFromRow(), needless abstraction

Change-Id: Ifad161aa36837bb4c8b5c9aecac1c46e2e6cc84c

includes/search/SearchResult.php
includes/search/SearchResultSet.php

index c6d5d4f..aeaba8d 100644 (file)
@@ -61,35 +61,6 @@ class SearchResult {
                return $result;
        }
 
-       /**
-        * Return a new SearchResult and initializes it with a row.
-        *
-        * @param object $row
-        * @return SearchResult
-        */
-       public static function newFromRow( $row ) {
-               $result = new self();
-               $result->initFromRow( $row );
-               return $result;
-       }
-
-       public function __construct( $row = null ) {
-               if ( !is_null( $row ) ) {
-                       // Backwards compatibility with pre-1.17 callers
-                       $this->initFromRow( $row );
-               }
-       }
-
-       /**
-        * Initialize from a database row. Makes a Title and passes that to
-        * initFromTitle.
-        *
-        * @param object $row
-        */
-       protected function initFromRow( $row ) {
-               $this->initFromTitle( Title::makeTitle( $row->page_namespace, $row->page_title ) );
-       }
-
        /**
         * Initialize from a Title and if possible initializes a corresponding
         * Revision and File.
index 698f93c..406d322 100644 (file)
@@ -161,7 +161,9 @@ class SqlSearchResultSet extends SearchResultSet {
                        return false;
                }
 
-               return SearchResult::newFromRow( $row );
+               return SearchResult::newFromTitle(
+                       Title::makeTitle( $row->page_namespace, $row->page_title )
+               );
        }
 
        function free() {