addDescription( "Counts the number of fancy captchas in storage" ); $this->addOption( 'captchastoragedir', 'Overrides the value of $wgCaptchaStorageDirectory', false, true ); $this->requireExtension( "FancyCaptcha" ); } public function execute() { $instance = Hooks::getInstance(); if ( !( $instance instanceof FancyCaptcha ) ) { $this->fatalError( "\$wgCaptchaClass is not FancyCaptcha.\n", 1 ); } // Overrides $wgCaptchaStorageDirectory for this script run if ( $this->hasOption( 'captchastoragedir' ) ) { global $wgCaptchaStorageDirectory; $wgCaptchaStorageDirectory = $this->getOption( 'captchastoragedir' ); } $countAct = $instance->getCaptchaCount(); $this->output( "Current number of stored captchas is $countAct.\n" ); } } $maintClass = CountFancyCaptchas::class; require_once RUN_MAINTENANCE_IF_MAIN;