fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-07-12 01:24 pm

[dw-free] remove code references to ljconfig.pl

[commit: http://hg.dwscoalition.org/dw-free/rev/470697a373ae]

http://bugs.dwscoalition.org/show_bug.cgi?id=3687

Replace references to ljconfig.pl with etc/config.pl. Fix a bug in startup
where we don't properly set the modification time of the config files to be
checked in case the files need to be reloaded later (we only checked the
config.pl when we should really be checking all config files)

Patch by [personal profile] kareila.

Files modified:
  • bin/checkconfig.pl
  • bin/cvsreport.pl
  • bin/ljblockwatcher.pl
  • bin/ljubackup.pl
  • bin/upgrading/base-data.sql
  • bin/upgrading/import-includes.pl
  • bin/upgrading/update-db-general.pl
  • cgi-bin/LJ/AccessLogSink.pm
  • cgi-bin/LJ/Config.pm
  • cgi-bin/LJ/ExternalSite.pm
  • cgi-bin/ljdefaults.pl
  • cgi-bin/modperl_subs.pl
  • cgi-bin/weblib.pl
--------------------------------------------------------------------------------
diff -r 0d2275ad794b -r 470697a373ae bin/checkconfig.pl
--- a/bin/checkconfig.pl	Tue Jul 12 21:16:02 2011 +0800
+++ b/bin/checkconfig.pl	Tue Jul 12 21:24:42 2011 +0800
@@ -272,8 +272,8 @@
     $err->("\$LJHOME directory doesn't exist ($ENV{'LJHOME'})")
         unless -d $ENV{'LJHOME'};
 
-    # before ljconfig.pl is called, we want to call the site-local checkconfig,
-    # otherwise ljconfig.pl might load ljconfig-local.pl, which maybe load
+    # before config.pl is called, we want to call the site-local checkconfig,
+    # otherwise config.pl might load config-local.pl, which could load
     # new modules to implement site-specific hooks.
     my $local_config = "$ENV{'LJHOME'}/bin/checkconfig-local.pl";
     $local_config .= ' --needed-debs' if $debs_only;
diff -r 0d2275ad794b -r 470697a373ae bin/cvsreport.pl
--- a/bin/cvsreport.pl	Tue Jul 12 21:16:02 2011 +0800
+++ b/bin/cvsreport.pl	Tue Jul 12 21:24:42 2011 +0800
@@ -20,26 +20,15 @@
 die "\$LJHOME not set.\n"
     unless -d $ENV{'LJHOME'};
 
-# be paranoid in production, force --these
-my @paranoia;
-eval { require "$ENV{LJHOME}/etc/ljconfig.pl"; };
-if ($LJ::IS_LJCOM_PRODUCTION || $LJ::IS_LJCOM_BETA) {
-    @paranoia = ('--these');
-}
-
 # strip off paths beginning with LJHOME
 # (useful if you tab-complete filenames)
 $_ =~ s!\Q$ENV{'LJHOME'}\E/?!! foreach (@ARGV);
 
-my @extra;
 my $vcv_exe = "multicvs.pl";
 if (-e "$ENV{LJHOME}/bin/vcv") {
     $vcv_exe = "vcv";
-    #@extra = ("--headserver=code.sixapart.com:10000");
 }
 
 exec("$ENV{'LJHOME'}/bin/$vcv_exe",
      "--conf=$ENV{'LJHOME'}/cvs/multicvs.conf",
-     @extra,
-     @paranoia,
      @ARGV);
diff -r 0d2275ad794b -r 470697a373ae bin/ljblockwatcher.pl
--- a/bin/ljblockwatcher.pl	Tue Jul 12 21:16:02 2011 +0800
+++ b/bin/ljblockwatcher.pl	Tue Jul 12 21:24:42 2011 +0800
@@ -46,7 +46,7 @@
 
 =item -p, --port=PORT
 
-Set the port to listen on for reports. This is set in ljconfig.pl, but can be
+Set the port to listen on for reports. This is set in etc/config.pl, but can be
 overridden here.
 
 =item -V, --version
diff -r 0d2275ad794b -r 470697a373ae bin/ljubackup.pl
--- a/bin/ljubackup.pl	Tue Jul 12 21:16:02 2011 +0800
+++ b/bin/ljubackup.pl	Tue Jul 12 21:24:42 2011 +0800
@@ -204,7 +204,7 @@
 
     # Otherwise we can't continue
     else {
-        abort( "Requires MogileFS configuration. Check your ljconfig.pl." );
+        abort( "Requires MogileFS configuration. Check your etc/config.pl." );
     }
 
     unlockStaleUsers() if $unlockMode;
diff -r 0d2275ad794b -r 470697a373ae bin/upgrading/base-data.sql
--- a/bin/upgrading/base-data.sql	Tue Jul 12 21:16:02 2011 +0800
+++ b/bin/upgrading/base-data.sql	Tue Jul 12 21:24:42 2011 +0800
@@ -773,7 +773,7 @@
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered. Stores IP addresses for spam reports, temporarily, whether the journal in which the anonymous comment was posted in has enabled IP tracking or not. Used with the [dbtable[spamreports]] table.\n\r\nThe LJ::record_anon_comment_ip function gets the anonymous comment IP, and records it here.\r\n\r\nA maintenance task cleans out IPs after 5 days - so anonymous comments deleted after 5 days are fairly useless, and reports about them are quietly discarded by the comment deletion system.', '0', 'off', NULL, 'tempanonips');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered. Stores Jabber roster data.', '0', 'off', NULL, 'jabroster');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered. Stores a log count of generic actions that have happened, like a post action (which calls LJ::note_recent_action()).\n\r\nA maintenance task moves these logged summaries from the various clusters to the global [dbtable[actionhistory]] table.', '0', 'off', NULL, 'recentactions');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered. Stores blobs (binary large objects) of on-disk data.\n\r\nBlob* files/classes for storing Blobs need to be added either to a local path or a remote Blob server (\"remote Blob server\" support has since been removed in favor of MogileFS).\r\n\r\nNotes: blobids aren\'t necessarily unique between domains; global userpicids may collide with the counter used for the rest. So, the type must be in the key. domain IDs are set up in ljconfig.pl.', '0', 'off', NULL, 'userblob');
+REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered. Stores blobs (binary large objects) of on-disk data.\n\r\nBlob* files/classes for storing Blobs need to be added either to a local path or a remote Blob server (\"remote Blob server\" support has since been removed in favor of MogileFS).\r\n\r\nNotes: blobids aren\'t necessarily unique between domains; global userpicids may collide with the counter used for the rest. So, the type must be in the key. domain IDs are set up in etc/config.pl.', '0', 'off', NULL, 'userblob');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered. Stores comments, such as OpenID comments, awaiting user approval.', '0', 'off', NULL, 'pendcomments');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered. Stores community invitations received.', '0', 'off', NULL, 'inviterecv');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Clustered. Stores community invitations sent.', '0', 'off', NULL, 'invitesent');
diff -r 0d2275ad794b -r 470697a373ae bin/upgrading/import-includes.pl
--- a/bin/upgrading/import-includes.pl	Tue Jul 12 21:16:02 2011 +0800
+++ b/bin/upgrading/import-includes.pl	Tue Jul 12 21:24:42 2011 +0800
@@ -15,7 +15,7 @@
 
 # This script goes through all of the files in your include directory
 # (LJHOME/htdocs/inc) and then imports ones that are specified by your
-# ljconfig.pl file (%LJ::FILEEDIT_VIA_DB) into your database if the file
+# etc/config.pl file (%LJ::FILEEDIT_VIA_DB) into your database if the file
 # on disk is newer than the one in the database.
 
 use strict;
diff -r 0d2275ad794b -r 470697a373ae bin/upgrading/update-db-general.pl
--- a/bin/upgrading/update-db-general.pl	Tue Jul 12 21:16:02 2011 +0800
+++ b/bin/upgrading/update-db-general.pl	Tue Jul 12 21:24:42 2011 +0800
@@ -645,7 +645,7 @@
 # - blobids aren't necessarily unique between domains;
 # global userpicids may collide with the counter used for the rest.
 # so type must be in the key.
-# - domain ids are set up in ljconfig.pl.
+# - domain ids are set up in etc/config.pl.
 # - NULL length indicates the data is external-- we need another
 # table for more data for that.
 register_tablecreate("userblob", <<'EOC'); # clustered
diff -r 0d2275ad794b -r 470697a373ae cgi-bin/LJ/AccessLogSink.pm
--- a/cgi-bin/LJ/AccessLogSink.pm	Tue Jul 12 21:16:02 2011 +0800
+++ b/cgi-bin/LJ/AccessLogSink.pm	Tue Jul 12 21:24:42 2011 +0800
@@ -54,7 +54,7 @@
             }
             push @sinks, $class->new(@args);
         } else {
-            # already an object in ljconfig.pl (old style)
+            # already an object in etc/config.pl (old style)
             push @sinks, $ci;
         }
     }
