$flags: Flags passed to WikiPage::doEditContent()
$revision: New Revision of the article
-'PageContentInsertComplete': After a new article is created
-$article: WikiPage created
-$user: User creating the article
-$content: New content as a Content object
-$summary: Edit summary/comment
-$isMinor: Whether or not the edit was marked as minor
-$isWatch: (No longer used)
-$section: (No longer used)
-$flags: Flags passed to WikiPage::doEditContent()
-$revision: New Revision of the article
-
'ArticleMergeComplete': after merging to article using Special:Mergehistory
$targetTitle: target title (object)
$destTitle: destination title (object)
$iswatch: watch flag
$section: section #
-'PageContentSave': before an article is saved.
-$article: the WikiPage (object) being saved
-$user: the user (object) saving the article
-$content: the new article content, as a Content object
-$summary: the article summary (comment)
-$isminor: minor flag
-$iswatch: watch flag
-$section: section #
-
'ArticleSaveComplete': After an article has been updated. DEPRECATED, use PageContentSaveComplete instead.
$article: WikiPage modified
$user: User performing the modification
$status: Status object about to be returned by doEditContent()
$baseRevId: the rev ID (or false) this edit was based on
-'PageContentSaveComplete': After an article has been updated
-$article: WikiPage modified
-$user: User performing the modification
-$content: New content, as a Content object
-$summary: Edit summary/comment
-$isMinor: Whether or not the edit was marked as minor
-$isWatch: (No longer used)
-$section: (No longer used)
-$flags: Flags passed to WikiPage::doEditContent()
-$revision: New Revision of the article
-$status: Status object about to be returned by doEditContent()
-$baseRevId: the rev ID (or false) this edit was based on
-
'ArticleUndelete': When one or more revisions of an article are restored
$title: Title corresponding to the article restored
$create: Whether or not the restoration caused the page to be created
$links: array, intended to hold the result. Must be an associative array with
category types as keys and arrays of HTML links as values.
+'PageContentInsertComplete': After a new article is created
+$article: WikiPage created
+$user: User creating the article
+$content: New content as a Content object
+$summary: Edit summary/comment
+$isMinor: Whether or not the edit was marked as minor
+$isWatch: (No longer used)
+$section: (No longer used)
+$flags: Flags passed to WikiPage::doEditContent()
+$revision: New Revision of the article
+
'PageContentLanguage': allows changing the language in which the content of
a page is written. Defaults to the wiki content language ($wgContLang).
$title: Title object
&$pageLang: the page content language (either an object or a language code)
$wgLang: the user language
+'PageContentSave': before an article is saved.
+$article: the WikiPage (object) being saved
+$user: the user (object) saving the article
+$content: the new article content, as a Content object
+$summary: the article summary (comment)
+$isminor: minor flag
+$iswatch: watch flag
+$section: section #
+
+'PageContentSaveComplete': After an article has been updated
+$article: WikiPage modified
+$user: User performing the modification
+$content: New content, as a Content object
+$summary: Edit summary/comment
+$isMinor: Whether or not the edit was marked as minor
+$isWatch: (No longer used)
+$section: (No longer used)
+$flags: Flags passed to WikiPage::doEditContent()
+$revision: New Revision of the article
+$status: Status object about to be returned by doEditContent()
+$baseRevId: the rev ID (or false) this edit was based on
+
'PageHistoryBeforeList': When a history page list is about to be constructed.
$article: the article that the history is loading for
*/
$wgCopyUploadsDomains = array();
+/**
+ * Enable copy uploads from Special:Upload. $wgAllowCopyUploads must also be
+ * true. If $wgAllowCopyUploads is true, but this is false, you will only be
+ * able to perform copy uploads from the API or extensions (e.g. UploadWizard).
+ */
+$wgCopyUploadsFromSpecialUpload = false;
+
/**
* Proxy to use for copy upload requests.
* @since 1.20
// check if the user has an edit
$attribs = array();
if ( $redContribsWhenNoEdits ) {
- $count = !is_null( $edits ) ? $edits : User::edits( $userId );
- if ( $count == 0 ) {
+ if ( intval( $edits ) === 0 && $edits !== 0 ) {
+ $user = User::newFromId( $userId );
+ $edits = $user->getEditCount();
+ }
+ if ( $edits === 0 ) {
$attribs['class'] = 'new';
}
}
/**
* Count the number of edits of a user
- * @todo It should not be static and some day should be merged as proper member function / deprecated -- domas
*
* @param $uid Int User ID to check
* @return Int the user's edit count
+ *
+ * @deprecated since 1.21 in favour of User::getEditCount
*/
public static function edits( $uid ) {
- wfProfileIn( __METHOD__ );
- $dbr = wfGetDB( DB_SLAVE );
- // check if the user_editcount field has been initialized
- $field = $dbr->selectField(
- 'user', 'user_editcount',
- array( 'user_id' => $uid ),
- __METHOD__
- );
-
- if( $field === null ) { // it has not been initialized. do so.
- $dbw = wfGetDB( DB_MASTER );
- $count = $dbr->selectField(
- 'revision', 'count(*)',
- array( 'rev_user' => $uid ),
- __METHOD__
- );
- $dbw->update(
- 'user',
- array( 'user_editcount' => $count ),
- array( 'user_id' => $uid ),
- __METHOD__
- );
- } else {
- $count = $field;
- }
- wfProfileOut( __METHOD__ );
- return $count;
+ wfDeprecated( __METHOD__, '1.21' );
+ $user = self::newFromId( $uid );
+ return $user->getEditCount();
}
/**
if( $this->getId() ) {
if ( !isset( $this->mEditCount ) ) {
/* Populate the count, if it has not been populated yet */
- $this->mEditCount = User::edits( $this->mId );
+ wfProfileIn( __METHOD__ );
+ $dbr = wfGetDB( DB_SLAVE );
+ // check if the user_editcount field has been initialized
+ $count = $dbr->selectField(
+ 'user', 'user_editcount',
+ array( 'user_id' => $this->mId ),
+ __METHOD__
+ );
+
+ if( $count === null ) {
+ // it has not been initialized. do so.
+ $dbw = wfGetDB( DB_MASTER );
+ $count = $dbr->selectField(
+ 'revision', 'count(*)',
+ array( 'rev_user' => $this->mId ),
+ __METHOD__
+ );
+ $dbw->update(
+ 'user',
+ array( 'user_editcount' => $count ),
+ array( 'user_id' => $this->mId ),
+ __METHOD__
+ );
+ }
+ wfProfileOut( __METHOD__ );
+ $this->mEditCount = $count;
}
return $this->mEditCount;
} else {
// Page protection
$pageInfo['header-restrictions'] = array();
+ // Is this page effected by the cascading protection of something which includes it?
+ if ( $title->isCascadeProtected() ) {
+ $cascadingFrom = '';
+ $sources = $title->getCascadeProtectionSources(); // Array deferencing is in PHP 5.4 :(
+
+ foreach ( $sources[0] as $sourceTitle ) {
+ $cascadingFrom .= Html::rawElement( 'li', array(), Linker::linkKnown( $sourceTitle ) );
+ }
+
+ $cascadingFrom = Html::rawElement( 'ul', array(), $cascadingFrom );
+ $pageInfo['header-restrictions'][] = array(
+ $this->msg( 'pageinfo-protect-cascading-from' ),
+ $cascadingFrom
+ );
+ }
+
+ // Is out protection set to cascade to other pages?
+ if ( $title->areRestrictionsCascading() ) {
+ $pageInfo['header-restrictions'][] = array(
+ $this->msg( 'pageinfo-protect-cascading' ),
+ $this->msg( 'pageinfo-protect-cascading-yes' )
+ );
+ }
+
// Page protection
foreach ( $title->getRestrictionTypes() as $restrictionType ) {
$protectionLevel = implode( ', ', $title->getRestrictions( $restrictionType ) );
* @return bool
*/
public function push( $jobs ) {
- $jobs = (array)$jobs;
+ $jobs = is_array( $jobs ) ? $jobs : array( $jobs );
$jobsByType = array(); // (job type => list of jobs)
foreach ( $jobs as $job ) {
protected $debugRaw = true;
/** Boolean: Whether mw.loader.state() call should be omitted */
protected $raw = false;
+ protected $targets = array( 'desktop' );
+
/**
* Array: Cache for mtime
* @par Usage:
// Lists of strings
case 'dependencies':
case 'messages':
+ case 'targets':
$this->{$member} = (array) $option;
break;
// Single strings
public function getFlip( $context ) {
return $context->getDirection() === 'rtl';
}
+
+ /**
+ * Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']
+ *
+ * @return array of strings
+ */
+ public function getTargets() {
+ return $this->targets;
+ }
+
}
return self::$jsParser;
}
+ /**
+ * Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']
+ * Default implementation hardcodes 'desktop'.
+ *
+ * @return array of strings
+ */
+ public function getTargets() {
+ return array( 'desktop' );
+ }
}
$out = '';
$registrations = array();
$resourceLoader = $context->getResourceLoader();
+ $target = $context->getRequest()->getVal( 'target', 'desktop' );
// Register sources
$out .= ResourceLoader::makeLoaderSourcesScript( $resourceLoader->getSources() );
// Register modules
foreach ( $resourceLoader->getModuleNames() as $name ) {
$module = $resourceLoader->getModule( $name );
- $deps = $module->getDependencies();
- $group = $module->getGroup();
- $source = $module->getSource();
- // Support module loader scripts
- $loader = $module->getLoaderScript();
- if ( $loader !== false ) {
- $version = wfTimestamp( TS_ISO_8601_BASIC,
- $module->getModifiedTime( $context ) );
- $out .= ResourceLoader::makeCustomLoaderScript( $name, $version, $deps, $group, $source, $loader );
- }
- // Automatically register module
- else {
- // getModifiedTime() is supposed to return a UNIX timestamp, but it doesn't always
- // seem to do that, and custom implementations might forget. Coerce it to TS_UNIX
- $moduleMtime = wfTimestamp( TS_UNIX, $module->getModifiedTime( $context ) );
- $mtime = max( $moduleMtime, wfTimestamp( TS_UNIX, $wgCacheEpoch ) );
- // Modules without dependencies, a group or a foreign source pass two arguments (name, timestamp) to
- // mw.loader.register()
- if ( !count( $deps ) && $group === null && $source === 'local' ) {
- $registrations[] = array( $name, $mtime );
- }
- // Modules with dependencies but no group or foreign source pass three arguments
- // (name, timestamp, dependencies) to mw.loader.register()
- elseif ( $group === null && $source === 'local' ) {
- $registrations[] = array( $name, $mtime, $deps );
- }
- // Modules with a group but no foreign source pass four arguments (name, timestamp, dependencies, group)
- // to mw.loader.register()
- elseif ( $source === 'local' ) {
- $registrations[] = array( $name, $mtime, $deps, $group );
+ $moduleTargets = $module->getTargets();
+ if ( in_array( $target, $moduleTargets ) ) {
+ $deps = $module->getDependencies();
+ $group = $module->getGroup();
+ $source = $module->getSource();
+ // Support module loader scripts
+ $loader = $module->getLoaderScript();
+ if ( $loader !== false ) {
+ $version = wfTimestamp( TS_ISO_8601_BASIC,
+ $module->getModifiedTime( $context ) );
+ $out .= ResourceLoader::makeCustomLoaderScript( $name, $version, $deps, $group, $source, $loader );
}
- // Modules with a foreign source pass five arguments (name, timestamp, dependencies, group, source)
- // to mw.loader.register()
+ // Automatically register module
else {
- $registrations[] = array( $name, $mtime, $deps, $group, $source );
+ // getModifiedTime() is supposed to return a UNIX timestamp, but it doesn't always
+ // seem to do that, and custom implementations might forget. Coerce it to TS_UNIX
+ $moduleMtime = wfTimestamp( TS_UNIX, $module->getModifiedTime( $context ) );
+ $mtime = max( $moduleMtime, wfTimestamp( TS_UNIX, $wgCacheEpoch ) );
+ // Modules without dependencies, a group or a foreign source pass two arguments (name, timestamp) to
+ // mw.loader.register()
+ if ( !count( $deps ) && $group === null && $source === 'local' ) {
+ $registrations[] = array( $name, $mtime );
+ }
+ // Modules with dependencies but no group or foreign source pass three arguments
+ // (name, timestamp, dependencies) to mw.loader.register()
+ elseif ( $group === null && $source === 'local' ) {
+ $registrations[] = array( $name, $mtime, $deps );
+ }
+ // Modules with a group but no foreign source pass four arguments (name, timestamp, dependencies, group)
+ // to mw.loader.register()
+ elseif ( $source === 'local' ) {
+ $registrations[] = array( $name, $mtime, $deps, $group );
+ }
+ // Modules with a foreign source pass five arguments (name, timestamp, dependencies, group, source)
+ // to mw.loader.register()
+ else {
+ $registrations[] = array( $name, $mtime, $deps, $group, $source );
+ }
}
}
}
function getQueryInfo() {
$dbr = wfGetDB( DB_SLAVE );
$conds = array( 'rc_user > 0' ); // Users - no anons
- if( !$this->getUser()->isAllowed( 'hideuser' ) ) {
- $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0'; // don't show hidden names
- }
+ $conds[] = 'ipb_deleted IS NULL'; // don't show hidden names
$conds[] = 'rc_log_type IS NULL OR rc_log_type != ' . $dbr->addQuotes( 'newusers' );
$conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $dbr->timestamp( wfTimestamp( TS_UNIX ) - $this->RCMaxAge*24*3600 ) );
'rc_user_text', // for Pager
'user_id',
'recentedits' => 'COUNT(*)',
- 'ipb_deleted' => 'MAX(ipb_deleted)'
+ 'blocked' => 'MAX(ipb_user)'
),
'options' => array(
'GROUP BY' => array( 'rc_user_text', 'user_id' ),
'user' => array( 'INNER JOIN', 'rc_user_text=user_name' ),
'ipblocks' => array( 'LEFT JOIN', array(
'user_id=ipb_user',
- 'ipb_auto' => 0
+ 'ipb_auto' => 0,
+ 'ipb_deleted' => 1
)),
),
'conds' => $conds
$groups = $lang->commaList( $list );
$item = $lang->specialList( $ulinks, $groups );
- if( $row->ipb_deleted ) {
- $item = "<span class=\"deleted\">$item</span>";
- }
$count = $this->msg( 'activeusers-count' )->numParams( $row->recentedits )
->params( $userName )->numParams( $this->RCMaxAge )->escaped();
- $blocked = !is_null( $row->ipb_deleted ) ? ' ' . $this->msg( 'listusers-blocked', $userName )->escaped() : '';
+ $blocked = $row->blocked ? ' ' . $this->msg( 'listusers-blocked', $userName )->escaped() : '';
return Html::rawElement( 'li', array(), "{$item} [{$count}]{$blocked}" );
}
$conds = array();
// Don't show hidden names
if( !$this->getUser()->isAllowed( 'hideuser' ) ) {
- $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0';
+ $conds[] = 'ipb_deleted IS NULL';
}
$options = array();
'user_groups' => array( 'LEFT JOIN', 'user_id=ug_user' ),
'ipblocks' => array( 'LEFT JOIN', array(
'user_id=ipb_user',
+ 'ipb_deleted' => 1,
'ipb_auto' => 0
)),
),
$created = $this->msg( 'usercreated', $d, $t, $row->user_name )->escaped();
$created = ' ' . $this->msg( 'parentheses' )->rawParams( $created )->escaped();
}
- $blocked = !is_null( $row->ipb_deleted ) ? ' ' . $this->msg( 'listusers-blocked', $userName )->escaped() : '';
wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) );
- return Html::rawElement( 'li', array(), "{$item}{$edits}{$created}{$blocked}" );
+ return Html::rawElement( 'li', array(), "{$item}{$edits}{$created}" );
}
function doBatchLookups() {
* @return Array: descriptor array
*/
protected function getSourceSection() {
+ global $wgCopyUploadsFromSpecialUpload;
+
if ( $this->mSessionKey ) {
return array(
'SessionKey' => array(
);
}
- $canUploadByUrl = UploadFromUrl::isEnabled() && UploadFromUrl::isAllowed( $this->getUser() );
+ $canUploadByUrl = UploadFromUrl::isEnabled()
+ && UploadFromUrl::isAllowed( $this->getUser() )
+ && $wgCopyUploadsFromSpecialUpload;
$radio = $canUploadByUrl;
$selectedSourceType = strtolower( $this->getRequest()->getText( 'wpSourceType', 'File' ) );
'pageinfo-redirectsto-info' => 'info',
'pageinfo-contentpage' => 'Counted as a content page',
'pageinfo-contentpage-yes' => 'Yes',
+'pageinfo-protect-cascading' => 'Protections are cascading from here',
+'pageinfo-protect-cascading-yes' => 'Yes',
+'pageinfo-protect-cascading-from' => 'Protections are cascading from',
# Skin names
'skinname-standard' => 'Classic', # only translate this message to other languages if you have to change it
# Video information, used by Language::formatTimePeriod() to format lengths in the above messages
'video-dims' => '$1, $2 × $3', # only translate this message to other languages if you have to change it
-'seconds-abbrev' => '$1s', # only translate this message to other languages if you have to change it
-'minutes-abbrev' => '$1m', # only translate this message to other languages if you have to change it
-'hours-abbrev' => '$1h', # only translate this message to other languages if you have to change it
-'days-abbrev' => '$1d', # only translate this message to other languages if you have to change it
+'seconds-abbrev' => '$1 s', # only translate this message to other languages if you have to change it
+'minutes-abbrev' => '$1 min', # only translate this message to other languages if you have to change it
+'hours-abbrev' => '$1 h', # only translate this message to other languages if you have to change it
+'days-abbrev' => '$1 d', # only translate this message to other languages if you have to change it
'seconds' => '{{PLURAL:$1|$1 second|$1 seconds}}',
'minutes' => '{{PLURAL:$1|$1 minute|$1 minutes}}',
'hours' => '{{PLURAL:$1|$1 hour|$1 hours}}',
'pageinfo-redirectsto-info' => 'Text to put in parentheses for the link to the action=info of the redirect target.',
'pageinfo-contentpage' => 'Key for the row shown if this page is counted as a content page',
'pageinfo-contentpage-yes' => 'Yes, this page is a content page',
+'pageinfo-protect-cascading' => 'Key for the row which shows whether this page has cascading protection enabled',
+'pageinfo-protect-cascading-yes' => 'Yes, protections are cascading from here',
+'pageinfo-protect-cascading-from' => 'Key for a list of pages where protections are cascading from',
# Skin names
'skinname-standard' => '{{optional}}
'pageinfo-redirectsto-info',
'pageinfo-contentpage',
'pageinfo-contentpage-yes',
+ 'pageinfo-protect-cascading',
+ 'pageinfo-protect-cascading-yes',
+ 'pageinfo-protect-cascading-from',
),
'skin' => array(
'skinname-standard',
'jquery' => array(
'scripts' => 'resources/jquery/jquery.js',
'debugRaw' => false,
+ 'targets' => array( 'desktop', 'mobile' ),
),
/* jQuery Plugins */
),
'jquery.hidpi' => array(
'scripts' => 'resources/jquery/jquery.hidpi.js',
+ 'targets' => array( 'desktop', 'mobile' ),
),
'jquery.highlightText' => array(
'scripts' => 'resources/jquery/jquery.highlightText.js',
'scripts' => 'resources/mediawiki/mediawiki.js',
'debugScripts' => 'resources/mediawiki/mediawiki.log.js',
'debugRaw' => false,
+ 'targets' => array( 'desktop', 'mobile' ),
),
'mediawiki.api' => array(
'scripts' => 'resources/mediawiki.api/mediawiki.api.js',
'dependencies' => array(
'jquery.hidpi',
),
+ 'targets' => array( 'desktop', 'mobile' ),
),
'mediawiki.htmlform' => array(
'scripts' => 'resources/mediawiki/mediawiki.htmlform.js',
array(
9.45,
array(),
- '9.5s',
+ '9.5 s',
'formatTimePeriod() rounding (<10s)'
),
array(
array(
9.95,
array(),
- '10s',
+ '10 s',
'formatTimePeriod() rounding (<10s)'
),
array(
array(
59.55,
array(),
- '1m 0s',
+ '1 min 0 s',
'formatTimePeriod() rounding (<60s)'
),
array(
array(
119.55,
array(),
- '2m 0s',
+ '2 min 0 s',
'formatTimePeriod() rounding (<1h)'
),
array(
array(
3599.55,
array(),
- '1h 0m 0s',
+ '1 h 0 min 0 s',
'formatTimePeriod() rounding (<1h)'
),
array(
array(
7199.55,
array(),
- '2h 0m 0s',
+ '2 h 0 min 0 s',
'formatTimePeriod() rounding (>=1h)'
),
array(
array(
7199.55,
'avoidseconds',
- '2h 0m',
+ '2 h 0 min',
'formatTimePeriod() rounding (>=1h), avoidseconds'
),
array(
array(
7199.55,
'avoidminutes',
- '2h 0m',
+ '2 h 0 min',
'formatTimePeriod() rounding (>=1h), avoidminutes'
),
array(
array(
172799.55,
'avoidseconds',
- '48h 0m',
+ '48 h 0 min',
'formatTimePeriod() rounding (=48h), avoidseconds'
),
array(
array(
259199.55,
'avoidminutes',
- '3d 0h',
+ '3 d 0 h',
'formatTimePeriod() rounding (>48h), avoidminutes'
),
array(
array(
176399.55,
'avoidseconds',
- '2d 1h 0m',
+ '2 d 1 h 0 min',
'formatTimePeriod() rounding (>48h), avoidseconds'
),
array(
array(
176399.55,
'avoidminutes',
- '2d 1h',
+ '2 d 1 h',
'formatTimePeriod() rounding (>48h), avoidminutes'
),
array(
array(
259199.55,
'avoidseconds',
- '3d 0h 0m',
+ '3 d 0 h 0 min',
'formatTimePeriod() rounding (>48h), avoidseconds'
),
array(
array(
172801.55,
'avoidseconds',
- '2d 0h 0m',
+ '2 d 0 h 0 min',
'formatTimePeriod() rounding, (>48h), avoidseconds'
),
array(
array(
176460.55,
array(),
- '2d 1h 1m 1s',
+ '2 d 1 h 1 min 1 s',
'formatTimePeriod() rounding, recursion, (>48h)'
),
array(