Drop archive.ar_text and ar_flags
[lhc/web/wiklou.git] / includes / page / PageArchive.php
index 05247ca..8b42020 100644 (file)
@@ -315,19 +315,13 @@ class PageArchive {
        }
 
        /**
-        * Get the text from an archive row containing ar_text, ar_flags and ar_text_id
+        * Get the text from an archive row containing ar_text_id
         *
+        * @deprecated since 1.31
         * @param object $row Database row
         * @return string
         */
        public function getTextFromRow( $row ) {
-               if ( is_null( $row->ar_text_id ) ) {
-                       // An old row from MediaWiki 1.4 or previous.
-                       // Text is embedded in this row in classic compression format.
-                       return Revision::getRevisionText( $row, 'ar_' );
-               }
-
-               // New-style: keyed to the text storage backend.
                $dbr = wfGetDB( DB_REPLICA );
                $text = $dbr->selectRow( 'text',
                        [ 'old_text', 'old_flags' ],
@@ -347,15 +341,18 @@ class PageArchive {
         */
        public function getLastRevisionText() {
                $dbr = wfGetDB( DB_REPLICA );
-               $row = $dbr->selectRow( 'archive',
-                       [ 'ar_text', 'ar_flags', 'ar_text_id' ],
+               $row = $dbr->selectRow(
+                       [ 'archive', 'text' ],
+                       [ 'old_text', 'old_flags' ],
                        [ 'ar_namespace' => $this->title->getNamespace(),
                                'ar_title' => $this->title->getDBkey() ],
                        __METHOD__,
-                       [ 'ORDER BY' => 'ar_timestamp DESC' ] );
+                       [ 'ORDER BY' => 'ar_timestamp DESC, ar_id DESC' ],
+                       [ 'text' => [ 'JOIN', 'old_id = ar_text_id' ] ]
+               );
 
                if ( $row ) {
-                       return $this->getTextFromRow( $row );
+                       return Revision::getRevisionText( $row );
                }
 
                return null;