diff -r 0d2275ad794b -r 470697a373ae cgi-bin/LJ/Config.pm
--- a/cgi-bin/LJ/Config.pm	Tue Jul 12 21:16:02 2011 +0800
+++ b/cgi-bin/LJ/Config.pm	Tue Jul 12 21:24:42 2011 +0800
@@ -79,7 +79,7 @@
 
 # handle reloading at the start of a new web request
 sub start_request_reload {
-    # check the modtime of ljconfig.pl and reload if necessary
+    # check the modtime of etc/config.pl and reload if necessary
     # only do a stat every 10 seconds and then only reload
     # if the file has changed
     my $now = time();
diff -r 0d2275ad794b -r 470697a373ae cgi-bin/LJ/ExternalSite.pm
--- a/cgi-bin/LJ/ExternalSite.pm	Tue Jul 12 21:16:02 2011 +0800
+++ b/cgi-bin/LJ/ExternalSite.pm	Tue Jul 12 21:24:42 2011 +0800
@@ -18,7 +18,7 @@
 
 my $need_rebuild = 1;
 my @sites = ();
-# class method.  called after ljconfig.pl is reloaded
+# class method.  called after etc/config.pl is reloaded
 # to know we need to reconstruct our list of external site
 # instances
 sub forget_site_objs {
diff -r 0d2275ad794b -r 470697a373ae cgi-bin/ljdefaults.pl
--- a/cgi-bin/ljdefaults.pl	Tue Jul 12 21:16:02 2011 +0800
+++ b/cgi-bin/ljdefaults.pl	Tue Jul 12 21:24:42 2011 +0800
@@ -13,9 +13,9 @@
 # part of this distribution.
 #
 #
-# Do not edit this file.  You should edit ljconfig.pl, which you should have at
-# cgi-bin/ljconfig.pl.  If you don't, copy it from doc/ljconfig.pl.txt to cgi-bin
-# and edit it there.  This file only provides backup default values for upgrading.
+# Do not edit this file.  You should edit etc/config.pl.  If that file
+# doesn't exist, copy it from doc/ljconfig.pl.txt to etc/config.pl and
+# edit it there.  This file only provides backup default values for upgrading.
 #
 
 use strict;
@@ -171,12 +171,12 @@
     # setup the mogilefs defaults so we can create the necessary domains
     # and such. it is not recommended that you change the name of the
     # classes. you can feel free to add your own or alter the mindevcount
-    # from within ljconfig.pl, but the LiveJournal code uses these class
+    # from within etc/config.pl, but the LiveJournal code uses these class
     # names elsewhere and depends on them existing if you're using MogileFS
     # for storage.
     #
     # also note that this won't actually do anything unless you have
-    # defined a MOGILEFS_CONFIG hash in ljconfig.pl and you explicitly set
+    # defined a MOGILEFS_CONFIG hash in etc/config.pl and you explicitly set
     # at least the hosts key to be an arrayref of ip:port combinations
     # indicating where to reach your local MogileFS server.
     %MOGILEFS_CONFIG = () unless defined %MOGILEFS_CONFIG;
diff -r 0d2275ad794b -r 470697a373ae cgi-bin/modperl_subs.pl
--- a/cgi-bin/modperl_subs.pl	Tue Jul 12 21:16:02 2011 +0800
+++ b/cgi-bin/modperl_subs.pl	Tue Jul 12 21:24:42 2011 +0800
@@ -127,7 +127,13 @@
     }
 
     # set this before we fork
-    $LJ::CACHE_CONFIG_MODTIME = (stat("$LJ::HOME/cgi-bin/ljconfig.pl"))[9];
+    my $newest = 0;
+    foreach my $fn ( @LJ::CONFIG_FILES ) {
+        next unless -e "$LJ::HOME/$fn";
+        my $stattime = ( stat "$LJ::HOME/$fn" )[9];
+        $newest = $stattime if $stattime && $stattime > $newest;
+    }
+    $LJ::CACHE_CONFIG_MODTIME = $newest if $newest;
 
     eval { setup_start_local(); };
 }
diff -r 0d2275ad794b -r 470697a373ae cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl	Tue Jul 12 21:16:02 2011 +0800
+++ b/cgi-bin/weblib.pl	Tue Jul 12 21:24:42 2011 +0800
@@ -37,7 +37,7 @@
 #      its own dimensions.  This prevents hard-coding filenames & sizes
 #      into the source.  The real image data is stored in LJ::Img, which
 #      has default values provided in cgi-bin/imageconf.pl but can be
-#      overridden in etc/ljconfig.pl.
+#      overridden in etc/config.pl.
 # args: imagecode, type?, attrs?
 # des-imagecode: The unique string key to reference the image.  Not a filename,
 #                but the purpose or location of the image.
--------------------------------------------------------------------------------