Index: trunk/phase3/maintenance/tests/phpunit/includes/IPTest.php |
— | — | @@ -140,4 +140,14 @@ |
141 | 141 | $this->assertNet( '10.128.0.0' , '10.135.0.0/9' ); |
142 | 142 | $this->assertNet( '134.0.0.0' , '134.0.5.1/8' ); |
143 | 143 | } |
| 144 | + |
| 145 | + function testIPv6SpecialRanges() { |
| 146 | + $this->assertTrue( IPv6::isULA( 'fdc1:9d57:401e::' ) ); |
| 147 | + $this->assertTrue( IPv6::isULA( 'FDC1:9D57:401E::' ) ); |
| 148 | + $this->assertTrue( IPv6::isULA( 'fc::' ) ); |
| 149 | + $this->assertTrue( IPv6::isULA( 'fdff:ffff:ffff::' ) ); |
| 150 | + |
| 151 | + $this->assertFalse( IPv6::isULA( '2001:0DB8::A:1::' ) ); |
| 152 | + $this->assertFalse( IPv6::isULA( '::1' ) ); |
| 153 | + } |
144 | 154 | } |
Index: trunk/phase3/maintenance/Maintenance.php |
— | — | @@ -633,44 +633,56 @@ |
634 | 634 | * @param $force boolean Whether to force the help to show, default false |
635 | 635 | */ |
636 | 636 | protected function maybeHelp( $force = false ) { |
| 637 | + if( !$force && !$this->hasOption( 'help' ) ) { |
| 638 | + return; |
| 639 | + } |
| 640 | + |
637 | 641 | $screenWidth = 80; // TODO: Caculate this! |
638 | 642 | $tab = " "; |
639 | 643 | $descWidth = $screenWidth - ( 2 * strlen( $tab ) ); |
640 | 644 | |
641 | 645 | ksort( $this->mParams ); |
642 | | - if ( $this->hasOption( 'help' ) || $force ) { |
643 | | - $this->mQuiet = false; |
| 646 | + $this->mQuiet = false; |
644 | 647 | |
645 | | - if ( $this->mDescription ) { |
646 | | - $this->output( "\n" . $this->mDescription . "\n" ); |
| 648 | + // Description ... |
| 649 | + if ( $this->mDescription ) { |
| 650 | + $this->output( "\n" . $this->mDescription . "\n" ); |
| 651 | + } |
| 652 | + $output = "\nUsage: php " . basename( $this->mSelf ); |
| 653 | + |
| 654 | + // ... append parameters ... |
| 655 | + if ( $this->mParams ) { |
| 656 | + $output .= " [--" . implode( array_keys( $this->mParams ), "|--" ) . "]"; |
| 657 | + } |
| 658 | + |
| 659 | + // ... and append arguments. |
| 660 | + if ( $this->mArgList ) { |
| 661 | + $output .= " <"; |
| 662 | + foreach ( $this->mArgList as $k => $arg ) { |
| 663 | + $output .= $arg['name'] . ">"; |
| 664 | + if ( $k < count( $this->mArgList ) - 1 ) |
| 665 | + $output .= " <"; |
647 | 666 | } |
648 | | - $output = "\nUsage: php " . basename( $this->mSelf ); |
649 | | - if ( $this->mParams ) { |
650 | | - $output .= " [--" . implode( array_keys( $this->mParams ), "|--" ) . "]"; |
651 | | - } |
652 | | - if ( $this->mArgList ) { |
653 | | - $output .= " <"; |
654 | | - foreach ( $this->mArgList as $k => $arg ) { |
655 | | - $output .= $arg['name'] . ">"; |
656 | | - if ( $k < count( $this->mArgList ) - 1 ) |
657 | | - $output .= " <"; |
658 | | - } |
659 | | - } |
660 | | - $this->output( "$output\n" ); |
661 | | - foreach ( $this->mParams as $par => $info ) { |
662 | | - $this->output( |
663 | | - wordwrap( "$tab$par : " . $info['desc'], $descWidth, |
664 | | - "\n$tab$tab" ) . "\n" |
665 | | - ); |
666 | | - } |
667 | | - foreach ( $this->mArgList as $info ) { |
668 | | - $this->output( |
669 | | - wordwrap( "$tab<" . $info['name'] . "> : " . |
670 | | - $info['desc'], $descWidth, "\n$tab$tab" ) . "\n" |
671 | | - ); |
672 | | - } |
673 | | - die( 1 ); |
674 | 667 | } |
| 668 | + $this->output( "$output\n\n" ); |
| 669 | + |
| 670 | + // Parameters description |
| 671 | + foreach ( $this->mParams as $par => $info ) { |
| 672 | + $this->output( |
| 673 | + wordwrap( "$tab--$par: " . $info['desc'], $descWidth, |
| 674 | + "\n$tab$tab" ) . "\n" |
| 675 | + ); |
| 676 | + } |
| 677 | + |
| 678 | + // Arguments description |
| 679 | + foreach ( $this->mArgList as $info ) { |
| 680 | + $this->output( |
| 681 | + wordwrap( "$tab<" . $info['name'] . ">: " . |
| 682 | + $info['desc'], $descWidth, "\n$tab$tab" ) . "\n" |
| 683 | + ); |
| 684 | + } |
| 685 | + |
| 686 | + die( 1 ); |
675 | 687 | } |
676 | 688 | |
677 | 689 | /** |