Merge "Adding ability of jQuery badge to display the number zero if requested."
[lhc/web/wiklou.git] / includes / specials / SpecialUndelete.php
index 4c38a78..1ea6e46 100644 (file)
@@ -417,6 +417,9 @@ class PageArchive {
                $logEntry->setPerformer( $user );
                $logEntry->setTarget( $this->title );
                $logEntry->setComment( $reason );
+
+               wfRunHooks( 'ArticleUndeleteLogEntry', array( $this, &$logEntry, $user ) );
+
                $logid = $logEntry->insert();
                $logEntry->publish( $logid );
 
@@ -429,9 +432,10 @@ class PageArchive {
         * be stuffed into old, otherwise the most recent will go into cur.
         *
         * @param $timestamps Array: pass an empty array to restore all revisions, otherwise list the ones to undelete.
-        * @param $comment String
         * @param $unsuppress Boolean: remove all ar_deleted/fa_deleted restrictions of seletected revs
         *
+        * @param $comment String
+        * @throws ReadOnlyError
         * @return Status, containing the number of revisions restored on success
         */
        private function undeleteRevisions( $timestamps, $unsuppress = false, $comment = '' ) {
@@ -575,6 +579,9 @@ class PageArchive {
                                        return Status::newFatal( "undeleterevdel" );
                                }
                        }
+
+                       $newid  = false;
+                       $pageId = $article->getId();
                }
 
                $revision = null;
@@ -593,6 +600,7 @@ class PageArchive {
                        // unless we are specifically removing all restrictions...
                        $revision = Revision::newFromArchiveRow( $row,
                                array(
+                                       'page' => $pageId,
                                        'title' => $this->title,
                                        'deleted' => $unsuppress ? 0 : $row->ar_deleted
                                ) );
@@ -819,7 +827,7 @@ class SpecialUndelete extends SpecialPage {
 
                if( $result->numRows() == 0 ) {
                        $out->addWikiMsg( 'undelete-no-results' );
-                       return;
+                       return false;
                }
 
                $out->addWikiMsg( 'undeletepagetext', $this->getLanguage()->formatNum( $result->numRows() ) );