[Slashdotjp-dev 500] CVS update: slashjp/sbin

アーカイブの一覧に戻る

Tatsuki SUGIURA sugi****@users*****
2006年 7月 12日 (水) 20:42:07 JST


Index: slashjp/sbin/dailyStuff
diff -u slashjp/sbin/dailyStuff:1.3 slashjp/sbin/dailyStuff:1.4
--- slashjp/sbin/dailyStuff:1.3	Fri Dec 31 21:37:18 2004
+++ slashjp/sbin/dailyStuff	Wed Jul 12 20:42:07 2006
@@ -1,8 +1,8 @@
 #!/usr/bin/perl -w
 # This code is a part of Slash, and is released under the GPL.
-# Copyright 1997-2004 by Open Source Development Network. See README
+# Copyright 1997-2005 by Open Source Technology Group. See README
 # and COPYING for more information, or see http://slashcode.com/.
-# $Id: dailyStuff,v 1.3 2004/12/31 12:37:18 oliver Exp $
+# $Id: dailyStuff,v 1.4 2006/07/12 11:42:07 sugi Exp $
 
 ###############################################################################
 # dailyStuff - this program runs various housekeeping tasks, sends out the
Index: slashjp/sbin/portald
diff -u slashjp/sbin/portald:1.3 slashjp/sbin/portald:1.4
--- slashjp/sbin/portald:1.3	Fri Dec 31 21:37:18 2004
+++ slashjp/sbin/portald	Wed Jul 12 20:42:07 2006
@@ -1,8 +1,8 @@
 #!/usr/bin/perl -w
 # This code is a part of Slash, and is released under the GPL.
-# Copyright 1997-2004 by Open Source Development Network. See README
+# Copyright 1997-2005 by Open Source Technology Group. See README
 # and COPYING for more information, or see http://slashcode.com/.
-# $Id: portald,v 1.3 2004/12/31 12:37:18 oliver Exp $
+# $Id: portald,v 1.4 2006/07/12 11:42:07 sugi Exp $
 
 ###############################################################################
 # portald  - this is the "daemon" responsible for retrieving portal and site
@@ -39,6 +39,7 @@
 my $gSkin = getCurrentSkin();
 my $totalChangedStories = 1;
 
+my $br = $constants->{xhtml} ? '<br />' : '<br>';
 my $backupdb = getObject('Slash::DB', { db_type => 'reader' });
 
 ################################################################################
@@ -69,30 +70,31 @@
 ################################################################################
 
 sub getTop10Comments {
-	my $A =	$backupdb->getTop10Comments();
+	my $A =	$backupdb->getTop10Comments;
 
-	my $reasons = $slashdb->getReasons();
+	my $reasons = $slashdb->getReasons;
 
-	my $block;
+	my $block = '<ul>';
 	foreach (@$A) {
 		my($sid, $title, $cid, $subj, $d, $nickname, $points, $reason) = @$_;
 		$block .= <<EOT;
 
-&middot; <B><A HREF="$gSkin->{rootdir}/comments.pl?sid=$sid&amp;cid=$cid">$subj</A>
+<li> <b><a href="$gSkin->{rootdir}/comments.pl?sid=$sid&amp;cid=$cid">$subj</a>
 	($points points, $reasons->{$reason}{name})
-	by $nickname</B>
+	by $nickname</b>
 	on $d
-	<FONT SIZE="1">attached to
-	<A HREF="$gSkin->{rootdir}/article.pl?sid=$sid">$title</A></FONT><BR>
+	<small>attached to
+	<a href="$gSkin->{rootdir}/article.pl?sid=$sid">$title</a></small></li>
 EOT
 	}
-	setblock("top10comments", $block);
+	$block .= '</ul>';
+	setblock('top10comments', $block);
 
 }
 
 #################################################################
 sub getSlashdotPoll {
-	setblock("poll", pollbooth('_currentqid', 1));
+	setblock('poll', pollbooth('_currentqid', 1));
 }
 
 
@@ -111,22 +113,22 @@
 #################################################################
 sub getUptime {
 	my $x = `/usr/bin/uptime`;
-	$x = "<B>time:</B> $x";
-	$x =~ s/up/\n<BR><B>uptime:<\/B>/g;
-	$x =~ s/load average:/\n<BR><B>load average:<\/B>/;
+	$x = "<b>time:</b> $x";
+	$x =~ s/up/\n$br<b>uptime:<\/b>/g;
+	$x =~ s/load average:/\n<br><b>load average:<\/b>/;
 	my $ps = `/bin/ps aux | /usr/bin/wc -l`;
 	$ps--;
-	$x .= "<BR><B>processes:</B> $ps <BR>";
+	$x .= "$br<b>processes:</b> $ps$br";
 
 	my $stats = $x;
 
 #	my $tc = $constants->{totalComments};
 	my $th = $constants->{totalhits};
 
-#	$stats .= "<B>yesterday:</B> $yesterday<BR>
-#		<B>today:</B> $today<BR>
-#		<B>ever:</B> $th<BR>";
-	$stats .= "<B>totalhits:</B> $th<BR>";
+#	$stats .= "<b>yesterday:</b> $yesterday<br>
+#		<b>today:</b> $today<br>
+#		<b>ever:</b> $th<br>";
+	$stats .= "<b>totalhits:</b> $th$br";
 
 	setblock('uptime', $stats);
 }
