Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F29933931
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
CDanis
Aug 1 2019, 9:29 PM
2019-08-01 21:29:20 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
raw.txt
View Options
#!/usr/bin/php
<?php
// This script takes dbctl-JSON-formatted configuration, as produced by e.g.
// dbctl -s eqiad config get
// and transforms it into PHP suitable for pasting into db-eqiad.php in an
// emergency.
// It can also read the JSON 'restore' files output by dbctl config commit,
// with some help from jq:
// jq '.eqiad' /var/cache/conftool/dbconfig/FOO.json
$argc == 2 or die("usage: $argv[0] INPUT-JSON-FILE\n");
$inputfilename = $argv[1] or die;
$data = json_decode(file_get_contents($inputfilename), TRUE);
$data != NULL or die;
$readOnlyBySection = $data['readOnlyBySection'];
$groupLoadsBySection = $data['groupLoadsBySection'];
$sectionLoads = [];
foreach ($data['sectionLoads'] as $section => $loads) {
$sectionLoads[$section] = array_merge($loads[0], $loads[1]);
}
print '$wgLBFactoryConf[\'sectionLoads\'] = ';
var_export($sectionLoads);
print ";\n";
print '$wgLBFactoryConf[\'readOnlyBySection\'] = ';
var_export($readOnlyBySection);
print ";\n";
print '$wgLBFactoryConf[\'groupLoadsBySection\'] = ';
var_export($groupLoadsBySection);
print ";\n";
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
7807695
Default Alt Text
raw.txt (1 KB)
Attached To
Mode
P8848 export.php -- emergency generation of static configs from dbctl data
Attached
Detach File
Event Timeline
Log In to Comment