Add option to populateChangeTagDef not to update the count
[lhc/web/wiklou.git] / maintenance / createCommonPasswordCdb.php
index f7e0c0f..0aa8ce8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Create serialized/commonpasswords.cdb
+ * Generate includes/password/commonpasswords.cdb
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -31,11 +31,11 @@ require_once __DIR__ . '/Maintenance.php';
  * For example:
  * https://github.com/danielmiessler/SecLists/blob/fe2b40dd84/Passwords/rockyou.txt?raw=true
  *
- * @see serialized/commonpasswords.cdb and PasswordPolicyChecks::checkPopularPasswordBlacklist
+ * @see PasswordPolicyChecks::checkPopularPasswordBlacklist
  * @since 1.27
  * @ingroup Maintenance
  */
-class GenerateCommonPassword extends Maintenance {
+class CreateCommonPasswordCdb extends Maintenance {
        public function __construct() {
                global $IP;
                parent::__construct();
@@ -44,7 +44,7 @@ class GenerateCommonPassword extends Maintenance {
                $this->addArg( 'inputfile', 'List of passwords (one per line) to use or - for stdin', true );
                $this->addArg(
                        'output',
-                       "Location to write CDB file to (Try $IP/serialized/commonpasswords.cdb)",
+                       "Location to write CDB file to (Try $IP/includes/password/commonpasswords.cdb)",
                        true
                );
        }
@@ -60,12 +60,12 @@ class GenerateCommonPassword extends Maintenance {
                $outfile = $this->getArg( 1 );
 
                if ( !is_readable( $infile ) && $infile !== 'php://stdin' ) {
-                       $this->error( "Cannot open input file $infile for reading", 1 );
+                       $this->fatalError( "Cannot open input file $infile for reading" );
                }
 
                $file = fopen( $infile, 'r' );
                if ( $file === false ) {
-                       $this->error( "Cannot read input file $infile", 1 );
+                       $this->fatalError( "Cannot read input file $infile" );
                }
 
                try {
@@ -109,10 +109,10 @@ class GenerateCommonPassword extends Maintenance {
                                " (out of $i) passwords to $outfile\n"
                        );
                } catch ( \Cdb\Exception $e ) {
-                       $this->error( "Error writing cdb file: " . $e->getMessage(), 2 );
+                       $this->fatalError( "Error writing cdb file: " . $e->getMessage(), 2 );
                }
        }
 }
 
-$maintClass = "GenerateCommonPassword";
+$maintClass = CreateCommonPasswordCdb::class;
 require_once RUN_MAINTENANCE_IF_MAIN;