From 16558d1dbc8e3ea1d2b1e8d3f5837133d7ee740f Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 21 Apr 2007 12:42:27 +0000 Subject: [PATCH] Added some comments to our classes. --- includes/Exception.php | 23 ++++++++++++++++++----- includes/SpecialBrokenRedirects.php | 3 ++- includes/SpecialDoubleRedirects.php | 3 ++- includes/SpecialLockdb.php | 2 +- includes/SpecialLonelypages.php | 3 ++- includes/SpecialPage.php | 11 +++++++++++ includes/SpecialResetpass.php | 2 ++ includes/SpecialUncategorizedpages.php | 2 +- includes/SpecialUndelete.php | 4 ++-- includes/SpecialUploadMogile.php | 3 ++- includes/StringUtils.php | 4 +++- includes/WebResponse.php | 14 ++++++++------ 12 files changed, 54 insertions(+), 20 deletions(-) diff --git a/includes/Exception.php b/includes/Exception.php index 81cf12f6d9..4cf0b7baf3 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -1,6 +1,7 @@ useMessageCache() ) { @@ -24,6 +26,7 @@ class MWException extends Exception } } + /* If wgShowExceptionDetails, return a HTML message with a backtrace to the error. */ function getHTML() { global $wgShowExceptionDetails; if( $wgShowExceptionDetails ) { @@ -36,6 +39,7 @@ class MWException extends Exception } } + /* If wgShowExceptionDetails, return a text message with a backtrace to the error */ function getText() { global $wgShowExceptionDetails; if( $wgShowExceptionDetails ) { @@ -46,7 +50,8 @@ class MWException extends Exception "in LocalSettings.php to show detailed debugging information.

"; } } - + + /* Return titles of this error page */ function getPageTitle() { if ( $this->useMessageCache() ) { return wfMsg( 'internalerror' ); @@ -55,7 +60,10 @@ class MWException extends Exception return "$wgSitename error"; } } - + + /** Return the requested URL and point to file and line number from which the + * exception occured + */ function getLogMessage() { global $wgRequest; $file = $this->getFile(); @@ -63,7 +71,8 @@ class MWException extends Exception $message = $this->getMessage(); return $wgRequest->getRequestURL() . " Exception from line $line of $file: $message"; } - + + /** Output the exception report using HTML */ function reportHTML() { global $wgOut; if ( $this->useOutputPage() ) { @@ -81,11 +90,15 @@ class MWException extends Exception echo $this->htmlFooter(); } } - + + /** Print the exception report using text */ function reportText() { echo $this->getText(); } + /* Output a report about the exception and takes care of formatting. + * It will be either HTML or plain text based on $wgCommandLineMode. + */ function report() { global $wgCommandLineMode; if ( $wgCommandLineMode ) { @@ -210,7 +223,7 @@ function wfReportException( Exception $e ) { function wfExceptionHandler( $e ) { global $wgFullyInitialised; wfReportException( $e ); - + // Final cleanup, similar to wfErrorExit() if ( $wgFullyInitialised ) { try { diff --git a/includes/SpecialBrokenRedirects.php b/includes/SpecialBrokenRedirects.php index 12dba8aad9..208a7e1fd3 100644 --- a/includes/SpecialBrokenRedirects.php +++ b/includes/SpecialBrokenRedirects.php @@ -5,7 +5,8 @@ */ /** - * + * A special page listing redirects to non existent page. Those should be + * fixed to point to an existing page. * @addtogroup SpecialPage */ class BrokenRedirectsPage extends PageQueryPage { diff --git a/includes/SpecialDoubleRedirects.php b/includes/SpecialDoubleRedirects.php index 5bb199c873..2a7d1720a5 100644 --- a/includes/SpecialDoubleRedirects.php +++ b/includes/SpecialDoubleRedirects.php @@ -5,7 +5,8 @@ */ /** - * + * A special page listing redirects to redirecting page. + * The software will not procede double redirects automaticly to prevent loops. * @addtogroup SpecialPage */ class DoubleRedirectsPage extends PageQueryPage { diff --git a/includes/SpecialLockdb.php b/includes/SpecialLockdb.php index 929e028f6f..db4006f5a3 100644 --- a/includes/SpecialLockdb.php +++ b/includes/SpecialLockdb.php @@ -36,7 +36,7 @@ function wfSpecialLockdb() { } /** - * @todo document - e.g. a one-sentence top-level class description. + * A form to make the database readonly (eg for maintenance purposes). * @addtogroup SpecialPage */ class DBLockForm { diff --git a/includes/SpecialLonelypages.php b/includes/SpecialLonelypages.php index 810bd1eca4..430af7a763 100644 --- a/includes/SpecialLonelypages.php +++ b/includes/SpecialLonelypages.php @@ -5,7 +5,8 @@ */ /** - * + * A special page looking for articles with no article linking to them, + * thus being lonely. * @addtogroup SpecialPage */ class LonelyPagesPage extends PageQueryPage { diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index faf45176d9..cf88250993 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -714,6 +714,7 @@ class IncludableSpecialPage extends SpecialPage } /** + * Shortcut to construct a special page alias. * @addtogroup SpecialPage */ class SpecialRedirectToSpecial extends UnlistedSpecialPage { @@ -735,7 +736,15 @@ class SpecialRedirectToSpecial extends UnlistedSpecialPage { } } +/** SpecialMypage, SpecialMytalk and SpecialMycontributions special pages + * are used to get user independant links pointing to the user page, talk + * page and list of contributions. + * This can let us cache a single copy of any generated content for all + * users. + */ + /** + * Shortcut to construct a special page pointing to current user user's page. * @addtogroup SpecialPage */ class SpecialMypage extends UnlistedSpecialPage { @@ -755,6 +764,7 @@ class SpecialMypage extends UnlistedSpecialPage { } /** + * Shortcut to construct a special page pointing to current user talk page. * @addtogroup SpecialPage */ class SpecialMytalk extends UnlistedSpecialPage { @@ -774,6 +784,7 @@ class SpecialMytalk extends UnlistedSpecialPage { } /** + * Shortcut to construct a special page pointing to current user contributions. * @addtogroup SpecialPage */ class SpecialMycontributions extends UnlistedSpecialPage { diff --git a/includes/SpecialResetpass.php b/includes/SpecialResetpass.php index 3ae79f8a21..dc1e53c41a 100644 --- a/includes/SpecialResetpass.php +++ b/includes/SpecialResetpass.php @@ -1,11 +1,13 @@ execute( $par ); } /** + * Let users recover their password. * @addtogroup SpecialPage */ class PasswordResetForm extends SpecialPage { diff --git a/includes/SpecialUncategorizedpages.php b/includes/SpecialUncategorizedpages.php index cae34fe226..408ac72655 100644 --- a/includes/SpecialUncategorizedpages.php +++ b/includes/SpecialUncategorizedpages.php @@ -5,7 +5,7 @@ */ /** - * + * A special page looking for page without any category. * @addtogroup SpecialPage */ class UncategorizedPagesPage extends PageQueryPage { diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 5437d2a462..bd99caf4ad 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -8,7 +8,7 @@ */ /** - * + * Constructor */ function wfSpecialUndelete( $par ) { global $wgRequest; @@ -18,7 +18,7 @@ function wfSpecialUndelete( $par ) { } /** - * @todo document (just needs one-sentence top-level class description) + * Used to show archived pages and eventually restore them. * @addtogroup SpecialPage */ class PageArchive { diff --git a/includes/SpecialUploadMogile.php b/includes/SpecialUploadMogile.php index 9450d22b5e..27af62e763 100644 --- a/includes/SpecialUploadMogile.php +++ b/includes/SpecialUploadMogile.php @@ -5,7 +5,7 @@ */ /** - * + * You will need the extension MogileClient to use this special page. */ require_once( 'MogileFS.php' ); @@ -19,6 +19,7 @@ function wfSpecialUploadMogile() { } /** + * Extends Special:Upload with MogileFS. * @addtogroup SpecialPage */ class UploadFormMogile extends UploadForm { diff --git a/includes/StringUtils.php b/includes/StringUtils.php index 0090604dd5..9a451aa8dc 100644 --- a/includes/StringUtils.php +++ b/includes/StringUtils.php @@ -1,5 +1,7 @@ \ No newline at end of file +?> -- 2.20.1