Created
May 16, 2018 13:11
-
-
Save macbre/7c10460a5cb846efe321dfbf3bcae38f to your computer and use it in GitHub Desktop.
SUS-4284 | Migrate ComScore tag overrides from tag to WikiFactory variabl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
putenv('SERVER_ID=177'); | |
ini_set('display_errors', '1'); | |
######################################################################################### | |
require_once('/home/macbre/app/maintenance/commandLine.inc'); | |
$wgUser = User::newFromName(Wikia::BOT_USER); | |
$dbr = wfGetDB(DB_SLAVE, [], 'wikicities'); | |
$res = $dbr->query("SELECT distinct(city_id) as city_id FROM `city_tag`,`city_tag_map` WHERE (tag_id = id) and name LIKE 'comscore_%' order by city_id", __FILE__); | |
foreach($res as $row) { | |
$cityId = $row->city_id; | |
$comscoreTag = HubService::getComscoreCategoryOverride( $cityId ); | |
if (is_string($comscoreTag)) { | |
echo sprintf("Comscore tag for wiki #%d: '%s' ...", $cityId, $comscoreTag); | |
WikiFactory::setVarByName('wgComScoreTagOverride', $cityId, $comscoreTag, 'SUS-4284 | Migrate ComScore tag overrides from tag to WikiFactory variable'); | |
echo " variable set\n"; | |
} | |
} | |
echo "\ndone\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment