Amire80 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/261179

Change subject: Add a script to print the number of translations in each 
language
......................................................................

Add a script to print the number of translations in each language

This is a simplistic way to address Bug T117846 - to see the number
of articles created in a given month in each language in order
to compare it with the number of the articles deleted in the same
month.

Bug: T117846
Change-Id: Ie5ec6412ec4fe8da3a0ca0381dc2c25ae9452a41
---
A scripts/daily-stats/count_monthly_creation.sh
1 file changed, 31 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/79/261179/1

diff --git a/scripts/daily-stats/count_monthly_creation.sh 
b/scripts/daily-stats/count_monthly_creation.sh
new file mode 100755
index 0000000..32c6e07
--- /dev/null
+++ b/scripts/daily-stats/count_monthly_creation.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# This script prints the number of translated articles created in a month
+# in a list of languages.
+# It only outputs the numbers in the order of the language codes.
+
+month=$1
+if [ -z "$month" ]; then
+       month=`date --date='-1 month' +%Y%m`
+fi
+
+language_list=$2
+if [ -z "$language_list" ]; then
+       language_list=`cat language_list.txt`
+fi
+
+echo "Articles created in $month"
+
+for language in $language_list
+do
+       if [ "$language" == "no" ]; then
+               # Headdesk. https://phabricator.wikimedia.org/T122497
+               language_clause="translation_target_language in ('no', 'nb')"
+       else
+               language_clause="translation_target_language = '$language'"
+       fi
+
+       query="SELECT COUNT(*) FROM cx_translations WHERE (translation_status = 
'published' OR translation_target_url IS NOT NULL) AND 
translation_last_updated_timestamp LIKE '$month%' AND $language_clause;"
+
+       sql enwiki -h db1029 -D wikishared -e "$query" | grep "[0-9]"
+done

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5ec6412ec4fe8da3a0ca0381dc2c25ae9452a41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to