+ private function setDbPassOption() {
+ $dbpassfile = $this->getOption( 'dbpassfile' );
+ if ( $dbpassfile !== null ) {
+ if ( $this->getOption( 'dbpass' ) !== null ) {
+ $this->error( 'WARNING: You have provided the options "dbpass" and "dbpassfile". '
+ . 'The content of "dbpassfile" overrides "dbpass".' );
+ }
+ MediaWiki\suppressWarnings();
+ $dbpass = file_get_contents( $dbpassfile ); // returns false on failure
+ MediaWiki\restoreWarnings();
+ if ( $dbpass === false ) {
+ $this->error( "Couldn't open $dbpassfile", true );
+ }
+ $this->mOptions['dbpass'] = trim( $dbpass, "\r\n" );
+ }
+ }
+
+ private function setPassOption() {
+ $passfile = $this->getOption( 'passfile' );
+ if ( $passfile !== null ) {
+ if ( $this->getOption( 'pass' ) !== null ) {
+ $this->error( 'WARNING: You have provided the options "pass" and "passfile". '
+ . 'The content of "passfile" overrides "pass".' );
+ }
+ MediaWiki\suppressWarnings();
+ $pass = file_get_contents( $passfile ); // returns false on failure
+ MediaWiki\restoreWarnings();
+ if ( $pass === false ) {
+ $this->error( "Couldn't open $passfile", true );
+ }
+ $this->mOptions['pass'] = trim( $pass, "\r\n" );
+ } elseif ( $this->getOption( 'pass' ) === null ) {
+ $this->error( 'You need to provide the option "pass" or "passfile"', true );
+ }
+ }
+