New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update AdminScoreController.php #25
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,9 +62,9 @@ public function resultAction($project, $username) | |
|
||
$userTable = $lh->getTable("user", $dbName); | ||
$pageTable = $lh->getTable("page", $dbName); | ||
$loggingTable = $lh->getTable("logging", $dbName); | ||
$revisionTable = $lh->getTable("revision", $dbName); | ||
$archiveTable = $lh->getTable("archive", $dbName); | ||
$loggingTable = $lh->getTable("logging_userindex", $dbName); | ||
$revisionTable = $lh->getTable("revision_userindex", $dbName); | ||
$archiveTable = $lh->getTable("archive_userindex", $dbName); | ||
|
||
// MULTIPLIERS (to review) | ||
$ACCT_AGE_MULT = 1.25; # 0 if = 365 jours | ||
|
@@ -105,8 +105,10 @@ public function resultAction($project, $username) | |
AND log_namespace=0 | ||
AND log_deleted=0 and log_user_text=:username | ||
UNION | ||
SELECT 'blocks' as source, COUNT(*) as value FROM $loggingTable | ||
WHERE log_type='block' AND log_action='block' AND log_namespace=2 AND log_deleted=0 AND log_title=:username | ||
SELECT 'blocks' as source, COUNT(*) as value FROM $loggingTable l | ||
INNER JOIN $userTable u ON l.log_user = u.user_id | ||
WHERE l.log_type='block' AND l.log_action='block' | ||
AND l.log_namespace=2 AND l.log_deleted=0 AND u.user_name=:username | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So... you attempt to make this more efficient by adding another Join - which is a slow and heavy process. That makes absolutely no sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using the "log_user" column in the query makes it better despite adding another join. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I'm convinced. Please fix my other comment and we'll give this the thumbs up. To clarify my other comment - in order to access a table you use the MediaWiki table rather than the labs table. We then map it using app/config/table_map.yml There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 from me. The new query definitely runs significantly faster, at around 21.73 sec run time with one test I did. The same test took over 3 minutes with the old query, I just ended up killing it. Indeed Matthew is right however that we have a table mapping system in place. All you need to know is to pass the normal table name to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure what you mean. Is there any chance you can make the necessary changes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. I'll merge then fix it up. Thank you for this pull request 😄 |
||
UNION | ||
SELECT 'afd' as source, COUNT(*) as value FROM $revisionTable | ||
WHERE rev_page LIKE 'Articles for deletion/%' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You just broke backwards compatibility with all versions of MediaWiki. There's a reason we go through the labs helper - specifically to allow for a table mapping.
That should be documented better on my side, which is a separate issue.