* Confirmation is now required when deleting old versions of files
[lhc/web/wiklou.git] / includes / Article.php
index 2595299..6960b0c 100644 (file)
@@ -262,7 +262,6 @@ class Article {
                                'page_id',
                                'page_namespace',
                                'page_title',
-                               'page_key',
                                'page_restrictions',
                                'page_counter',
                                'page_is_redirect',
@@ -270,13 +269,16 @@ class Article {
                                'page_random',
                                'page_touched',
                                'page_latest',
-                               'page_len' ) ;
-               wfRunHooks( 'ArticlePageDataBefore', array( &$this , &$fields ) )       ;
-               $row = $dbr->selectRow( 'page',
+                               'page_len',
+               );
+               wfRunHooks( 'ArticlePageDataBefore', array( &$this, &$fields ) );
+               $row = $dbr->selectRow(
+                       'page',
                        $fields,
                        $conditions,
-                       'Article::pageData' );
-               wfRunHooks( 'ArticlePageDataAfter', array( &$this , &$row ) )   ;
+                       __METHOD__
+               );
+               wfRunHooks( 'ArticlePageDataAfter', array( &$this, &$row ) );
                return $row ;
        }
 
@@ -1002,7 +1004,6 @@ class Article {
         * @private
         */
        function insertOn( $dbw ) {
-               global $wgContLang;
                wfProfileIn( __METHOD__ );
 
                $page_id = $dbw->nextSequenceValue( 'page_page_id_seq' );
@@ -1010,7 +1011,6 @@ class Article {
                        'page_id'           => $page_id,
                        'page_namespace'    => $this->mTitle->getNamespace(),
                        'page_title'        => $this->mTitle->getDBkey(),
-                       'page_key'          => $wgContLang->caseFold($this->mTitle->getDBkey()),
                        'page_counter'      => 0,
                        'page_restrictions' => '',
                        'page_is_redirect'  => 0, # Will set this shortly...
@@ -1253,7 +1253,10 @@ class Article {
                                }
                        }
 
-                       $this->doRedirect( $this->isRedirect( $text ), $sectionanchor );
+                       $extraq = ''; // Give extensions a chance to modify URL query on update
+                       wfRunHooks( 'ArticleUpdateBeforeRedirect', array( $this, &$sectionanchor, &$extraq ) );
+
+                       $this->doRedirect( $this->isRedirect( $text ), $sectionanchor, $extraq );
                }
                return $good;
        }
@@ -1489,12 +1492,14 @@ class Article {
         * @param boolean $noRedir Add redirect=no
         * @param string $sectionAnchor section to redirect to, including "#"
         */
-       function doRedirect( $noRedir = false, $sectionAnchor = '' ) {
+       function doRedirect( $noRedir = false, $sectionAnchor = '', $extraq = '' ) {
                global $wgOut;
                if ( $noRedir ) {
                        $query = 'redirect=no';
+                       if( $extraq )
+                               $query .= "&$query";
                } else {
-                       $query = '';
+                       $query = $extraq;
                }
                $wgOut->redirect( $this->mTitle->getFullURL( $query ) . $sectionAnchor );
        }
@@ -2117,7 +2122,7 @@ class Article {
                                'ar_text'       => '\'\'', // Be explicit to appease
                                'ar_flags'      => '\'\'', // MySQL's "strict mode"...
                                'ar_len'                => 'rev_len',
-                               'ar_page'       => $id
+                               'ar_page_id'    => 'page_id',
                        ), array(
                                'page_id' => $id,
                                'page_id = rev_page'
@@ -2807,16 +2812,21 @@ class Article {
 
                $wgOut->setPagetitle( $page->getPrefixedText() );
                $wgOut->setPageTitleActionText( wfMsg( 'info_short' ) );
-               $wgOut->setSubtitle( wfMsg( 'infosubtitle' ));
-
-               # first, see if the page exists at all.
-               $exists = $page->getArticleId() != 0;
-               if( !$exists ) {
-                       if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
-                               $wgOut->addHTML(wfMsgWeirdKey ( $this->mTitle->getText() ) );
+               $wgOut->setSubtitle( wfMsg( 'infosubtitle' ) );
+
+               if( !$this->mTitle->exists() ) {
+                       $wgOut->addHtml( '<div class="noarticletext">' );
+                       if( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
+                               // This doesn't quite make sense; the user is asking for
+                               // information about the _page_, not the message... -- RC
+                               $wgOut->addHtml( htmlspecialchars( wfMsgWeirdKey( $this->mTitle->getText() ) ) );
                        } else {
-                               $wgOut->addHTML(wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' ) );
+                               $msg = $wgUser->isLoggedIn()
+                                       ? 'noarticletext'
+                                       : 'noarticletextanon';
+                               $wgOut->addHtml( wfMsgExt( $msg, 'parse' ) );
                        }
+                       $wgOut->addHtml( '</div>' );
                } else {
                        $dbr = wfGetDB( DB_SLAVE );
                        $wl_clause = array(