Awight has uploaded a new change for review. https://gerrit.wikimedia.org/r/247184
Change subject: Cleanup ...................................................................... Cleanup Change-Id: I4f57a5a06853345f34623f12b06cef06f8c1fd15 --- M includes/Hooks.php 1 file changed, 35 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES refs/changes/84/247184/1 diff --git a/includes/Hooks.php b/includes/Hooks.php index 40b9ec2..d463400 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -12,14 +12,25 @@ use RCCacheEntry; use RecentChange; +/** + * TODO: + * - Fix mw-core EnhancedChangesList::recentChangesBlockGroup to rollup + * extension recentChangesFlags into the top-level grouped line. + * - Fix mw-core "old" recent changes view to respect recentChangesFlags. + */ class Hooks { /** * @param DatabaseUpdater $updater */ public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) { $updater->addExtensionTable( 'ores_classification', __DIR__ . '/../ores.sql' ); + + return true; } + /** + * Ask the ORES server for scores on this recent change + */ public static function onRecentChange_save( RecentChange $rc ) { if ( $rc->getAttribute( 'rc_type' ) === RC_EDIT ) { $job = new FetchScoreJob( $rc->getTitle(), array( @@ -27,9 +38,13 @@ ) ); JobQueueGroup::singleton()->push( $job ); } + + return true; } /** + * Add an ORES filter to the recent changes results + * * @param ChangesListSpecialPage $clsp * @param $filters */ @@ -38,9 +53,13 @@ 'msg' => 'ores-reverted-filter', 'default' => false, ); + + return true; } /** + * Pull in ORES score columns during recent changes queries + * * @param $name * @param array $tables * @param array $fields @@ -54,15 +73,22 @@ array &$query_options, array &$join_conds, FormOptions $opts ) { if ( !$opts->getValue( 'hidereverted' ) ) { - $tables[] = 'ores_classification'; - $fields[] = 'ores_probability'; - $join_conds['ores_classification'] = array( 'LEFT JOIN', - 'rc_this_oldid = ores_rev AND ores_model = \'reverted\' ' . - 'AND ores_is_predicted = 1 AND ores_class = \'true\'' ); + // Don't bother querying ORES predictions when the information is hidden. + return; } + + $tables[] = 'ores_classification'; + $fields[] = 'ores_probability'; + $join_conds['ores_classification'] = array( 'LEFT JOIN', + 'rc_this_oldid = ores_rev AND ores_model = \'reverted\' ' . + 'AND ores_is_predicted = 1 AND ores_class = \'true\'' ); + + return true; } /** + * Label recent changes with ORES scores (for each change in an expanded group) + * * @param EnhancedChangesList $ecl * @param array $data * @param RCCacheEntry[] $block @@ -81,9 +107,12 @@ $ecl->getOutput()->addModuleStyles( 'ext.ores.styles' ); } } + return true; } /** + * Label recent changes with ORES scores (for top-level ungrouped lines) + * * @param EnhancedChangesList $ecl * @param array $data * @param RCCacheEntry $rcObj @@ -101,6 +130,7 @@ $ecl->getOutput()->addModuleStyles( 'ext.ores.styles' ); } } + return true; } // FIXME: Repeated code. -- To view, visit https://gerrit.wikimedia.org/r/247184 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4f57a5a06853345f34623f12b06cef06f8c1fd15 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ORES Gerrit-Branch: master Gerrit-Owner: Awight <awi...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits