mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-23 15:56:50 +00:00
MWException -> Exception
Change-Id: I816b62c93e4eb08514b122add614f5457d6fad9a
This commit is contained in:
parent
b0678d96dd
commit
ce20b1cef8
|
@ -36,7 +36,7 @@ abstract class CaptchaStore {
|
||||||
/**
|
/**
|
||||||
* Get somewhere to store captcha data that will persist between requests
|
* Get somewhere to store captcha data that will persist between requests
|
||||||
*
|
*
|
||||||
* @throws MWException
|
* @throws Exception
|
||||||
* @return CaptchaStore
|
* @return CaptchaStore
|
||||||
*/
|
*/
|
||||||
public final static function get() {
|
public final static function get() {
|
||||||
|
@ -45,7 +45,7 @@ abstract class CaptchaStore {
|
||||||
if ( in_array( 'CaptchaStore', class_parents( $wgCaptchaStorageClass ) ) ) {
|
if ( in_array( 'CaptchaStore', class_parents( $wgCaptchaStorageClass ) ) ) {
|
||||||
self::$instance = new $wgCaptchaStorageClass;
|
self::$instance = new $wgCaptchaStorageClass;
|
||||||
} else {
|
} else {
|
||||||
throw new MWException( "Invalid CaptchaStore class $wgCaptchaStorageClass" );
|
throw new Exception( "Invalid CaptchaStore class $wgCaptchaStorageClass" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self::$instance;
|
return self::$instance;
|
||||||
|
|
|
@ -122,4 +122,4 @@ $specialPageAliases['zh-hans'] = array(
|
||||||
/** Traditional Chinese (中文(繁體)) */
|
/** Traditional Chinese (中文(繁體)) */
|
||||||
$specialPageAliases['zh-hant'] = array(
|
$specialPageAliases['zh-hant'] = array(
|
||||||
'Captcha' => array( '驗證碼' ),
|
'Captcha' => array( '驗證碼' ),
|
||||||
);
|
);
|
||||||
|
|
|
@ -159,7 +159,7 @@ class FancyCaptcha extends SimpleCaptcha {
|
||||||
function getCaptchaIndex() {
|
function getCaptchaIndex() {
|
||||||
$info = $this->pickImage();
|
$info = $this->pickImage();
|
||||||
if ( !$info ) {
|
if ( !$info ) {
|
||||||
throw new MWException( "Ran out of captcha images" );
|
throw new Exception( "Ran out of captcha images" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a random key for use of this captcha image in this session.
|
// Generate a random key for use of this captcha image in this session.
|
||||||
|
@ -363,13 +363,13 @@ class FancyCaptcha extends SimpleCaptcha {
|
||||||
/**
|
/**
|
||||||
* @param $basename string
|
* @param $basename string
|
||||||
* @return Array (salt, hash)
|
* @return Array (salt, hash)
|
||||||
* @throws MWException
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function hashFromImageName( $basename ) {
|
public function hashFromImageName( $basename ) {
|
||||||
if ( preg_match( '/^image_([0-9a-f]+)_([0-9a-f]+)\\.png$/', $basename, $matches ) ) {
|
if ( preg_match( '/^image_([0-9a-f]+)_([0-9a-f]+)\\.png$/', $basename, $matches ) ) {
|
||||||
return array( $matches[1], $matches[2] );
|
return array( $matches[1], $matches[2] );
|
||||||
} else {
|
} else {
|
||||||
throw new MWException( "Invalid filename '$basename'.\n" );
|
throw new Exception( "Invalid filename '$basename'.\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ class MathCaptcha extends SimpleCaptcha {
|
||||||
if ( class_exists( 'MathRenderer' ) ) {
|
if ( class_exists( 'MathRenderer' ) ) {
|
||||||
$math = MathRenderer::getRenderer( $sum, array(), MW_MATH_PNG );
|
$math = MathRenderer::getRenderer( $sum, array(), MW_MATH_PNG );
|
||||||
} else {
|
} else {
|
||||||
throw new MWException( 'MathCaptcha requires the Math extension for MediaWiki versions 1.18 and above.' );
|
throw new Exception( 'MathCaptcha requires the Math extension for MediaWiki versions 1.18 and above.' );
|
||||||
}
|
}
|
||||||
$html = $math->render();
|
$html = $math->render();
|
||||||
return preg_replace( '/alt=".*?"/', '', $html );
|
return preg_replace( '/alt=".*?"/', '', $html );
|
||||||
|
|
Loading…
Reference in a new issue