Add new variable article_first_contributor

Bug: 67793
Change-Id: I725b7150de52bdc6518f73a6302f850e8d596824
This commit is contained in:
Liangent 2014-07-09 16:58:07 +00:00
parent 0d74309d09
commit a86019d2d3
4 changed files with 21 additions and 1 deletions

View file

@ -123,6 +123,7 @@ class AbuseFilter {
'article_restrictions_create' => 'restrictions-create',
'article_restrictions_upload' => 'restrictions-upload',
'article_recent_contributors' => 'recent-contributors',
'article_first_contributor' => 'first-contributor',
# 'old_text' => 'old-text-stripped', # Disabled, performance
# 'old_html' => 'old-html', # Disabled, performance
'old_links' => 'old-links',
@ -342,6 +343,12 @@ class AbuseFilter {
'namespace' => $title->getNamespace()
) );
$vars->setLazyLoadVar( "{$prefix}_first_contributor", 'load-first-author',
array(
'title' => $title->getText(),
'namespace' => $title->getNamespace()
) );
wfRunHooks( 'AbuseFilter-generateTitleVars', array( $vars, $title, $prefix ) );
return $vars;

View file

@ -503,6 +503,17 @@ class AFComputedVariable {
$users[] = $row->rev_user_text;
}
$result = $users;
break;
case 'load-first-author':
$title = Title::makeTitle( $parameters['namespace'], $parameters['title'] );
$revision = $title->getFirstRevision();
if ( $revision ) {
$result = $revision->getUserText();
} else {
$result = '';
}
break;
case 'get-page-restrictions':
$action = $parameters['action'];

View file

@ -264,6 +264,7 @@
"abusefilter-edit-builder-vars-user-blocked": "Whether user is blocked",
"abusefilter-edit-builder-vars-user-emailconfirm": "Time email address was confirmed",
"abusefilter-edit-builder-vars-recent-contributors": "Last ten users to contribute to the page",
"abusefilter-edit-builder-vars-first-contributor": "First user to contribute to the page",
"abusefilter-edit-builder-vars-all-links": "All external links in the new text",
"abusefilter-edit-builder-vars-added-links": "All external links added in the edit",
"abusefilter-edit-builder-vars-removed-links": "All external links removed in the edit",
@ -394,4 +395,4 @@
"abusefilter-import-submit": "Import data",
"abusefilter-group-default": "Default",
"abusefilter-http-error": "An HTTP error occurred: $1."
}
}

View file

@ -284,6 +284,7 @@
"abusefilter-edit-builder-vars-user-groups": "See also:\n* {{msg-mw|Abusefilter-edit-builder-vars-global-user-groups}}",
"abusefilter-edit-builder-vars-user-rights": "Paraphrased: List of rights that the user has. Abuse filter syntax option in a dropdown from the group {{msg-mw|abusefilter-edit-builder-group-vars}}.",
"abusefilter-edit-builder-vars-user-blocked": "Paraphrased: Boolean value on whether the user is blocked. Abuse filter syntax option in a dropdown from the group {{msg-mw|abusefilter-edit-builder-group-vars}}.",
"abusefilter-edit-builder-vars-first-contributor": "Paraphrased: The user who created the earliest revision of the page. Abuse filter syntax option in a dropdown from the group {{msg-mw|abusefilter-edit-builder-group-vars}}.",
"abusefilter-edit-builder-vars-new-pst": "Paraphrased: The output wikitext after pre-save transform is applied to new_wikitext. Abuse filter syntax option in a dropdown from the group {{msg-mw|abusefilter-edit-builder-group-vars}}.",
"abusefilter-edit-builder-vars-diff-pst": "Paraphrased: Edit diff of new_pst against old_wikitext. Abuse filter syntax option in a dropdown from the group {{msg-mw|abusefilter-edit-builder-group-vars}}.",
"abusefilter-edit-builder-vars-addedlines-pst": "Paraphrased: Added lines in edit_diff_pst. Abuse filter syntax option in a dropdown from the group {{msg-mw|abusefilter-edit-builder-group-vars}}.",