@@ -142,13 +144,13 @@
 
 #################################################################
 sub getRDF {
-	#gets an RDF file, and formats it as a /. block
+	#gets an RDF file, and formats it as a Slash block
 
 	my($bid, $url, $other) = @_;
 	my $rss = new XML::RSS;
 	my $template_name = $slashdb->getBlock($bid, 'rss_template');
 	my $items ||= $slashdb->getBlock($bid, 'items');
-	$items ||= $constants->{max_items};
+	$items ||= $constants->{rss_max_items_incoming};
 	$template_name ||= $constants->{default_rss_template};
 
 	my $d;
@@ -203,10 +205,11 @@
 			next unless $link;
 
 			# convert links to sections of our own site
-			# into a non-scheme-specific format
+			# into a non-scheme-specific format ...
+			# unless host begins with "rss." (this could be a separate var ...)
 			my $uri = URI->new($link);
 			if ($uri->can('authority')) {
-				$uri->scheme(undef) if $uri->authority =~ /\b$bd_regex\Z/;
+				$uri->scheme(undef) if $uri->authority =~ /\b$bd_regex\Z/ && $uri->authority !~ /^rss\./;
 			}
 
 			$item->{link} = $uri->as_string or next;
Index: slashjp/sbin/slashd
diff -u slashjp/sbin/slashd:1.3 slashjp/sbin/slashd:1.4
--- slashjp/sbin/slashd:1.3	Fri Dec 31 21:37:18 2004
+++ slashjp/sbin/slashd	Wed Jul 12 20:42:07 2006
@@ -1,8 +1,8 @@
 #!/usr/bin/perl -w
 # This code is a part of Slash, and is released under the GPL.
-# Copyright 1997-2004 by Open Source Development Network. See README
+# Copyright 1997-2005 by Open Source Technology Group. See README
 # and COPYING for more information, or see http://slashcode.com/.
-# $Id: slashd,v 1.3 2004/12/31 12:37:18 oliver Exp $
+# $Id: slashd,v 1.4 2006/07/12 11:42:07 sugi Exp $
 
 ############################################################
 #
@@ -48,7 +48,21 @@
 );
 
 my $virtual_user = $ARGV[0];
-createEnvironment($virtual_user);
+eval {
+	createEnvironment($virtual_user);
+};
+if ($@) {
+	if ($@ =~ /DBIx::Password has no information about the virtual user/
+		&& $virtual_user eq 'start') {
+		die <<"EOT";
+$@
+To be more specific, your error is that, per step 7 of the INSTALLATION
+section in the INSTALL file (please reread), you need to start slashd
+with '/etc/init.d/slash start', not '/usr/local/slash/sbin/slashd start'.
+EOT
+	}
+	die $@;
+}
 my $constants = getCurrentStatic();
 my $slashdb = getCurrentDB();
 my $user = getCurrentUser();
@@ -143,27 +157,12 @@
 	die $err;
 }
 
-# What time does the database think it is?  Our tasks are synched to
-# that time, which may be different from the time that the machine
-# we're running on thinks it is.
-#
-# We use two closure'd variables here and do a little dance just to
-# avoid calling SELECT NOW() more than once every ten minutes.
-# Not that it really matters, this optimization saves just about
-# nothing, but there's just no need, clocks can't possibly drift
-# anywere near that much.
+# The closure and cache that was done on this is now done in
+# MySQL.pm, making this utility function pretty much a no-op.
 
-{ my($last_db_time_offset, $last_db_time_confirm) = (undef, undef);
 sub db_time {
-	my $my_time = time;
-	if (!$last_db_time_confirm
-		or $my_time > $last_db_time_confirm + 600) {
-		my $db_time = timeCalc($slashdb->getTime(), "%s", 0);
-		$last_db_time_offset = $db_time - $my_time;
-		$last_db_time_confirm = $my_time;
-	}
-	return $my_time + $last_db_time_offset;
-} }
+	return $slashdb->getTime({ unix_format => 1 });
+}
 
 # Get the logging verbosity from the database.
 #
@@ -332,11 +331,7 @@
 			slashdLog("requiring '$fullname' caused error: $!");
 			$ok = 0;
 		}
-		if (!defined($task{$file}{timespec})) {
-			slashdLog("'$fullname' did not set timespec properly");
-			$ok = 0;
-		}
-		if (!$task{$file}{code} or ref $task{$file}{code} ne 'CODE') {
+		if (!$task{$file}{code} || ref $task{$file}{code} ne 'CODE') {
 			slashdLog("'$fullname' did not set code properly");
 			$ok = 0;
 		}
@@ -344,11 +339,18 @@
 		# MAY OR MAY NOT want to run on an automated AND/OR a manual
 		# type basis: this allows the user to decide.
 		if ($task{$file}{standalone}) {
-			slashdLog("'$fullname' available via runtask, only!");
+			slashdLog("'$fullname' only runs via runtask (this is not an error)");
+			$ok = 0;
+		}
+		if (!defined($task{$file}{timespec})) {
+			slashdLog("'$fullname' did not set timespec properly");
 			$ok = 0;
 		}
 		if ($ok) {
 			$success{$file} = 1;
+			# Allow a default value for at least this one field
+			# (and maybe others, later... haven't decided yet)
+			$task{$file}{fork} ||= SLASHD_NOWAIT;
 		} else {
 			delete $task{$file} if $task{$file};
 			$failure{$file} = 1;
@@ -828,6 +830,7 @@
 
 		# kill the dbh, we have too many problems
 		# if it sticks around during a fork -- pudge
+		$slashdb->getMCD()->disconnect_all() if $slashdb->getMCD();
 		$slashdb->{_dbh}->disconnect if $slashdb->{_dbh};
 		undef $slashdb->{_dbh};
 


Slashdotjp-dev メーリングリストの案内
アーカイブの一覧に戻る