revert r111234 (deprecated methods removal)
authorAntoine Musso <hashar@users.mediawiki.org>
Sun, 12 Feb 2012 19:25:28 +0000 (19:25 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sun, 12 Feb 2012 19:25:28 +0000 (19:25 +0000)
Reasons invoked by Rob Lanphier are:
* ongoing code slush
* backwards compatilibility issues

includes/FakeTitle.php
includes/Preferences.php
includes/Title.php
includes/parser/ParserOptions.php

index 38455d6..8415ec0 100644 (file)
@@ -46,6 +46,7 @@ class FakeTitle extends Title {
        function isNamespaceProtected( User $user ) { $this->error(); }
        function userCan( $action, $user = null, $doExpensiveQueries = true ) { $this->error(); }
        function getUserPermissionsErrors( $action, $user, $doExpensiveQueries = true, $ignoreErrors = array() ) { $this->error(); }
+       function updateTitleProtection( $create_perm, $reason, $expiry ) { $this->error(); }
        function deleteTitleProtection() { $this->error(); }
        function isMovable() { $this->error(); }
        function userCanRead() { $this->error(); }
@@ -58,6 +59,9 @@ class FakeTitle extends Title {
        function getSkinFromCssJsSubpage() { $this->error(); }
        function isCssSubpage() { $this->error(); }
        function isJsSubpage() { $this->error(); }
+       function userCanEditCssJsSubpage() { $this->error(); }
+       function userCanEditCssSubpage() { $this->error(); }
+       function userCanEditJsSubpage() { $this->error(); }
        function isCascadeProtected() { $this->error(); }
        function getCascadeProtectionSources( $get_pages = true ) { $this->error(); }
        function areRestrictionsCascading() { $this->error(); }
index 08bcab8..3fe6a8c 100644 (file)
@@ -1461,6 +1461,27 @@ class Preferences {
 
                return array( true, $info );
        }
+
+       /**
+        * @deprecated in 1.19; will be removed in 1.20.
+        * @param $user User
+        * @return array
+        */
+       public static function loadOldSearchNs( $user ) {
+               wfDeprecated( __METHOD__, '1.19' );
+
+               $searchableNamespaces = SearchEngine::searchableNamespaces();
+               // Back compat with old format
+               $arr = array();
+
+               foreach ( $searchableNamespaces as $ns => $name ) {
+                       if ( $user->getOption( 'searchNs' . $ns ) ) {
+                               $arr[] = $ns;
+                       }
+               }
+
+               return $arr;
+       }
 }
 
 /** Some tweaks to allow js prefs to work */
index 14f90d5..0ef4cda 100644 (file)
@@ -2128,6 +2128,34 @@ class Title {
                return $errors;
        }
 
+       /**
+        * Protect css subpages of user pages: can $wgUser edit
+        * this page?
+        *
+        * @deprecated in 1.19; will be removed in 1.20. Use getUserPermissionsErrors() instead.
+        * @return Bool
+        */
+       public function userCanEditCssSubpage() {
+               global $wgUser;
+               wfDeprecated( __METHOD__, '1.19' );
+               return ( ( $wgUser->isAllowedAll( 'editusercssjs', 'editusercss' ) )
+                       || preg_match( '/^' . preg_quote( $wgUser->getName(), '/' ) . '\//', $this->mTextform ) );
+       }
+
+       /**
+        * Protect js subpages of user pages: can $wgUser edit
+        * this page?
+        *
+        * @deprecated in 1.19; will be removed in 1.20. Use getUserPermissionsErrors() instead.
+        * @return Bool
+        */
+       public function userCanEditJsSubpage() {
+               global $wgUser;
+               wfDeprecated( __METHOD__, '1.19' );
+               return ( ( $wgUser->isAllowedAll( 'editusercssjs', 'edituserjs' ) )
+                          || preg_match( '/^' . preg_quote( $wgUser->getName(), '/' ) . '\//', $this->mTextform ) );
+       }
+
        /**
         * Get a filtered list of all restriction types supported by this wiki.
         * @param bool $exists True to get all restriction types that apply to
@@ -2203,6 +2231,29 @@ class Title {
                return $this->mTitleProtection;
        }
 
+       /**
+        * Update the title protection status
+        *
+        * @deprecated in 1.19; will be removed in 1.20. Use WikiPage::doUpdateRestrictions() instead.
+        * @param $create_perm String Permission required for creation
+        * @param $reason String Reason for protection
+        * @param $expiry String Expiry timestamp
+        * @return boolean true
+        */
+       public function updateTitleProtection( $create_perm, $reason, $expiry ) {
+               wfDeprecated( __METHOD__, '1.19' );
+
+               global $wgUser;
+
+               $limit = array( 'create' => $create_perm );
+               $expiry = array( 'create' => $expiry );
+
+               $page = WikiPage::factory( $this );
+               $status = $page->doUpdateRestrictions( $limit, $expiry, false, $reason, $wgUser );
+
+               return $status->isOK();
+       }
+
        /**
         * Remove any title protection due to page existing
         */
index ba5dc7e..bf9611f 100644 (file)
@@ -278,6 +278,9 @@ class ParserOptions {
        function setNumberHeadings( $x )            { return wfSetVar( $this->mNumberHeadings, $x ); }
        function setAllowSpecialInclusion( $x )     { return wfSetVar( $this->mAllowSpecialInclusion, $x ); }
        function setTidy( $x )                      { return wfSetVar( $this->mTidy, $x ); }
+
+       /** @deprecated in 1.19; will be removed in 1.20 */
+       function setSkin( $x )                      { wfDeprecated( __METHOD__, '1.19' ); }
        function setInterfaceMessage( $x )          { return wfSetVar( $this->mInterfaceMessage, $x ); }
        function setTargetLanguage( $x )            { return wfSetVar( $this->mTargetLanguage, $x, true ); }
        function setMaxIncludeSize( $x )            { return wfSetVar( $this->mMaxIncludeSize, $x ); }