From: Siebrand Mazeland Date: Fri, 27 Dec 2013 22:56:41 +0000 (+0100) Subject: Remove classes and functions deprecated in MediaWiki 1.17 X-Git-Tag: 1.31.0-rc.0~17318^2 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=52ba6500df6ebaeee40e1f8329f3c64ea811c89f;p=lhc%2Fweb%2Fwiklou.git Remove classes and functions deprecated in MediaWiki 1.17 Removed classes: - WikiError (deprecated in 1.17) - WikiXmlError (deprecated in 1.17) - WikiErrorMsg (deprecated in 1.17) Removed methods: - ApiBase::getValidNamespaces() (deprecated in 1.17) - ApiMain::setCachePrivate() (deprecated in 1.17) - ApiMain::setVaryCookie (deprecated in 1.17) - CategoryViewer::addSubcategory() (deprecated in 1.17) - WebRequest::getFileSize() (deprecated in 1.17) - WebRequest::isPathInfoBad() (deprecated in 1.17) Change-Id: Id715c2391742c136d09f5369f88d67e798842af7 --- diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 2a0f673c96..bcf9daf449 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -143,8 +143,11 @@ changes to languages because of Bugzilla reports. SpecialPage::getPageTitle. ==== Removed classes ==== -* TitleDependency -* TitleListDependency +* TitleDependency (unused) +* TitleListDependency (unused) +* WikiError (deprecated in 1.17) +* WikiXmlError (deprecated in 1.17) +* WikiErrorMsg (deprecated in 1.17) ==== Renamed classes ==== * CdbReader_DBA to CdbReaderDBA @@ -176,6 +179,10 @@ changes to languages because of Bugzilla reports. * wikiStatsOutput to WikiStatsOutput ==== Removed methods ==== +* ApiBase::getValidNamespaces() (deprecated in 1.17) +* ApiMain::setCachePrivate() (deprecated in 1.17) +* ApiMain::setVaryCookie (deprecated in 1.17) +* CategoryViewer::addSubcategory() (deprecated in 1.17) * EditPage::spamPage() (deprecated since 1.17) * Exif::getFormattedData() (deprecated in 1.18) * Exif::makeFormattedData() (deprecated in 1.18) @@ -214,6 +221,8 @@ changes to languages because of Bugzilla reports. * SpecialRecentChanges::feedSetup() * SpecialRevisionDelete::extractBitField() (deprecated in 1.22) * User::getPageRenderingHash() (deprecated in 1.17) +* WebRequest::getFileSize() (deprecated in 1.17) +* WebRequest::isPathInfoBad() (deprecated in 1.17) * WikiPage::quickEdit() (deprecated in 1.18) * WikiPage::useParserCache() (deprecated in 1.18) * WikiPage::viewUpdates() (deprecated in 1.18) diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index a9b03768f1..1c37c77be7 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -234,8 +234,6 @@ $wgAutoloadLocalClasses = array( 'WebRequestUpload' => 'includes/WebRequest.php', 'WebResponse' => 'includes/WebResponse.php', 'WikiCategoryPage' => 'includes/WikiCategoryPage.php', - 'WikiError' => 'includes/WikiError.php', - 'WikiErrorMsg' => 'includes/WikiError.php', 'WikiExporter' => 'includes/Export.php', 'WikiFilePage' => 'includes/WikiFilePage.php', 'WikiImporter' => 'includes/Import.php', @@ -243,7 +241,6 @@ $wgAutoloadLocalClasses = array( 'WikiRevision' => 'includes/Import.php', 'WikiMap' => 'includes/WikiMap.php', 'WikiReference' => 'includes/WikiMap.php', - 'WikiXmlError' => 'includes/WikiError.php', 'Xml' => 'includes/Xml.php', 'XmlDumpWriter' => 'includes/Export.php', 'XmlJsCode' => 'includes/Xml.php', diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index 55d9c1e524..4027bef09f 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -181,15 +181,6 @@ class CategoryViewer extends ContextSource { $this->getSubcategorySortChar( $cat->getTitle(), $sortkey ); } - /** - * Add a subcategory to the internal lists, using a title object - * @deprecated since 1.17 kept for compatibility, use addSubcategoryObject instead - */ - function addSubcategory( Title $title, $sortkey, $pageLength ) { - wfDeprecated( __METHOD__, '1.17' ); - $this->addSubcategoryObject( Category::newFromTitle( $title ), $sortkey, $pageLength ); - } - /** * Get the character to be used for sorting subcategories. * If there's a link from Category:A to Category:B, the sortkey of the resulting diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 2a7c032593..85c8bb6014 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -835,19 +835,6 @@ class WebRequest { return $file->getTempName(); } - /** - * Return the size of the upload, or 0. - * - * @deprecated since 1.17 - * @param $key String: - * @return integer - */ - public function getFileSize( $key ) { - wfDeprecated( __METHOD__, '1.17' ); - $file = new WebRequestUpload( $this, $key ); - return $file->getSize(); - } - /** * Return the upload error or 0 * @@ -1035,35 +1022,6 @@ HTML; return true; } - /** - * Returns true if the PATH_INFO ends with an extension other than a script - * extension. This could confuse IE for scripts that send arbitrary data which - * is not HTML but may be detected as such. - * - * Various past attempts to use the URL to make this check have generally - * run up against the fact that CGI does not provide a standard method to - * determine the URL. PATH_INFO may be mangled (e.g. if cgi.fix_pathinfo=0), - * but only by prefixing it with the script name and maybe some other stuff, - * the extension is not mangled. So this should be a reasonably portable - * way to perform this security check. - * - * Also checks for anything that looks like a file extension at the end of - * QUERY_STRING, since IE 6 and earlier will use this to get the file type - * if there was no dot before the question mark (bug 28235). - * - * @deprecated Use checkUrlExtension(). - * - * @param $extWhitelist array - * - * @return bool - */ - public function isPathInfoBad( $extWhitelist = array() ) { - wfDeprecated( __METHOD__, '1.17' ); - global $wgScriptExtension; - $extWhitelist[] = ltrim( $wgScriptExtension, '.' ); - return IEUrlExtension::areServerVarsBad( $_SERVER, $extWhitelist ); - } - /** * Parse the Accept-Language header sent by the client into an array * @return array array( languageCode => q-value ) sorted by q-value in descending order then @@ -1462,14 +1420,6 @@ class FauxRequest extends WebRequest { return $this->session; } - /** - * @param array $extWhitelist - * @return bool - */ - public function isPathInfoBad( $extWhitelist = array() ) { - return false; - } - /** * FauxRequests shouldn't depend on raw request data (but that could be implemented here) * @return String diff --git a/includes/WikiError.php b/includes/WikiError.php deleted file mode 100644 index 08eb800483..0000000000 --- a/includes/WikiError.php +++ /dev/null @@ -1,154 +0,0 @@ - - * http://www.mediawiki.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - */ - -/** - * Since PHP4 doesn't have exceptions, here's some error objects - * loosely modeled on the standard PEAR_Error model... - * @ingroup Exception - */ -class WikiError { - /** - * @param $message string - * - * @deprecated since 1.17 - */ - function __construct( $message ) { - wfDeprecated( __METHOD__, '1.17' ); - $this->mMessage = $message; - } - - /** - * @return string Plaintext error message to display - */ - function getMessage() { - return $this->mMessage; - } - - /** - * In following PEAR_Error model this could be formatted differently, - * but so far it's not. - * @return string - */ - function toString() { - return $this->getMessage(); - } - - /** - * Returns true if the given object is a WikiError-descended - * error object, false otherwise. - * - * @param $object mixed - * @return bool - * - * @deprecated since 1.17 - */ - public static function isError( $object ) { - wfDeprecated( __METHOD__, '1.17' ); - if ( $object instanceof WikiError ) { - return true; - } elseif ( $object instanceof Status ) { - return !$object->isOK(); - } else { - return false; - } - } -} - -/** - * Localized error message object - * @ingroup Exception - */ -class WikiErrorMsg extends WikiError { - /** - * @param string $message wiki message name - * @param ... parameters to pass to wfMsg() - * - * @deprecated since 1.17 - */ - function __construct( $message/*, ... */ ) { - wfDeprecated( __METHOD__, '1.17' ); - $args = func_get_args(); - array_shift( $args ); - $this->mMessage = wfMessage( $message )->rawParams( $args )->text(); - $this->mMsgKey = $message; - $this->mMsgArgs = $args; - } - - function getMessageKey() { - return $this->mMsgKey; - } - - function getMessageArgs() { - return $this->mMsgArgs; - } -} - -/** - * Error class designed to handle errors involved with - * XML parsing - * @ingroup Exception - */ -class WikiXmlError extends WikiError { - /** - * @param $parser resource - * @param $message string - * @param $context - * @param $offset Int - * - * @deprecated since 1.17 - */ - function __construct( $parser, $message = 'XML parsing error', $context = null, $offset = 0 ) { - wfDeprecated( __METHOD__, '1.17' ); - $this->mXmlError = xml_get_error_code( $parser ); - $this->mColumn = xml_get_current_column_number( $parser ); - $this->mLine = xml_get_current_line_number( $parser ); - $this->mByte = xml_get_current_byte_index( $parser ); - $this->mContext = $this->_extractContext( $context, $offset ); - $this->mMessage = $message; - xml_parser_free( $parser ); - wfDebug( "WikiXmlError: " . $this->getMessage() . "\n" ); - } - - /** @return string */ - function getMessage() { - // '$1 at line $2, col $3 (byte $4): $5', - return wfMessage( 'xml-error-string', - $this->mMessage, - $this->mLine, - $this->mColumn, - $this->mByte . $this->mContext, - xml_error_string( $this->mXmlError ) )->escaped(); - } - - function _extractContext( $context, $offset ) { - if ( is_null( $context ) ) { - return null; - } else { - // Hopefully integer overflow will be handled transparently here - $inlineOffset = $this->mByte - $offset; - return '; "' . substr( $context, $inlineOffset, 16 ) . '"'; - } - } -} diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index b6a7ca8de6..40edf4ecce 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -861,17 +861,6 @@ abstract class ApiBase extends ContextSource { return !is_null( $x ) && $x !== false; } - /** - * @deprecated since 1.17 use MWNamespace::getValidNamespaces() - * - * @return array - */ - public static function getValidNamespaces() { - wfDeprecated( __METHOD__, '1.17' ); - - return MWNamespace::getValidNamespaces(); - } - /** * Return true if we're to watch the page, false if not, null if no change. * @param string $watchlist Valid values: 'watch', 'unwatch', 'preferences', 'nochange' diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 829ba6f4d6..5735b76d42 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -292,16 +292,6 @@ class ApiMain extends ApiBase { $this->mCacheMode = $mode; } - /** - * @deprecated since 1.17 Private caching is now the default, so there is usually no - * need to call this function. If there is a need, you can use - * $this->setCacheMode('private') - */ - public function setCachePrivate() { - wfDeprecated( __METHOD__, '1.17' ); - $this->setCacheMode( 'private' ); - } - /** * Set directives (key/value pairs) for the Cache-Control header. * Boolean values will be formatted as such, by including or omitting @@ -316,21 +306,6 @@ class ApiMain extends ApiBase { $this->mCacheControl = $directives + $this->mCacheControl; } - /** - * Make sure Vary: Cookie and friends are set. Use this when the output of a request - * may be cached for anons but may not be cached for logged-in users. - * - * WARNING: This function must be called CONSISTENTLY for a given URL. This means that a - * given URL must either always or never call this function; if it sometimes does and - * sometimes doesn't, stuff will break. - * - * @deprecated since 1.17 Use setCacheMode( 'anon-public-user-private' ) - */ - public function setVaryCookie() { - wfDeprecated( __METHOD__, '1.17' ); - $this->setCacheMode( 'anon-public-user-private' ); - } - /** * Create an instance of an output formatter by its name *