X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FLogPage.php;h=1fe0c6b344343fe5efaca9214e057300b583caf1;hb=5bfce03820d1e511b1d9e3caca029d2bb6026d24;hp=a9486938f8a140252a1996b1dc76bea8f5d43da3;hpb=ad39f2da8660219768f46db739be66a27c8eb651;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/LogPage.php b/includes/LogPage.php index a9486938f8..1fe0c6b344 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -172,6 +172,7 @@ class LogPage { * * @param $type String: logtype * @return String: log name + * @deprecated in 1.19, warnings in 1.21. Use getName() */ public static function logName( $type ) { global $wgLogNames; @@ -190,6 +191,7 @@ class LogPage { * @todo handle missing log types * @param $type String: logtype * @return String: headertext of this logtype + * @deprecated in 1.19, warnings in 1.21. Use getDescription() */ public static function logHeader( $type ) { global $wgLogHeaders; @@ -223,11 +225,6 @@ class LogPage { $key = "$type/$action"; - # Defer patrol log to PatrolLog class - if( $key == 'patrol/patrol' ) { - return PatrolLog::makeActionText( $title, $params, $langObjOrNull ); - } - if( isset( $wgLogActions[$key] ) ) { if( is_null( $title ) ) { $rv = wfMsgExt( $wgLogActions[$key], array( 'parsemag', 'escape', 'language' => $langObj ) ); @@ -284,23 +281,6 @@ class LogPage { if( $params[2] ) { $details .= ' [' . wfMsgExt( 'protect-summary-cascade', array( 'parsemag', 'language' => $langObj ) ) . ']'; } - // Page moves - } elseif ( $type == 'move' && count( $params ) == 3 ) { - if( $params[2] ) { - $details .= ' [' . wfMsgExt( 'move-redirect-suppressed', array( 'parsemag', 'language' => $langObj ) ) . ']'; - } - // Revision deletion - } elseif ( preg_match( '/^(delete|suppress)\/revision$/', $key ) && count( $params ) == 5 ) { - $count = substr_count( $params[2], ',' ) + 1; // revisions - $ofield = intval( substr( $params[3], 7 ) ); // - $nfield = intval( substr( $params[4], 7 ) ); // - $details .= ': ' . RevisionDeleter::getLogMessage( $count, $nfield, $ofield, $langObj, false ); - // Log deletion - } elseif ( preg_match( '/^(delete|suppress)\/event$/', $key ) && count( $params ) == 4 ) { - $count = substr_count( $params[1], ',' ) + 1; // log items - $ofield = intval( substr( $params[2], 7 ) ); // - $nfield = intval( substr( $params[3], 7 ) ); // - $details .= ': ' . RevisionDeleter::getLogMessage( $count, $nfield, $ofield, $langObj, true ); } $rv = wfMsgExt( $wgLogActions[$key], array( 'parsemag', 'escape', 'replaceafter', 'language' => $langObj ), $params ) . $details; @@ -411,7 +391,7 @@ class LogPage { $params[1] = $lang->timeanddate( $params[1] ); break; default: - if( $title->getNamespace() == NS_SPECIAL ) { + if( $title->isSpecialPage() ) { list( $name, $par ) = SpecialPageFactory::resolveAlias( $title->getDBkey() ); # Use the language name for log titles, rather than Log/X @@ -576,12 +556,66 @@ class LogPage { return $messages[$flag]; } -} -/** - * Aliases for backwards compatibility with 1.6 - */ -define( 'MW_LOG_DELETED_ACTION', LogPage::DELETED_ACTION ); -define( 'MW_LOG_DELETED_USER', LogPage::DELETED_USER ); -define( 'MW_LOG_DELETED_COMMENT', LogPage::DELETED_COMMENT ); -define( 'MW_LOG_DELETED_RESTRICTED', LogPage::DELETED_RESTRICTED ); + + /** + * Name of the log. + * @return Message + * @since 1.19 + */ + public function getName() { + global $wgLogNames; + + // BC + if ( isset( $wgLogNames[$this->type] ) ) { + $key = $wgLogNames[$this->type]; + } else { + $key = 'log-name-' . $this->type; + } + + return wfMessage( $key ); + } + + /** + * Description of this log type. + * @return Message + * @since 1.19 + */ + public function getDescription() { + global $wgLogHeaders; + // BC + if ( isset( $wgLogHeaders[$this->type] ) ) { + $key = $wgLogHeaders[$this->type]; + } else { + $key = 'log-description-' . $this->type; + } + return wfMessage( $key ); + } + + /** + * Returns the right needed to read this log type. + * @return string + * @since 1.19 + */ + public function getRestriction() { + global $wgLogRestrictions; + if ( isset( $wgLogRestrictions[$this->type] ) ) { + $restriction = $wgLogRestrictions[$this->type]; + } else { + // '' always returns true with $user->isAllowed() + $restriction = ''; + } + return $restriction; + } + + /** + * Tells if this log is not viewable by all. + * @return bool + * @since 1.19 + */ + public function isRestricted() { + $restriction = $this->getRestriction(); + return $restriction !== '' && $restriction !== '*'; + } + +}