Skip to content

Instantly share code, notes, and snippets.

@macbre
Last active October 18, 2017 10:12
Show Gist options
  • Save macbre/156c1ab5bfd4bc01ad69c5127a018dd7 to your computer and use it in GitHub Desktop.
Save macbre/156c1ab5bfd4bc01ad69c5127a018dd7 to your computer and use it in GitHub Desktop.
SUS-2468 - no-break space in file names
#!/usr/bin/env php
<?php
# var_dump($argv);
# run it by providing "200298-1545" pair of city_id and page_id
list($cityId, $pageId) = explode('-', $argv[1]);
putenv('SERVER_ID=' . $cityId);
ini_set('display_errors', '1');
#########################################################################################
require_once('/home/macbre/app/maintenance/commandLine.inc');
$wgUser = User::newFromName(Wikia::BOT_USER);
$t = Title::newFromId($pageId);
$nt = Title::newFromText(str_replace("\xC2\xA0", '_', $t->getPrefixedDBkey()));
$url = $t->getFullUrl();
$newUrl = $nt->getFullUrl();
echo "{$wgDBname} | page #{$pageId} <{$url}> -> <{$newUrl}> ...";
$t->moveTo( $nt, false /* no auth */, 'SUS-2468 - fixing broken UTF encoding', false /* $createRedirect */);
echo " done\n";
95-46164
351-49858
667-116588
667-240315
1189-7850
1922-2032
1978-3753
2280-2582
2956-8739
3035-138319
3273-4211
3491-23681
3491-23682
3491-23685
3491-23686
3491-23688
3491-23702
3491-23704
3953-819
4191-30
4331-1962
5524-1951
5850-12432
6092-272932
6092-272933
6092-272934
6092-272935
6092-272936
6092-272937
6092-272938
6236-10
6236-4851
6913-3337
6913-3338
6913-3339
6913-3354
10167-6286
10714-948
10714-949
12955-93849
13240-221
13240-3832
13265-2036
14081-978
14656-78
15393-314
24197-2301
31354-2607
31354-2609
31354-2613
35848-2014
36727-4
37199-212
40456-363
41881-1727
43684-1609
49688-58132
49688-58133
52829-420
52829-421
52829-424
52829-425
52829-428
52829-441
52829-448
52829-466
52829-497
52829-511
52829-667
52872-152
59634-1821
59634-2171
59634-2223
59845-1541
59845-1542
63801-2347
63801-2793
66994-61
74546-1662
74546-1664
74811-1606
76688-1547
83530-2912
94758-1653
96832-1544
105741-1544
129139-1545
132582-1736
142506-1603
150639-1556
156917-1808
157903-2037
177501-1556
189576-1546
197804-730
200298-1545
#!/bin/bash
for LINE in `cat list`
do
./fix-image.php $LINE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment