Merge "Add numeral conversion for Saraiki"
[lhc/web/wiklou.git] / maintenance / orphans.php
index 7acf6d8..d7decc1 100644 (file)
@@ -108,13 +108,20 @@ class Orphans extends Maintenance {
                        foreach ( $result as $row ) {
                                $comment = $commentStore->getComment( 'rev_comment', $row )->text;
                                if ( $comment !== '' ) {
-                                       $comment = '(' . $wgContLang->truncate( $comment, 40 ) . ')';
+                                       $comment = '(' . $wgContLang->truncateForVisual( $comment, 40 ) . ')';
                                }
-                               $this->output( sprintf( "%10d %10d %14s %20s %s\n",
+                               $rev_user_text = $wgContLang->truncateForVisual( $row->rev_user_text, 20 );
+                               # pad $rev_user_text to 20 characters.  Note that this may
+                               # yield poor results if $rev_user_text contains combining
+                               # or half-width characters.  Alas.
+                               if ( mb_strlen( $rev_user_text ) < 20 ) {
+                                       $rev_user_text = str_repeat( ' ', 20 - mb_strlen( $rev_user_text ) );
+                               }
+                               $this->output( sprintf( "%10d %10d %14s %s %s\n",
                                        $row->rev_id,
                                        $row->rev_page,
                                        $row->rev_timestamp,
-                                       $wgContLang->truncate( $row->rev_user_text, 17 ),
+                                       $rev_user_text,
                                        $comment ) );
                                if ( $fix ) {
                                        $dbw->delete( 'revision', [ 'rev_id' => $row->rev_id ] );