X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flogging%2FLogPage.php;h=f5798e20e46670780da6d565520514a5e069bbec;hb=8f1e4930f812bca98e16221171c6d1f1c59690ea;hp=51c41a8fe1b659be9ba8b4f28ae136e985653afc;hpb=b0b37fd95cd0e97fa5ceab0b0d1f5e2ce88b2b90;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/logging/LogPage.php b/includes/logging/LogPage.php index 51c41a8fe1..f5798e20e4 100644 --- a/includes/logging/LogPage.php +++ b/includes/logging/LogPage.php @@ -34,32 +34,51 @@ class LogPage { const DELETED_COMMENT = 2; const DELETED_USER = 4; const DELETED_RESTRICTED = 8; + // Convenience fields const SUPPRESSED_USER = 12; const SUPPRESSED_ACTION = 9; - /* @access private */ - var $type, $action, $comment, $params; - /** - * @var User - */ - var $doer; + /** @var bool */ + public $updateRecentChanges; - /** - * @var Title + /** @var bool */ + public $sendToUDP; + + /** @var string Plaintext version of the message for IRC */ + private $ircActionText; + + /** @var string Plaintext version of the message */ + private $actionText; + + /** @var string One of '', 'block', 'protect', 'rights', 'delete', + * 'upload', 'move' */ - var $target; + private $type; + + /** @var string One of '', 'block', 'protect', 'rights', 'delete', + * 'upload', 'move', 'move_redir' */ + private $action; + + /** @var string Comment associated with action */ + private $comment; + + /** @var string Blob made of a parameters array */ + private $params; - /* @access public */ - var $updateRecentChanges, $sendToUDP; + /** @var User The user doing the action */ + private $doer; + + /** @var Title */ + private $target; /** * Constructor * - * @param string $type one of '', 'block', 'protect', 'rights', 'delete', - * 'upload', 'move' - * @param $rc Boolean: whether to update recent changes as well as the logging table - * @param string $udp pass 'UDP' to send to the UDP feed if NOT sent to RC + * @param string $type One of '', 'block', 'protect', 'rights', 'delete', + * 'upload', 'move' + * @param bool $rc Whether to update recent changes as well as the logging table + * @param string $udp Pass 'UDP' to send to the UDP feed if NOT sent to RC */ public function __construct( $type, $rc = true, $udp = 'skipUDP' ) { $this->type = $type; @@ -76,6 +95,7 @@ class LogPage { $dbw = wfGetDB( DB_MASTER ); $log_id = $dbw->nextSequenceValue( 'logging_log_id_seq' ); + // @todo FIXME private/protected/public property? $this->timestamp = $now = wfTimestampNow(); $data = array( 'log_id' => $log_id, @@ -116,7 +136,7 @@ class LogPage { $this->type, $this->action, $this->target, $this->comment, $this->params, $newId, $this->getRcCommentIRC() ); - $rc->notifyRC2UDP(); + $rc->notifyRCFeeds(); } return $newId; @@ -172,7 +192,7 @@ class LogPage { /** * Get the list of valid log types * - * @return Array of strings + * @return array of strings */ public static function validTypes() { global $wgLogTypes; @@ -183,8 +203,8 @@ class LogPage { /** * Is $type a valid log type * - * @param string $type log type to check - * @return Boolean + * @param string $type Log type to check + * @return bool */ public static function isLogType( $type ) { return in_array( $type, LogPage::validTypes() ); @@ -193,13 +213,15 @@ class LogPage { /** * Get the name for the given log type * - * @param string $type logtype - * @return String: log name + * @param string $type Log type + * @return string Log name * @deprecated in 1.19, warnings in 1.21. Use getName() */ public static function logName( $type ) { global $wgLogNames; + wfDeprecated( __METHOD__, '1.21' ); + if ( isset( $wgLogNames[$type] ) ) { return str_replace( '_', ' ', wfMessage( $wgLogNames[$type] )->text() ); } else { @@ -213,12 +235,14 @@ class LogPage { * * @todo handle missing log types * @param string $type logtype - * @return String: headertext of this logtype + * @return string Header text of this logtype * @deprecated in 1.19, warnings in 1.21. Use getDescription() */ public static function logHeader( $type ) { global $wgLogHeaders; + wfDeprecated( __METHOD__, '1.21' ); + return wfMessage( $wgLogHeaders[$type] )->parse(); } @@ -228,12 +252,12 @@ class LogPage { * * @param string $type log type * @param string $action log action - * @param $title Mixed: Title object or null - * @param $skin Mixed: Skin object or null. If null, we want to use the wiki - * content language, since that will go to the IRC feed. + * @param Title|null $title Title object or null + * @param Skin|null $skin Skin object or null. If null, we want to use the wiki + * content language, since that will go to the IRC feed. * @param array $params parameters - * @param $filterWikilinks Boolean: whether to filter wiki links - * @return HTML string + * @param bool $filterWikilinks Whether to filter wiki links + * @return string HTML */ public static function actionText( $type, $action, $title = null, $skin = null, $params = array(), $filterWikilinks = false @@ -333,12 +357,12 @@ class LogPage { } /** - * TODO document - * @param $type String - * @param $lang Language or null - * @param $title Title - * @param $params Array - * @return String + * @todo Document + * @param string $type + * @param Language|null $lang + * @param Title $title + * @param array $params + * @return string */ protected static function getTitleLink( $type, $lang, $title, &$params ) { if ( !$lang ) { @@ -418,10 +442,10 @@ class LogPage { * * @param string $action one of '', 'block', 'protect', 'rights', 'delete', * 'upload', 'move', 'move_redir' - * @param $target Title object + * @param Title $target Title object * @param string $comment description associated * @param array $params parameters passed later to wfMessage function - * @param $doer User object: the user doing the action + * @param null|int|User $doer The user doing the action. null for $wgUser * * @return int log_id of the inserted log entry */ @@ -474,10 +498,10 @@ class LogPage { /** * Add relations to log_search table * - * @param $field String - * @param $values Array - * @param $logid Integer - * @return Boolean + * @param string $field + * @param array $values + * @param int $logid + * @return bool */ public function addRelations( $field, $values, $logid ) { if ( !strlen( $field ) || empty( $values ) ) { @@ -503,8 +527,8 @@ class LogPage { /** * Create a blob from a parameter array * - * @param $params Array - * @return String + * @param array $params + * @return string */ public static function makeParamBlob( $params ) { return implode( "\n", $params ); @@ -513,8 +537,8 @@ class LogPage { /** * Extract a parameter array from a blob * - * @param $blob String - * @return Array + * @param string $blob + * @return array */ public static function extractParams( $blob ) { if ( $blob === '' ) { @@ -529,8 +553,8 @@ class LogPage { * into a more readable (and translated) form * * @param string $flags Flags to format - * @param $lang Language object to use - * @return String + * @param Language $lang + * @return string */ public static function formatBlockFlags( $flags, $lang ) { $flags = trim( $flags ); @@ -552,8 +576,8 @@ class LogPage { * Translate a block log flag if possible * * @param int $flag Flag to translate - * @param $lang Language object to use - * @return String + * @param Language $lang Language object to use + * @return string */ public static function formatBlockFlag( $flag, $lang ) { static $messages = array();