diff options
author | David Lawrence <dkl@mozilla.com> | 2014-09-15 16:13:35 +0200 |
---|---|---|
committer | David Lawrence <dkl@mozilla.com> | 2014-09-15 16:13:35 +0200 |
commit | 84ec7f6938e6c44e617bb3b2669281e21d5c198a (patch) | |
tree | def0799cf464164e14b816313fb05bd799d59a46 /Bugzilla | |
parent | c11b241b985511c01803df200d31afb793f11903 (diff) | |
download | bugzilla-84ec7f6938e6c44e617bb3b2669281e21d5c198a.tar.gz bugzilla-84ec7f6938e6c44e617bb3b2669281e21d5c198a.tar.xz |
Bug 1066184: data/params.js should be renamed to data/params.json since the data form is JSON and not JS
r=LpSolit,a=sgreen
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Config.pm | 21 | ||||
-rw-r--r-- | Bugzilla/Install/DB.pm | 2 | ||||
-rw-r--r-- | Bugzilla/Install/Filesystem.pm | 2 |
3 files changed, 15 insertions, 10 deletions
diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm index a41b30abe..7ec80e1ab 100644 --- a/Bugzilla/Config.pm +++ b/Bugzilla/Config.pm @@ -103,7 +103,7 @@ sub update_params { # If the old data/params file using Data::Dumper output still exists, # read it. It will be deleted once the parameters are stored in the new - # data/params.js file. + # data/params.json file. my $old_file = "$datadir/params"; if (-e $old_file) { @@ -118,7 +118,12 @@ sub update_params { $param = \%{ $s->varglob('param') }; } else { - # Read the new data/params.js file. + # Rename params.js to params.json if checksetup.pl + # was executed with an earlier version of this change + rename "$old_file.js", "$old_file.json" + if -e "$old_file.js" && !-e "$old_file.json"; + + # Read the new data/params.json file. $param = read_param_file(); } @@ -283,7 +288,7 @@ sub update_params { if (-e $old_file) { unlink $old_file; - say "$old_file has been converted into $old_file.js, using the JSON format."; + say "$old_file has been converted into $old_file.json, using the JSON format."; } # Return deleted params and values so that checksetup.pl has a chance @@ -294,7 +299,7 @@ sub update_params { sub write_params { my ($param_data) = @_; $param_data ||= Bugzilla->params; - my $param_file = bz_locations()->{'datadir'} . '/params.js'; + my $param_file = bz_locations()->{'datadir'} . '/params.json'; my $json_data = JSON::XS->new->canonical->pretty->encode($param_data); write_file($param_file, { binmode => ':utf8', atomic => 1 }, \$json_data); @@ -311,13 +316,13 @@ sub write_params { sub read_param_file { my %params; - my $file = bz_locations()->{'datadir'} . '/params.js'; + my $file = bz_locations()->{'datadir'} . '/params.json'; if (-e $file) { my $data; read_file($file, binmode => ':utf8', buf_ref => \$data); - # If params.js has been manually edited and e.g. some quotes are + # If params.json has been manually edited and e.g. some quotes are # missing, we don't want JSON::XS to leak the content of the file # to all users in its error message, so we have to eval'uate it. %params = eval { %{JSON::XS->new->decode($data)} }; @@ -401,12 +406,12 @@ Returns: nothing =item C<read_param_file()> Description: Most callers should never need this. This is used - by C<Bugzilla-E<gt>params> to directly read C<$datadir/params.js> + by C<Bugzilla-E<gt>params> to directly read C<$datadir/params.json> and load it into memory. Use C<Bugzilla-E<gt>params> instead. Params: none -Returns: A hashref containing the current params in C<$datadir/params.js>. +Returns: A hashref containing the current params in C<$datadir/params.json>. =item C<param_panels()> diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index 2bf3c0c1a..ab02fe41d 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -2561,7 +2561,7 @@ sub _fix_whine_queries_title_and_op_sys_value { undef, "Other", "other"); if (Bugzilla->params->{'defaultopsys'} eq 'other') { # We can't actually fix the param here, because WriteParams() will - # make $datadir/params.js unwriteable to the webservergroup. + # make $datadir/params.json unwriteable to the webservergroup. # It's too much of an ugly hack to copy the permission-fixing code # down to here. (It would create more potential future bugs than # it would solve problems.) diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index 73536b4b5..47b989f71 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -171,7 +171,7 @@ sub FILESYSTEM { 'docs/style.css' => { perms => WS_SERVE }, 'docs/*/rel_notes.txt' => { perms => WS_SERVE }, 'docs/*/README.docs' => { perms => OWNER_WRITE }, - "$datadir/params.js" => { perms => CGI_WRITE }, + "$datadir/params.json" => { perms => CGI_WRITE }, "$datadir/old-params.txt" => { perms => OWNER_WRITE }, "$extensionsdir/create.pl" => { perms => OWNER_EXECUTE }, "$extensionsdir/*/*.pl" => { perms => WS_EXECUTE }, |