Do proper conversion table detection.
[lhc/web/wiklou.git] / includes / WikiPage.php
index b326eb4..b5f4c1d 100644 (file)
@@ -530,11 +530,7 @@ class WikiPage extends Page {
                }
 
                wfProfileOut( __METHOD__ );
-               if ( $row ) {
-                       return Revision::newFromRow( $row );
-               } else {
-                       return null;
-               }
+               return $row ? Revision::newFromRow( $row ) : null;
        }
 
        /**
@@ -2225,21 +2221,7 @@ class WikiPage extends Page {
                        return WikiPage::DELETE_NO_REVISIONS;
                }
 
-               # update site status
-               DeferredUpdates::addUpdate( new SiteStatsUpdate( 0, 1, - (int)$this->isCountable(), -1 ) );
-
-               # remove secondary indexes, etc
-               $updates = $this->getDeletionUpdates( );
-               DataUpdate::runUpdates( $updates );
-
-               # Clear caches
-               WikiPage::onArticleDelete( $this->mTitle );
-
-               # Reset this object
-               $this->clear();
-
-               # Clear the cached article id so the interface doesn't act like we exist
-               $this->mTitle->resetArticleID( 0 );
+               $this->doDeleteUpdates( $id );
 
                # Log the deletion, if the page was suppressed, log it at Oversight instead
                $logtype = $suppress ? 'suppress' : 'delete';
@@ -2259,6 +2241,39 @@ class WikiPage extends Page {
                return WikiPage::DELETE_SUCCESS;
        }
 
+       /**
+        * Do some database updates after deletion
+        *
+        * @param $id Int: page_id value of the page being deleted (B/C, currently unused)
+        */
+       public function doDeleteUpdates( $id ) {
+               # update site status
+               DeferredUpdates::addUpdate( new SiteStatsUpdate( 0, 1, - (int)$this->isCountable(), -1 ) );
+
+               # remove secondary indexes, etc
+               $updates = $this->getDeletionUpdates( );
+               DataUpdate::runUpdates( $updates );
+
+               # Clear caches
+               WikiPage::onArticleDelete( $this->mTitle );
+
+               # Reset this object
+               $this->clear();
+
+               # Clear the cached article id so the interface doesn't act like we exist
+               $this->mTitle->resetArticleID( 0 );
+       }
+
+       public function getDeletionUpdates() {
+               $updates = array(
+                       new LinksDeletionUpdate( $this ),
+               );
+
+               //@todo: make a hook to add update objects
+               //NOTE: deletion updates will be determined by the ContentHandler in the future
+               return $updates;
+       }
+
        /**
         * Roll back the most recent consecutive set of edits to a page
         * from the same user; fails if there are no eligible edits to
@@ -2956,16 +2971,6 @@ class WikiPage extends Page {
                global $wgUser;
                return $this->isParserCacheUsed( ParserOptions::newFromUser( $wgUser ), $oldid );
        }
-
-       public function getDeletionUpdates() {
-               $updates = array(
-                       new LinksDeletionUpdate( $this ),
-               );
-
-               //@todo: make a hook to add update objects
-               //NOTE: deletion updates will be determined by the ContentHandler in the future
-               return $updates;
-       }
 }
 
 class PoolWorkArticleView extends PoolCounterWork {