Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/184021
Change subject: MWException -> Exception ...................................................................... MWException -> Exception Change-Id: I51f533ebaf94704d4c58bd99245de2fbeebfd60c --- M CentralNotice.alias.php M api/ApiCentralNoticeBannerChoiceData.php M includes/Banner.php M includes/BannerAllocationCalculator.php M includes/BannerChoiceDataProvider.php M includes/BannerMessage.php M includes/BannerMessageGroup.php M includes/CNCampaignPager.php M includes/CNDeviceTarget.php M includes/Campaign.php M includes/HtmlFormElements/HTMLCentralNoticeBanner.php M includes/HtmlFormElements/HTMLCentralNoticeBannerMessage.php M includes/MixinController.php M special/SpecialBannerLoader.php M special/SpecialCentralNoticeBanners.php M tests/CNTestFixturesResourceLoaderModule.php 16 files changed, 31 insertions(+), 31 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice refs/changes/21/184021/1 diff --git a/CentralNotice.alias.php b/CentralNotice.alias.php index 9b94c10..1a8ee90 100644 --- a/CentralNotice.alias.php +++ b/CentralNotice.alias.php @@ -434,4 +434,4 @@ 'BannerRandom' => array( '隨機橫幅' ), 'RecordImpression' => array( '記錄印象' ), 'HideBanners' => array( '隱藏橫幅' ), -); \ No newline at end of file +); diff --git a/api/ApiCentralNoticeBannerChoiceData.php b/api/ApiCentralNoticeBannerChoiceData.php index b73d1c5..71a5bec 100644 --- a/api/ApiCentralNoticeBannerChoiceData.php +++ b/api/ApiCentralNoticeBannerChoiceData.php @@ -63,4 +63,4 @@ => 'apihelp-centralnoticebannerchoicedata-example-1' ); } -} \ No newline at end of file +} diff --git a/includes/Banner.php b/includes/Banner.php index 7af0f72..2a02008 100644 --- a/includes/Banner.php +++ b/includes/Banner.php @@ -579,7 +579,7 @@ * @param array $mixins Names of mixins to enable on this banner. Valid values * come from @see $wgNoticeMixins * - * @throws MWException + * @throws Exception * @return $this */ function setMixins( $mixins ) { @@ -597,7 +597,7 @@ $this->mixins = array(); foreach ( $mixins as $mixin ) { if ( !array_key_exists( $mixin, $wgNoticeMixins ) ) { - throw new MWException( "Mixin does not exist: {$mixin}" ); + throw new Exception( "Mixin does not exist: {$mixin}" ); } $this->mixins[$mixin] = $wgNoticeMixins[$mixin]; } @@ -608,7 +608,7 @@ /** * Populates mixin data from the cn_template_mixins table. * - * @throws MWException + * @throws Exception */ protected function populateMixinData() { global $wgNoticeMixins; @@ -1127,7 +1127,7 @@ $res = $dbr->select( 'cn_assignments', 'asn_id', array( 'tmp_id' => $id ), __METHOD__ ); if ( $dbr->numRows( $res ) > 0 ) { - throw new MWException( 'Cannot remove a template still bound to a campaign!' ); + throw new Exception( 'Cannot remove a template still bound to a campaign!' ); } else { // Log the removal of the banner // FIXME: this log line will display changes with inverted sense @@ -1175,13 +1175,13 @@ * @param integer $revisionId ID of the revision * @param integer $pageId ID of the MediaWiki page for the banner * @param string $bannerId ID of banner this revtag belongs to - * @throws MWException + * @throws Exception */ static function addTag( $tag, $revisionId, $pageId, $bannerId ) { $dbw = CNDatabase::getDb(); if ( is_object( $revisionId ) ) { - throw new MWException( 'Got object, excepted id' ); + throw new Exception( 'Got object, excepted id' ); } // There should only ever be one tag applied to a banner object @@ -1204,7 +1204,7 @@ * Make sure banner is not tagged with specified tag * @param string $tag The name of the tag * @param integer $pageId ID of the MediaWiki page for the banner - * @throws MWException + * @throws Exception */ static protected function removeTag( $tag, $pageId ) { $dbw = CNDatabase::getDb(); @@ -1300,7 +1300,7 @@ static function getBannerSettings( $bannerName, $detailed = true ) { $banner = Banner::fromName( $bannerName ); if ( !$banner->exists() ) { - throw new MWException( "Banner doesn't exist!" ); + throw new Exception( "Banner doesn't exist!" ); } $details = array( @@ -1518,6 +1518,6 @@ } } -class BannerDataException extends MWException {} +class BannerDataException extends Exception {} class BannerContentException extends BannerDataException {} class BannerExistenceException extends BannerDataException {} diff --git a/includes/BannerAllocationCalculator.php b/includes/BannerAllocationCalculator.php index 112f040..289b440 100644 --- a/includes/BannerAllocationCalculator.php +++ b/includes/BannerAllocationCalculator.php @@ -127,7 +127,7 @@ break; default: - throw new MWException( $this->status . 'is not a valid status ' + throw new Exception( $this->status . 'is not a valid status ' . 'for BannerAllocationsCalculator.' ); } diff --git a/includes/BannerChoiceDataProvider.php b/includes/BannerChoiceDataProvider.php index 9ec10d1..8bf9b52 100644 --- a/includes/BannerChoiceDataProvider.php +++ b/includes/BannerChoiceDataProvider.php @@ -58,7 +58,7 @@ break; default: - throw new MWException( $this->whichDb . 'is not a valid constant ' + throw new Exception( $this->whichDb . 'is not a valid constant ' . 'for selecting a DB for BannerChoiceDataProvider.' ); } diff --git a/includes/BannerMessage.php b/includes/BannerMessage.php index 914cf3f..5d4e4b1 100644 --- a/includes/BannerMessage.php +++ b/includes/BannerMessage.php @@ -20,7 +20,7 @@ * @param int $namespace Namespace to get key for * * @return string Message database key - * @throws MWException + * @throws Exception */ function getDbKey( $lang = null, $namespace = NS_MEDIAWIKI ) { global $wgLanguageCode; @@ -32,7 +32,7 @@ } elseif ( $namespace === NS_CN_BANNER ) { return "{$this->banner_name}-{$this->name}/{$lang}"; } else { - throw new MWException( "Namespace '$namespace' not known for having CentralNotice messages." ); + throw new Exception( "Namespace '$namespace' not known for having CentralNotice messages." ); } } diff --git a/includes/BannerMessageGroup.php b/includes/BannerMessageGroup.php index f4dd166..95f353e 100644 --- a/includes/BannerMessageGroup.php +++ b/includes/BannerMessageGroup.php @@ -261,7 +261,7 @@ public static function getLanguagesInState( $banner, $state ) { if ( !BannerMessageGroup::isUsingGroupReview() ) { - throw new MWException( 'CentralNotice is not using group review. Cannot query group review state.' ); + throw new Exception( 'CentralNotice is not using group review. Cannot query group review state.' ); } $groupName = BannerMessageGroup::getTranslateGroupName( $banner ); diff --git a/includes/CNCampaignPager.php b/includes/CNCampaignPager.php index ea2a33f..3236dfb 100644 --- a/includes/CNCampaignPager.php +++ b/includes/CNCampaignPager.php @@ -417,4 +417,4 @@ $jsSortable = $this->isWithinLimit() ? ' sortable' : ''; return parent::getTableClass() . ' wikitable' . $jsSortable; } -} \ No newline at end of file +} diff --git a/includes/CNDeviceTarget.php b/includes/CNDeviceTarget.php index 82241b3..ddc8ee3 100644 --- a/includes/CNDeviceTarget.php +++ b/includes/CNDeviceTarget.php @@ -115,7 +115,7 @@ $modifyArray = array(); foreach ( $newDevices as $device ) { if ( !array_key_exists( $device, $knownDevices ) ) { - throw new MWException( "Device name '$device' not known! Cannot add." ); + throw new Exception( "Device name '$device' not known! Cannot add." ); } $modifyArray[ ] = array( 'tmp_id' => $bannerId, 'dev_id' => $knownDevices[ $device ][ 'id' ] ); } diff --git a/includes/Campaign.php b/includes/Campaign.php index 72f2145..c71a775 100644 --- a/includes/Campaign.php +++ b/includes/Campaign.php @@ -573,7 +573,7 @@ * @param $priority int: priority level, LOW_PRIORITY - EMERGENCY_PRIORITY * @param $user User adding the campaign * - * @throws MWException + * @throws Exception * @return int|string noticeId on success, or message key for error */ static function addCampaign( $noticeName, $enabled, $startTs, $projects, @@ -660,7 +660,7 @@ return $not_id; } - throw new MWException( 'insertId() did not return a value.' ); + throw new Exception( 'insertId() did not return a value.' ); } /** @@ -895,7 +895,7 @@ * @param int $settingValue Value to use * @param int $max The max that the value can take, default 1 * @param int $min The min that the value can take, default 0 - * @throws MWException|RangeException + * @throws Exception|RangeException */ static function setNumericCampaignSetting( $noticeName, $settingName, $settingValue, $max = 1, $min = 0 ) { if ( $max <= $min ) { @@ -903,7 +903,7 @@ } if ( !is_numeric( $settingValue ) ) { - throw new MWException( 'Setting value must be numeric.' ); + throw new Exception( 'Setting value must be numeric.' ); } if ( $settingValue > $max ) { @@ -1157,4 +1157,4 @@ } } -class CampaignExistenceException extends MWException {} +class CampaignExistenceException extends Exception {} diff --git a/includes/HtmlFormElements/HTMLCentralNoticeBanner.php b/includes/HtmlFormElements/HTMLCentralNoticeBanner.php index 8cd2fdd..7f5b92f 100644 --- a/includes/HtmlFormElements/HTMLCentralNoticeBanner.php +++ b/includes/HtmlFormElements/HTMLCentralNoticeBanner.php @@ -66,11 +66,11 @@ } public function getTableRow( $value ) { - throw new MWException( "getTableRow() is not implemented for HTMLCentralNoticeBanner" ); + throw new Exception( "getTableRow() is not implemented for HTMLCentralNoticeBanner" ); } public function getRaw( $value ) { - throw new MWException( "getRaw() is not implemented for HTMLCentralNoticeBanner" ); + throw new Exception( "getRaw() is not implemented for HTMLCentralNoticeBanner" ); } public function getDiv( $value ) { diff --git a/includes/HtmlFormElements/HTMLCentralNoticeBannerMessage.php b/includes/HtmlFormElements/HTMLCentralNoticeBannerMessage.php index 518ead7..b79277b 100644 --- a/includes/HtmlFormElements/HTMLCentralNoticeBannerMessage.php +++ b/includes/HtmlFormElements/HTMLCentralNoticeBannerMessage.php @@ -72,4 +72,4 @@ return $html; } -} \ No newline at end of file +} diff --git a/includes/MixinController.php b/includes/MixinController.php index 8567423..4e9f9ec 100644 --- a/includes/MixinController.php +++ b/includes/MixinController.php @@ -82,7 +82,7 @@ } } -class MixinNotFoundException extends MWException { +class MixinNotFoundException extends Exception { function __construct( $name ) { $this->message = "Could not load CentralNotice banner mixin '{$name}'"; } diff --git a/special/SpecialBannerLoader.php b/special/SpecialBannerLoader.php index 8ab1229..0bf317f 100644 --- a/special/SpecialBannerLoader.php +++ b/special/SpecialBannerLoader.php @@ -25,7 +25,7 @@ echo $this->getJsNotice( $this->bannerName ); } catch ( EmptyBannerException $e ) { echo "mw.centralNotice.insertBanner( false );"; - } catch ( MWException $e ) { + } catch ( Exception $e ) { wfDebugLog( 'CentralNotice', $e->getMessage() ); echo "mw.centralNotice.insertBanner( false /* due to internal exception */ );"; } @@ -145,7 +145,7 @@ * * @ingroup Exception */ -class BannerLoaderException extends MWException { +class BannerLoaderException extends Exception { function __construct( $bannerName = '(none provided)' ) { $this->message = get_called_class() . " while loading banner: '{$bannerName}'"; } diff --git a/special/SpecialCentralNoticeBanners.php b/special/SpecialCentralNoticeBanners.php index 7408d2c..6397f99 100644 --- a/special/SpecialCentralNoticeBanners.php +++ b/special/SpecialCentralNoticeBanners.php @@ -792,7 +792,7 @@ $this->getOutput()->redirect( $this->getPageTitle( '' )->getCanonicalURL() ); $this->bannerFormRedirectRequired = true; - } catch ( MWException $ex ) { + } catch ( Exception $ex ) { return $ex->getMessage() . " <br /> " . $this->msg( 'centralnotice-template-still-bound', $this->bannerName ); } break; diff --git a/tests/CNTestFixturesResourceLoaderModule.php b/tests/CNTestFixturesResourceLoaderModule.php index 94c9de2..768eb99 100644 --- a/tests/CNTestFixturesResourceLoaderModule.php +++ b/tests/CNTestFixturesResourceLoaderModule.php @@ -18,4 +18,4 @@ CentralNoticeTestFixtures::allocationsDataAsJson() . ';'; } -} \ No newline at end of file +} -- To view, visit https://gerrit.wikimedia.org/r/184021 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I51f533ebaf94704d4c58bd99245de2fbeebfd60c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CentralNotice Gerrit-Branch: master Gerrit-Owner: Ori.livneh <o...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits