Adamw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/50776


Change subject: remove deprecated BannerListLoader
......................................................................

remove deprecated BannerListLoader

Change-Id: I3749125b685730816e4cf268ade69db38f787c30
---
M CentralNotice.alias.php
M CentralNotice.php
M README
M includes/Banner.php
D special/SpecialBannerListLoader.php
5 files changed, 2 insertions(+), 143 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice 
refs/changes/76/50776/1

diff --git a/CentralNotice.alias.php b/CentralNotice.alias.php
index d1accf4..5ad5d65 100644
--- a/CentralNotice.alias.php
+++ b/CentralNotice.alias.php
@@ -12,7 +12,6 @@
        'NoticeTemplate' => array( 'NoticeTemplate' ),
        'BannerAllocation' => array( 'BannerAllocation' ),
        'BannerController' => array( 'BannerController' ),
-       'BannerListLoader' => array( 'BannerListLoader' ),
        'BannerLoader' => array( 'BannerLoader' ),
        'HideBanners' => array( 'HideBanners' ),
 );
diff --git a/CentralNotice.php b/CentralNotice.php
index 711f6aa..276dbf4 100644
--- a/CentralNotice.php
+++ b/CentralNotice.php
@@ -217,7 +217,6 @@
        // Register files
        $wgAutoloadClasses[ 'CentralNotice' ] = $specialDir . 
'SpecialCentralNotice.php';
        $wgAutoloadClasses[ 'SpecialBannerLoader' ] = $specialDir . 
'SpecialBannerLoader.php';
-       $wgAutoloadClasses[ 'SpecialBannerListLoader' ] = $specialDir . 
'SpecialBannerListLoader.php';
        $wgAutoloadClasses[ 'SpecialBannerRandom' ] = $specialDir . 
'SpecialBannerRandom.php';
        $wgAutoloadClasses[ 'SpecialRecordImpression' ] = $specialDir . 
'SpecialRecordImpression.php';
        $wgAutoloadClasses[ 'SpecialHideBanners' ] = $specialDir . 
'SpecialHideBanners.php';
@@ -254,7 +253,6 @@
 
        // Register special pages
        $wgSpecialPages[ 'BannerLoader' ] = 'SpecialBannerLoader';
-       $wgSpecialPages[ 'BannerListLoader' ] = 'SpecialBannerListLoader';
        $wgSpecialPages[ 'BannerRandom' ] = 'SpecialBannerRandom';
        $wgSpecialPages[ 'RecordImpression' ] = 'SpecialRecordImpression';
        $wgSpecialPages[ 'HideBanners' ] = 'SpecialHideBanners';
@@ -539,7 +537,6 @@
 
        $vars[ 'wgNoticeFundraisingUrl' ] = $wgNoticeFundraisingUrl;
        $vars[ 'wgCentralPagePath' ] = $wgCentralPagePath;
-       $vars[ 'wgNoticeBannerListLoader' ] = $wgContLang->specialPage( 
'BannerListLoader' );
        $vars[ 'wgCentralBannerDispatcher' ] = $wgCentralBannerDispatcher;
        $vars[ 'wgCentralBannerRecorder' ] = $wgCentralBannerRecorder;
        $vars[ 'wgNoticeXXCountries' ] = $wgNoticeXXCountries;
diff --git a/README b/README
index 449735b..aa26ccb 100644
--- a/README
+++ b/README
@@ -1,3 +1,5 @@
+FIXME: this document is very out-of-date.
+
 Wiki page HTML contains an unchanging bit that just sets JS variables
 about what site this is, then calls an external <script> to fetch site
 notice text.  It also includes a facility to fetch a geolocation data.
diff --git a/includes/Banner.php b/includes/Banner.php
index f164f91..8850ed2 100644
--- a/includes/Banner.php
+++ b/includes/Banner.php
@@ -337,96 +337,6 @@
                return $banner;
        }
 
