]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1066184: data/params.js should be renamed to data/params.json since the data...
authorDavid Lawrence <dkl@mozilla.com>
Mon, 15 Sep 2014 14:13:35 +0000 (14:13 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Mon, 15 Sep 2014 14:13:35 +0000 (14:13 +0000)
r=LpSolit,a=sgreen

Bugzilla.pm
Bugzilla/Config.pm
Bugzilla/Install/DB.pm
Bugzilla/Install/Filesystem.pm
checksetup.pl
docs/en/rst/administration.rst

index af670e90f4beaf82caaea2b7babdd2f4c6c7f2e4..2347a8ae8cdc7cd8a2640a5efc8ff9be6d94f29c 100644 (file)
@@ -941,8 +941,8 @@ Change the database object to refer to the main database.
 
 =item C<params>
 
-The current Parameters of Bugzilla, as a hashref. If C<data/params.js>
-does not exist, then we return an empty hashref. If C<data/params.js>
+The current Parameters of Bugzilla, as a hashref. If C<data/params.json>
+does not exist, then we return an empty hashref. If C<data/params.json>
 is unreadable or is not valid, we C<die>.
 
 =item C<local_timezone>
index a41b30abe3a8e95e889d49aee0aa2906ef45f730..7ec80e1ab03b1ee45a078fd4afeff2062a8e8174 100644 (file)
@@ -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()>
 
index 2bf3c0c1a901f5861a02e74ab015fdfe6dcb37f0..ab02fe41db355cef59ce22cfa6082ab074e6d710 100644 (file)
@@ -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.)
index 73536b4b5ac2697e15cbce9f1b5e9710659b17f2..47b989f71de6acf319a5ee6a9774abd8e96a1830 100644 (file)
@@ -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 },
index 1785faf5447666fcd0c5c8bb9b3a065623661473..50ca8bda878eb50a90a8c28221ddd5896c5f4008 100755 (executable)
@@ -109,7 +109,7 @@ my $lc_hash = Bugzilla->localconfig;
 
 # At this point, localconfig is defined and is readable. So we know
 # everything we need to create the DB. We have to create it early,
-# because some data required to populate data/params.js is stored in the DB.
+# because some data required to populate data/params.json is stored in the DB.
 
 Bugzilla::DB::bz_check_requirements(!$silent);
 Bugzilla::DB::bz_create_database() if $lc_hash->{'db_check'};
@@ -364,7 +364,7 @@ L<Bugzilla::Install::Filesystem/create_htaccess>.
 
 =item 9
 
-Updates the system parameters (stored in F<data/params.js>), using
+Updates the system parameters (stored in F<data/params.json>), using
 L<Bugzilla::Config/update_params>.
 
 =item 10
index d26e354b9dd8001e0ba29f1ae13e0875d74240ab..df7631fdbda8b1c3c99930f35e287f2bf73ce106 100644 (file)
@@ -346,7 +346,7 @@ user_verify_class
     well, you may otherwise not be able to log back in to Bugzilla once
     you log out.
     If this happens to you, you will need to manually edit
-    :file:`data/params.js` and set user_verify_class to
+    :file:`data/params.json` and set user_verify_class to
     ``DB``.
 
 LDAPserver
@@ -414,7 +414,7 @@ user_verify_class
     well, you may otherwise not be able to log back in to Bugzilla once
     you log out.
     If this happens to you, you will need to manually edit
-    :file:`data/params.js` and set user_verify_class to
+    :file:`data/params.json` and set user_verify_class to
     ``DB``.
 
 RADIUS_server