Merge "Consolidate Title normalization code in SearchUpdate"
[lhc/web/wiklou.git] / includes / page / WikiPage.php
index f7a4161..98bca05 100644 (file)
@@ -1383,7 +1383,7 @@ class WikiPage implements Page, IDBAccessObject {
         * must exist and must not be deleted
         * @param Revision $undo
         * @param Revision $undoafter Must be an earlier revision than $undo
-        * @return mixed String on success, false on failure
+        * @return Content|bool Content on success, false on failure
         * @since 1.21
         * Before we had the Content object, this was done in getUndoText
         */
@@ -1815,7 +1815,7 @@ class WikiPage implements Page, IDBAccessObject {
                                // Get the latest page_latest value while locking it.
                                // Do a CAS style check to see if it's the same as when this method
                                // started. If it changed then bail out before touching the DB.
-                               $latestNow = $this->lock();
+                               $latestNow = $this->lockAndGetLatest();
                                if ( $latestNow != $oldid ) {
                                        $dbw->commit( __METHOD__ );
                                        // Page updated or deleted in the mean time
@@ -2012,6 +2012,9 @@ class WikiPage implements Page, IDBAccessObject {
         * Prepare text which is about to be saved.
         * Returns a stdClass with source, pst and output members
         *
+        * @param string $text
+        * @param int|null $revid
+        * @param User|null $user
         * @deprecated since 1.21: use prepareContentForEdit instead.
         * @return object
         */
@@ -2794,7 +2797,7 @@ class WikiPage implements Page, IDBAccessObject {
                // WikiPage::READ_LOCKING as that will carry over the FOR UPDATE to
                // the revisions queries (which also JOIN on user). Only lock the page
                // row and CAS check on page_latest to see if the trx snapshot matches.
-               $lockedLatest = $this->lock();
+               $lockedLatest = $this->lockAndGetLatest();
                if ( $id == 0 || $this->getLatest() != $lockedLatest ) {
                        $dbw->endAtomic( __METHOD__ );
                        // Page not there or trx snapshot is stale
@@ -2916,8 +2919,9 @@ class WikiPage implements Page, IDBAccessObject {
         * Lock the page row for this title+id and return page_latest (or 0)
         *
         * @return integer Returns 0 if no row was found with this title+id
+        * @since 1.27
         */
-       protected function lock() {
+       public function lockAndGetLatest() {
                return (int)wfGetDB( DB_MASTER )->selectField(
                        'page',
                        'page_latest',