-       /**
-        * DEPRECATED, but included for backwards compatibility during upgrade
-        * Lookup function for active banners under a given 
language/project/location. This function is
-        * called by SpecialBannerListLoader::getJsonList() in order to build 
the banner list JSON for
-        * each project.
-        * @deprecated Remove me after upgrade has been completed.
-        * @param $project string
-        * @param $language string
-        * @param $location string
-        * @return array a 2D array of running banners with associated weights 
and settings
-        */
-       static function getBannersByTarget( $project, $language, $location = 
null ) {
-               global $wgCentralDBname;
-
-               $campaigns = array();
-               $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname );
-               $encTimestamp = $dbr->addQuotes( $dbr->timestamp() );
-
-               // Pull non-geotargeted campaigns
-               $campaignResults1 = $dbr->select(
-                       // Aliases are needed to avoid problems with table 
prefixes
-                       array(
-                               'notices' => 'cn_notices',
-                               'cn_notice_projects',
-                               'cn_notice_languages'
-                       ),
-                       array(
-                               'not_id'
-                       ),
-                       array(
-                               "not_start <= $encTimestamp",
-                               "not_end >= $encTimestamp",
-                               'not_enabled = 1', // enabled
-                               'not_geo = 0', // not geotargeted
-                               'np_notice_id = notices.not_id',
-                               'np_project' => $project,
-                               'nl_notice_id = notices.not_id',
-                               'nl_language' => $language
-                       ),
-                       __METHOD__
-               );
-               foreach ( $campaignResults1 as $row ) {
-                       $campaigns[] = $row->not_id;
-               }
-               if ( $location ) {
-
-                       // Normalize location parameter (should be an uppercase 
2-letter country code)
-                       preg_match( '/[a-zA-Z][a-zA-Z]/', $location, $matches );
-                       if ( $matches ) {
-                               $location = strtoupper( $matches[0] );
-
-                               // Pull geotargeted campaigns
-                               $campaignResults2 = $dbr->select(
-                                       array(
-                                               'cn_notices',
-                                               'cn_notice_projects',
-                                               'cn_notice_languages',
-                                               'cn_notice_countries'
-                                       ),
-                                       array(
-                                               'not_id'
-                                       ),
-                                       array(
-                                               "not_start <= $encTimestamp",
-                                               "not_end >= $encTimestamp",
-                                               'not_enabled = 1', // enabled
-                                               'not_geo = 1', // geotargeted
-                                               'nc_notice_id = 
cn_notices.not_id',
-                                               'nc_country' => $location,
-                                               'np_notice_id = 
cn_notices.not_id',
-                                               'np_project' => $project,
-                                               'nl_notice_id = 
cn_notices.not_id',
-                                               'nl_language' => $language
-                                       ),
-                                       __METHOD__
-                               );
-                               foreach ( $campaignResults2 as $row ) {
-                                       $campaigns[] = $row->not_id;
-                               }
-                       }
-               }
-
-               $banners = array();
-               if ( $campaigns ) {
-                       // Pull all banners assigned to the campaigns
-                       $banners = Banner::getCampaignBanners( $campaigns );
-               }
-               return $banners;
-       }
-
        static function getTemplateId( $templateName ) {
                $dbr = wfGetDB( DB_SLAVE );
                $templateName = htmlspecialchars( $templateName );
diff --git a/special/SpecialBannerListLoader.php 
b/special/SpecialBannerListLoader.php
deleted file mode 100644
index 6ae5d6b..0000000
--- a/special/SpecialBannerListLoader.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-// FIXME deprecated in so many ways... assuming we will merge the Api patch 
here:
-// can be deleted once the bannerController module is updated and purged.
-
-class SpecialBannerListLoader extends UnlistedSpecialPage {
-       public function __construct() {
-               parent::__construct( 'BannerListLoader' );
-       }
-
-       public function execute( $par ) {
-               // Set up for JSON output. As of 1.20 a special page is 
apparently faster than an API
-               // call
-               $this->getOutput()->disable();
-               $this->sendHeaders();
-
-               $bannerList = 
ApiCentralNoticeAllocations::getAllocationInformation(
-                       $this->getRequest()->getText('project'),
-                       $this->getRequest()->getText('country'),
-                       $this->getRequest()->getText('language'),
-                       $this->getRequest()->getText('anonymous'),
-                       $this->getRequest()->getText('bucket'),
-                       true
-               );
-
-               $output = array();
-               $output['centralnoticeallocations']['banners'] = $bannerList;
-
-               print FormatJson::encode( $output );
-       }
-
-       /**
-        * Generate the HTTP response headers for the banner file
-        */
-       protected function sendHeaders() {
-               global $wgJsMimeType, $wgNoticeBannerMaxAge;
-
-               // Set the cache control
-               $this->getRequest()->response()->header(
-                       "Cache-Control: public, s-maxage=$wgNoticeBannerMaxAge, 
max-age=$wgNoticeBannerMaxAge",
-                       true
-               );
-
-               // And the datatype
-               $this->getRequest()->response()->header(
-                       "Content-type: $wgJsMimeType; charset=utf-8",
-                       true
-               );
-       }
-}

-- 
To view, visit https://gerrit.wikimedia.org/r/50776
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3749125b685730816e4cf268ade69db38f787c30
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Adamw <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to