Tell regexp parser to use extra analysis on external link regexp;
[lhc/web/wiklou.git] / includes / Article.php
index b361976..5437d46 100644 (file)
@@ -69,6 +69,9 @@ class Article {
          * @return string $text|false the text requested
        */
        function getRevisionText( $row, $prefix = 'old_' ) {
+               $fname = 'Article::getRevisionText';
+               wfProfileIn( $fname );
+               
                # Get data
                $textField = $prefix . 'text';
                $flagsField = $prefix . 'flags';
@@ -111,6 +114,7 @@ class Article {
                        global $wgInputEncoding, $wgContLang;
                        $text = $wgContLang->iconv( $wgLegacyEncoding, $wgInputEncoding, $text );
                }
+               wfProfileOut( $fname );
                return $text;
        }
 
@@ -407,8 +411,7 @@ class Article {
                        $this->mCounter = $s->cur_counter;
                        $this->mTimestamp = wfTimestamp(TS_MW,$s->cur_timestamp);
                        $this->mTouched = wfTimestamp(TS_MW,$s->cur_touched);
-                       $this->mTitle->mRestrictions = explode( ',', trim( $s->cur_restrictions ) );
-                       $this->mTitle->mRestrictionsLoaded = true;
+                       $this->mTitle->loadRestrictions( $s->cur_restrictions );
                } else { # oldid set, retrieve historical version
                        $s = $dbr->selectRow( 'old', $this->getOldContentFields(), array( 'old_id' => $oldid ),
                                $fname, $this->getSelectOptions() );
@@ -486,8 +489,7 @@ class Article {
                        $this->mCounter = $s->cur_counter;
                        $this->mTimestamp = wfTimestamp(TS_MW,$s->cur_timestamp);
                        $this->mTouched = wfTimestamp(TS_MW,$s->cur_touched);
-                       $this->mTitle->mRestrictions = explode( ',', trim( $s->cur_restrictions ) );
-                       $this->mTitle->mRestrictionsLoaded = true;
+                       $this->mTitle->loadRestrictions( $s->cur_restrictions );
                } else { # oldid set, retrieve historical version
                        $s = $dbr->selectRow( 'old', $this->getOldContentFields(), array( 'old_id' => $oldid ),
                                $fname, $this->getSelectOptions() );
@@ -1275,14 +1277,20 @@ class Article {
                }
 
                $confirm = $wgRequest->getBool( 'wpConfirmProtect' ) && $wgRequest->wasPosted();
+               $moveonly = $wgRequest->getBool( 'wpMoveOnly' );
                $reason = $wgRequest->getText( 'wpReasonProtect' );
 
                if ( $confirm ) {
+                       $restrictions = "move=" . $limit;
+                       if( !$moveonly ) {
+                               $restrictions .= ":edit=" . $limit;
+                       }
+                       
                        $dbw =& wfGetDB( DB_MASTER );
                        $dbw->update( 'cur',
                                array( /* SET */
                                        'cur_touched' => $dbw->timestamp(),
-                                       'cur_restrictions' => (string)$limit
+                                       'cur_restrictions' => $restrictions
                                ), array( /* WHERE */
                                        'cur_id' => $id
                                ), 'Article::protect'
@@ -1315,6 +1323,7 @@ class Article {
 
                $check = '';
                $protcom = '';
+               $moveonly = '';
 
                if ( $limit === '' ) {
                        $wgOut->setPageTitle( wfMsg( 'confirmunprotect' ) );
@@ -1328,6 +1337,7 @@ class Article {
                        $wgOut->setSubtitle( wfMsg( 'protectsub', $sub ) );
                        $wgOut->addWikiText( wfMsg( 'confirmprotecttext' ) );
                        $check = htmlspecialchars( wfMsg( 'confirmprotect' ) );
+                       $moveonly = htmlspecialchars( wfMsg( 'protectmoveonly' ) );
                        $protcom = htmlspecialchars( wfMsg( 'protectcomment' ) );
                        $formaction = $this->mTitle->escapeLocalURL( 'action=protect' . $par );
                }
@@ -1355,7 +1365,19 @@ class Article {
                        <td>
                                <label for='wpConfirmProtect'>{$check}</label>
                        </td>
-               </tr>
+               </tr> " );
+               if($moveonly != '') {
+                       $wgOut->AddHTML( "
+               <tr>
+                       <td align='right'>
+                               <input type='checkbox' name='wpMoveOnly' value='1' id='wpMoveOnly' />
+                       </td>
+                       <td>
+                               <label for='wpMoveOnly'>{$moveonly}</label>
+                       </td>
+               </tr> " );
+               }
+               $wgOut->addHTML( "
                <tr>
                        <td>&nbsp;</td>
                        <td>