Use title accessor
[lhc/web/wiklou.git] / includes / FileDeleteForm.php
index 9101d6e..54c19f0 100644 (file)
@@ -118,21 +118,19 @@ class FileDeleteForm {
                } else {
                        $id = $title->getArticleID( Title::GAID_FOR_UPDATE );
                        $article = new Article( $title );
-                       $error = '';
                        $dbw = wfGetDB( DB_MASTER );
                        try {
                                // delete the associated article first
                                if( $article->doDeleteArticle( $reason, $suppress, $id, false ) ) {
                                        global $wgRequest;
-                                       if( $wgRequest->getCheck( 'wpWatch' ) && $wgUser->isLoggedIn() ) {
-                                               Action::factory( 'watch', $article )->execute();
-                                       } elseif( $title->userIsWatching() ) {
-                                               Action::factory( 'unwatch', $article )->execute();
+                                       if ( $wgRequest->getCheck( 'wpWatch' ) && $wgUser->isLoggedIn() ) {
+                                               WatchAction::doWatch( $title, $wgUser );
+                                       } elseif ( $title->userIsWatching() ) {
+                                               WatchAction::doUnwatch( $title, $wgUser );
                                        }
                                        $status = $file->delete( $reason, $suppress );
                                        if( $status->ok ) {
                                                $dbw->commit();
-                                               wfRunHooks( 'ArticleDeleteComplete', array( &$article, &$wgUser, $reason, $id ) );
                                        } else {
                                                $dbw->rollback();
                                        }
@@ -255,7 +253,7 @@ class FileDeleteForm {
                        return wfMsgExt(
                                "{$message}-old", # To ensure grep will find them: 'filedelete-intro-old', 'filedelete-nofile-old', 'filedelete-success-old'
                                'parse',
-                               $this->title->getText(),
+                               wfEscapeWikiText( $this->title->getText() ),
                                $wgLang->date( $this->getTimestamp(), true ),
                                $wgLang->time( $this->getTimestamp(), true ),
                                wfExpandUrl( $this->file->getArchiveUrl( $this->oldimage ) ) );
@@ -263,7 +261,7 @@ class FileDeleteForm {
                        return wfMsgExt(
                                $message,
                                'parse',
-                               $this->title->getText()
+                               wfEscapeWikiText( $this->title->getText() )
                        );
                }
        }