Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1803,58 +1803,13 @@ |
1804 | 1804 | * |
1805 | 1805 | * @param $code Integer: status code |
1806 | 1806 | * @return String or null: message or null if $code is not in the list of |
1807 | | - * messages |
| 1807 | + * messages |
| 1808 | + * |
| 1809 | + * @deprecated since 1.19 Use HttpStatus::getMessage() instead. |
1808 | 1810 | */ |
1809 | 1811 | public static function getStatusMessage( $code ) { |
1810 | | - static $statusMessage = array( |
1811 | | - 100 => 'Continue', |
1812 | | - 101 => 'Switching Protocols', |
1813 | | - 102 => 'Processing', |
1814 | | - 200 => 'OK', |
1815 | | - 201 => 'Created', |
1816 | | - 202 => 'Accepted', |
1817 | | - 203 => 'Non-Authoritative Information', |
1818 | | - 204 => 'No Content', |
1819 | | - 205 => 'Reset Content', |
1820 | | - 206 => 'Partial Content', |
1821 | | - 207 => 'Multi-Status', |
1822 | | - 300 => 'Multiple Choices', |
1823 | | - 301 => 'Moved Permanently', |
1824 | | - 302 => 'Found', |
1825 | | - 303 => 'See Other', |
1826 | | - 304 => 'Not Modified', |
1827 | | - 305 => 'Use Proxy', |
1828 | | - 307 => 'Temporary Redirect', |
1829 | | - 400 => 'Bad Request', |
1830 | | - 401 => 'Unauthorized', |
1831 | | - 402 => 'Payment Required', |
1832 | | - 403 => 'Forbidden', |
1833 | | - 404 => 'Not Found', |
1834 | | - 405 => 'Method Not Allowed', |
1835 | | - 406 => 'Not Acceptable', |
1836 | | - 407 => 'Proxy Authentication Required', |
1837 | | - 408 => 'Request Timeout', |
1838 | | - 409 => 'Conflict', |
1839 | | - 410 => 'Gone', |
1840 | | - 411 => 'Length Required', |
1841 | | - 412 => 'Precondition Failed', |
1842 | | - 413 => 'Request Entity Too Large', |
1843 | | - 414 => 'Request-URI Too Large', |
1844 | | - 415 => 'Unsupported Media Type', |
1845 | | - 416 => 'Request Range Not Satisfiable', |
1846 | | - 417 => 'Expectation Failed', |
1847 | | - 422 => 'Unprocessable Entity', |
1848 | | - 423 => 'Locked', |
1849 | | - 424 => 'Failed Dependency', |
1850 | | - 500 => 'Internal Server Error', |
1851 | | - 501 => 'Not Implemented', |
1852 | | - 502 => 'Bad Gateway', |
1853 | | - 503 => 'Service Unavailable', |
1854 | | - 504 => 'Gateway Timeout', |
1855 | | - 505 => 'HTTP Version Not Supported', |
1856 | | - 507 => 'Insufficient Storage' |
1857 | | - ); |
1858 | | - return isset( $statusMessage[$code] ) ? $statusMessage[$code] : null; |
| 1812 | + wfDeprecated( __METHOD__ ); |
| 1813 | + return HttpStatus::getMessage( $code ); |
1859 | 1814 | } |
1860 | 1815 | |
1861 | 1816 | /** |
— | — | @@ -1877,7 +1832,7 @@ |
1878 | 1833 | $this->mRedirect = wfExpandUrl( $this->mRedirect ); |
1879 | 1834 | if( $this->mRedirectCode == '301' || $this->mRedirectCode == '303' ) { |
1880 | 1835 | if( !$wgDebugRedirects ) { |
1881 | | - $message = self::getStatusMessage( $this->mRedirectCode ); |
| 1836 | + $message = HttpStatus::getMessage( $this->mRedirectCode ); |
1882 | 1837 | $response->header( "HTTP/1.1 {$this->mRedirectCode} $message" ); |
1883 | 1838 | } |
1884 | 1839 | $this->mLastModified = wfTimestamp( TS_RFC2822 ); |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -524,6 +524,7 @@ |
525 | 525 | # includes/libs |
526 | 526 | 'CSSJanus' => 'includes/libs/CSSJanus.php', |
527 | 527 | 'CSSMin' => 'includes/libs/CSSMin.php', |
| 528 | + 'HttpStatus' => 'includes/libs/HttpStatus.php', |
528 | 529 | 'IEContentAnalyzer' => 'includes/libs/IEContentAnalyzer.php', |
529 | 530 | 'IEUrlExtension' => 'includes/libs/IEUrlExtension.php', |
530 | 531 | 'JavaScriptMinifier' => 'includes/libs/JavaScriptMinifier.php', |
Index: trunk/phase3/includes/libs/HttpStatus.php |
— | — | @@ -0,0 +1,68 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * @todo document |
| 5 | + */ |
| 6 | +class HttpStatus { |
| 7 | + |
| 8 | + /** |
| 9 | + * Get the message associed with the HTTP response code $code |
| 10 | + * |
| 11 | + * Replace OutputPage::getStatusMessage( $code ) |
| 12 | + * |
| 13 | + * @param $code Integer: status code |
| 14 | + * @return String or null: message or null if $code is not in the list of |
| 15 | + * messages |
| 16 | + */ |
| 17 | + public static function getMessage( $code ) { |
| 18 | + static $statusMessage = array( |
| 19 | + 100 => 'Continue', |
| 20 | + 101 => 'Switching Protocols', |
| 21 | + 102 => 'Processing', |
| 22 | + 200 => 'OK', |
| 23 | + 201 => 'Created', |
| 24 | + 202 => 'Accepted', |
| 25 | + 203 => 'Non-Authoritative Information', |
| 26 | + 204 => 'No Content', |
| 27 | + 205 => 'Reset Content', |
| 28 | + 206 => 'Partial Content', |
| 29 | + 207 => 'Multi-Status', |
| 30 | + 300 => 'Multiple Choices', |
| 31 | + 301 => 'Moved Permanently', |
| 32 | + 302 => 'Found', |
| 33 | + 303 => 'See Other', |
| 34 | + 304 => 'Not Modified', |
| 35 | + 305 => 'Use Proxy', |
| 36 | + 307 => 'Temporary Redirect', |
| 37 | + 400 => 'Bad Request', |
| 38 | + 401 => 'Unauthorized', |
| 39 | + 402 => 'Payment Required', |
| 40 | + 403 => 'Forbidden', |
| 41 | + 404 => 'Not Found', |
| 42 | + 405 => 'Method Not Allowed', |
| 43 | + 406 => 'Not Acceptable', |
| 44 | + 407 => 'Proxy Authentication Required', |
| 45 | + 408 => 'Request Timeout', |
| 46 | + 409 => 'Conflict', |
| 47 | + 410 => 'Gone', |
| 48 | + 411 => 'Length Required', |
| 49 | + 412 => 'Precondition Failed', |
| 50 | + 413 => 'Request Entity Too Large', |
| 51 | + 414 => 'Request-URI Too Large', |
| 52 | + 415 => 'Unsupported Media Type', |
| 53 | + 416 => 'Request Range Not Satisfiable', |
| 54 | + 417 => 'Expectation Failed', |
| 55 | + 422 => 'Unprocessable Entity', |
| 56 | + 423 => 'Locked', |
| 57 | + 424 => 'Failed Dependency', |
| 58 | + 500 => 'Internal Server Error', |
| 59 | + 501 => 'Not Implemented', |
| 60 | + 502 => 'Bad Gateway', |
| 61 | + 503 => 'Service Unavailable', |
| 62 | + 504 => 'Gateway Timeout', |
| 63 | + 505 => 'HTTP Version Not Supported', |
| 64 | + 507 => 'Insufficient Storage' |
| 65 | + ); |
| 66 | + return isset( $statusMessage[$code] ) ? $statusMessage[$code] : null; |
| 67 | + } |
| 68 | + |
| 69 | +} |
Property changes on: trunk/phase3/includes/libs/HttpStatus.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
1 | 70 | Merged /branches/wmf-deployment/includes/OutputPage.php:r53381,57468 |
2 | 71 | Merged /branches/REL1_15/phase3/includes/OutputPage.php:r51646 |
3 | 72 | Merged /branches/REL1_17/phase3/includes/OutputPage.php:r81445 |
4 | 73 | Merged /branches/resourceloader/phase3/includes/OutputPage.php:r68366-69676,69678-70682,70684-71999,72001-72255,72257-72305,72307-72342 |
Added: svn:eol-style |
5 | 74 | + native |
Added: svn:keywords |
6 | 75 | + Author Date Id Revision |
Index: trunk/phase3/includes/specials/SpecialUploadStash.php |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | $message = $e->getMessage(); |
99 | 99 | } |
100 | 100 | |
101 | | - wfHttpError( $code, OutputPage::getStatusMessage( $code ), $message ); |
| 101 | + wfHttpError( $code, HttpStatus::getMessage( $code ), $message ); |
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | |