[MediaWiki-commits] [Gerrit] mediawiki...ORES[master]: Draftquality model work only on main namespace

2017-10-13 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/383814 )

Change subject: Draftquality model work only on main namespace
..


Draftquality model work only on main namespace

Otherwise it'll be a mess, it's configurable to add other ns.

Bug: T176183
Change-Id: Ia6edec439d9cf037888ed71257a86df964482fb8
---
M extension.json
M includes/Hooks.php
2 files changed, 6 insertions(+), 3 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/extension.json b/extension.json
index 72b4cf9..d6b1f1e 100644
--- a/extension.json
+++ b/extension.json
@@ -183,6 +183,7 @@
"_merge_strategy": "array_plus_2d"
},
"OresEnabledNamespaces": {},
+   "OresDraftQualityNS": { "0": true },
"OresWikiId": null,
"@OresRevisionsPerBatch": "Number of revisions to fetch scores 
for from the ORES API per request when the MediaWiki API is asked to score 
revisions which are not cached. Set to 0 to disable fetching (scores will still 
be fetched for new edits).",
"OresRevisionsPerBatch": 30,
diff --git a/includes/Hooks.php b/includes/Hooks.php
index dd14548..96f7223 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -58,7 +58,7 @@
 * @param RecentChange $rc
 */
public static function onRecentChange_save( RecentChange $rc ) {
-   global $wgOresExcludeBots, $wgOresEnabledNamespaces, 
$wgOresModels;
+   global $wgOresExcludeBots, $wgOresEnabledNamespaces, 
$wgOresModels, $wgOresDraftQualityNS;
if ( $rc->getAttribute( 'rc_bot' ) && $wgOresExcludeBots ) {
return;
}
@@ -75,8 +75,10 @@
$rc_type = $rc->getAttribute( 'rc_type' );
$models = array_keys( array_filter( $wgOresModels ) );
if ( $rc_type === RC_EDIT || $rc_type === RC_NEW ) {
-   // Do not store draftquality data when it's not a new 
page
-   if ( $rc_type !== RC_NEW ) {
+   // Do not store draftquality data when it's not a new 
page in article or draft ns
+   if ( $rc_type !== RC_NEW ||
+   !( isset( $wgOresDraftQualityNS[$ns] ) && 
$wgOresDraftQualityNS[$ns] )
+   ) {
$models = array_diff( $models, [ 'draftquality' 
] );
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/383814
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia6edec439d9cf037888ed71257a86df964482fb8
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup 
Gerrit-Reviewer: Awight 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: Kaldari 
Gerrit-Reviewer: Niharika29 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...ORES[master]: Draftquality model work only on main namespace

2017-10-12 Thread Ladsgroup (Code Review)
Ladsgroup has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383814 )

Change subject: Draftquality model work only on main namespace
..

Draftquality model work only on main namespace

Otherwise it'll be a mess, it's configurable to add other ns.

Bug: T176183
Change-Id: Ia6edec439d9cf037888ed71257a86df964482fb8
---
M extension.json
M includes/Hooks.php
2 files changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES 
refs/changes/14/383814/1

diff --git a/extension.json b/extension.json
index 72b4cf9..e42c049 100644
--- a/extension.json
+++ b/extension.json
@@ -183,6 +183,7 @@
"_merge_strategy": "array_plus_2d"
},
"OresEnabledNamespaces": {},
+   "OresDraftQualityNS": { 0: true },
"OresWikiId": null,
"@OresRevisionsPerBatch": "Number of revisions to fetch scores 
for from the ORES API per request when the MediaWiki API is asked to score 
revisions which are not cached. Set to 0 to disable fetching (scores will still 
be fetched for new edits).",
"OresRevisionsPerBatch": 30,
diff --git a/includes/Hooks.php b/includes/Hooks.php
index dd14548..96f7223 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -58,7 +58,7 @@
 * @param RecentChange $rc
 */
public static function onRecentChange_save( RecentChange $rc ) {
-   global $wgOresExcludeBots, $wgOresEnabledNamespaces, 
$wgOresModels;
+   global $wgOresExcludeBots, $wgOresEnabledNamespaces, 
$wgOresModels, $wgOresDraftQualityNS;
if ( $rc->getAttribute( 'rc_bot' ) && $wgOresExcludeBots ) {
return;
}
@@ -75,8 +75,10 @@
$rc_type = $rc->getAttribute( 'rc_type' );
$models = array_keys( array_filter( $wgOresModels ) );
if ( $rc_type === RC_EDIT || $rc_type === RC_NEW ) {
-   // Do not store draftquality data when it's not a new 
page
-   if ( $rc_type !== RC_NEW ) {
+   // Do not store draftquality data when it's not a new 
page in article or draft ns
+   if ( $rc_type !== RC_NEW ||
+   !( isset( $wgOresDraftQualityNS[$ns] ) && 
$wgOresDraftQualityNS[$ns] )
+   ) {
$models = array_diff( $models, [ 'draftquality' 
] );
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/383814
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6edec439d9cf037888ed71257a86df964482fb8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits