Index: trunk/extensions/Translate/scripts/messageDust.php |
— | — | @@ -0,0 +1,67 @@ |
| 2 | +<?php |
| 3 | +$dir = dirname( __FILE__ ); $IP = "$dir/../.."; |
| 4 | +@include("$dir/../CorePath.php"); // Allow override |
| 5 | +require_once( "$IP/maintenance/commandLine.inc" ); |
| 6 | + |
| 7 | + |
| 8 | +$dbr = wfGetDB( DB_SLAVE ); |
| 9 | +$rows = $dbr->select( array( 'page' ), |
| 10 | + array( 'page_title', 'page_namespace' ), |
| 11 | + array( |
| 12 | + 'page_namespace' => $wgTranslateMessageNamespaces, |
| 13 | + ), |
| 14 | + __METHOD__ |
| 15 | +); |
| 16 | + |
| 17 | +$owners = array(); |
| 18 | +$keys = array(); |
| 19 | +$codes = Language::getLanguageNames(); |
| 20 | +$invalid = array(); |
| 21 | + |
| 22 | +$index = TranslateUtils::messageIndex(); |
| 23 | +foreach ( $rows as $row ) { |
| 24 | + |
| 25 | + @list( $pieces, $code ) = explode('/', $wgContLang->lcfirst($row->page_title), 2); |
| 26 | + |
| 27 | + if ( !$code ) $code = 'en'; |
| 28 | + |
| 29 | + $key = strtolower( $row->page_namespace . ':' . $pieces ); |
| 30 | + |
| 31 | + $mg = @$index[$key]; |
| 32 | + $ns = $wgContLang->getNsText( $row->page_namespace ); |
| 33 | + if ( is_null($mg) ) { |
| 34 | + $keys["$ns:$pieces"][] = $code; |
| 35 | + $owner = 'xx-unknown'; |
| 36 | + } else { |
| 37 | + $owner = $mg; |
| 38 | + } |
| 39 | + |
| 40 | + if ( !isset($codes[$code]) ) { |
| 41 | + $invalid[$code][] = "[[$ns:$pieces/$code]]"; |
| 42 | + #echo "* [[$ns:$pieces/$code]]\n"; |
| 43 | + } |
| 44 | + |
| 45 | + if ( !isset($owners[$owner]) ) $owners[$owner] = 0; |
| 46 | + $owners[$owner]++; |
| 47 | +} |
| 48 | +$rows->free(); |
| 49 | + |
| 50 | +ksort( $owners ); |
| 51 | + |
| 52 | +echo "==Invalid language codes==\n" . implode( ', ', array_keys( $invalid ) ) . "\n"; |
| 53 | +foreach ( $invalid as $key => $pages ) { |
| 54 | + echo "# $key: " . implode( ', ', $pages ) . "\n"; |
| 55 | +} |
| 56 | +echo "\n==Messages claimed==\n"; |
| 57 | + |
| 58 | + |
| 59 | +foreach ( $owners as $o => $count ) { |
| 60 | + echo "# $o: $count\n"; |
| 61 | +} |
| 62 | + |
| 63 | +echo "\n==Unclaimed messages==\n"; |
| 64 | + |
| 65 | +foreach ( $keys as $page => $langs ) { |
| 66 | + echo "* $page: " . implode( ', ', $langs ) . "\n"; |
| 67 | +} |
| 68 | + |
Property changes on: trunk/extensions/Translate/scripts/messageDust.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 69 | + native |
Added: svn:executable |
2 | 70 | + * |