[MediaWiki-commits] [Gerrit] mediawiki...CentralNotice[master]: Break long lines - includes / tests
Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/358030 ) Change subject: Break long lines - includes / tests .. Break long lines - includes / tests Prepare to make phpcs pass Change-Id: I567813e0953d5f9d0d1bcaeebc751fd702845ca2 --- M includes/Banner.php M includes/BannerMessage.php M includes/BannerMessageGroup.php M includes/BannerRenderer.php M includes/CNDeviceTarget.php M includes/Campaign.php M includes/CampaignLog.php M includes/HtmlFormElements/HTMLCentralNoticeBanner.php M tests/BannerTest.php M tests/CentralNoticeTest.php M tests/HistoryTest.php 11 files changed, 146 insertions(+), 64 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice refs/changes/30/358030/1 diff --git a/includes/Banner.php b/includes/Banner.php index 49e36fe..2a331d6 100644 --- a/includes/Banner.php +++ b/includes/Banner.php @@ -79,7 +79,8 @@ /** @var bool True if archived and hidden from default view. */ protected $archived = false; - /** @var string[] Devices this banner should be allocated to in the form {Device ID => Device header name} */ + /** @var string[] Devices this banner should be allocated to in the form +* {Device ID => Device header name} */ protected $devices = array(); /** @var string[] Names of enabled mixins */ @@ -345,7 +346,9 @@ $keystr[] = "{$key} = {$value}"; } $keystr = implode( " AND ", $keystr ); - throw new BannerExistenceException( "No banner exists where {$keystr}. Could not load." ); + throw new BannerExistenceException( + "No banner exists where {$keystr}. Could not load." + ); } // Set the dirty flag to not dirty because we just loaded clean data @@ -570,7 +573,9 @@ // when a deprecated mixin is being used; but also when we // do deprecate something we should make sure nothing is using // it! - wfLogWarning( "Mixin does not exist: {$row->mixin_name}, included from banner {$this->name}" ); + wfLogWarning( + "Mixin does not exist: {$row->mixin_name}, included from banner {$this->name}" + ); } $this->mixins[$row->mixin_name] = $wgCentralNoticeBannerMixins[$row->mixin_name]; } @@ -880,7 +885,8 @@ $availableLangs = array(); // Bit of an ugly hack to get just the banner prefix - $prefix = $this->getMessageField( '' )->getDbKey( null, $inTranslation ? NS_CN_BANNER : NS_MEDIAWIKI ); + $prefix = $this->getMessageField( '' ) + ->getDbKey( null, $inTranslation ? NS_CN_BANNER : NS_MEDIAWIKI ); $db = CNDatabase::getDb(); $result = $db->select( 'page', @@ -892,7 +898,12 @@ __METHOD__ ); while ( $row = $result->fetchRow() ) { - if ( preg_match( "/\Q{$prefix}\E([^\/]+)(?:\/([a-z_]+))?/", $row['page_title'], $matches ) ) { + if ( + preg_match( + "/\Q{$prefix}\E([^\/]+)(?:\/([a-z_]+))?/", $row['page_title'], + $matches + ) + ) { if ( isset( $matches[2] ) ) { $lang = $matches[2]; } else { @@ -1206,17 +1217,26 @@ foreach ( $res as $row ) { $banners[ ] = array( - 'name' => $row->tmp_name, // name of the banner - 'weight' => intval( $row->tmp_weight ), // weight assigned to the banner - 'display_anon' => intval( $row->tmp_display_anon ), // display to anonymous users? - 'display_account' => intval( $row->tmp_display_account ), // display to logged in users? - 'fundraising' => intval( $row->tmp_category === 'fundraising' ), // fundraising banner? - 'device' => $row->dev_name, // device this banner can target - 'campaign' => $row->not_name, // campaign the banner is assigned to - 'campaign_z_index' => $row->not_preferred, // z le
[MediaWiki-commits] [Gerrit] mediawiki...CentralNotice[master]: Break long lines - includes / tests
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/358030 ) Change subject: Break long lines - includes / tests .. Break long lines - includes / tests Prepare to make phpcs pass Change-Id: I567813e0953d5f9d0d1bcaeebc751fd702845ca2 --- M includes/Banner.php M includes/BannerMessage.php M includes/BannerMessageGroup.php M includes/BannerRenderer.php M includes/CNDeviceTarget.php M includes/Campaign.php M includes/CampaignLog.php M includes/HtmlFormElements/HTMLCentralNoticeBanner.php M tests/BannerTest.php M tests/CentralNoticeTest.php M tests/HistoryTest.php 11 files changed, 146 insertions(+), 64 deletions(-) Approvals: Reedy: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/Banner.php b/includes/Banner.php index 49e36fe..2a331d6 100644 --- a/includes/Banner.php +++ b/includes/Banner.php @@ -79,7 +79,8 @@ /** @var bool True if archived and hidden from default view. */ protected $archived = false; - /** @var string[] Devices this banner should be allocated to in the form {Device ID => Device header name} */ + /** @var string[] Devices this banner should be allocated to in the form +* {Device ID => Device header name} */ protected $devices = array(); /** @var string[] Names of enabled mixins */ @@ -345,7 +346,9 @@ $keystr[] = "{$key} = {$value}"; } $keystr = implode( " AND ", $keystr ); - throw new BannerExistenceException( "No banner exists where {$keystr}. Could not load." ); + throw new BannerExistenceException( + "No banner exists where {$keystr}. Could not load." + ); } // Set the dirty flag to not dirty because we just loaded clean data @@ -570,7 +573,9 @@ // when a deprecated mixin is being used; but also when we // do deprecate something we should make sure nothing is using // it! - wfLogWarning( "Mixin does not exist: {$row->mixin_name}, included from banner {$this->name}" ); + wfLogWarning( + "Mixin does not exist: {$row->mixin_name}, included from banner {$this->name}" + ); } $this->mixins[$row->mixin_name] = $wgCentralNoticeBannerMixins[$row->mixin_name]; } @@ -880,7 +885,8 @@ $availableLangs = array(); // Bit of an ugly hack to get just the banner prefix - $prefix = $this->getMessageField( '' )->getDbKey( null, $inTranslation ? NS_CN_BANNER : NS_MEDIAWIKI ); + $prefix = $this->getMessageField( '' ) + ->getDbKey( null, $inTranslation ? NS_CN_BANNER : NS_MEDIAWIKI ); $db = CNDatabase::getDb(); $result = $db->select( 'page', @@ -892,7 +898,12 @@ __METHOD__ ); while ( $row = $result->fetchRow() ) { - if ( preg_match( "/\Q{$prefix}\E([^\/]+)(?:\/([a-z_]+))?/", $row['page_title'], $matches ) ) { + if ( + preg_match( + "/\Q{$prefix}\E([^\/]+)(?:\/([a-z_]+))?/", $row['page_title'], + $matches + ) + ) { if ( isset( $matches[2] ) ) { $lang = $matches[2]; } else { @@ -1206,17 +1217,26 @@ foreach ( $res as $row ) { $banners[ ] = array( - 'name' => $row->tmp_name, // name of the banner - 'weight' => intval( $row->tmp_weight ), // weight assigned to the banner - 'display_anon' => intval( $row->tmp_display_anon ), // display to anonymous users? - 'display_account' => intval( $row->tmp_display_account ), // display to logged in users? - 'fundraising' => intval( $row->tmp_category === 'fundraising' ), // fundraising banner? - 'device' => $row->dev_name, // device this banner can target - 'campaign' => $row->not_name, // campaign the banner is assigned to - 'campaign_z_index' => $row->not_preferred, // z level of the campaign +