[Fusionforge-commits] r7348 - in trunk: . gforge/cronjobs gforge/deb-specific gforge/install

Roland Mas lolando at libremir.placard.fr.eu.org
Mon Apr 6 17:20:34 CEST 2009


Author: lolando
Date: 2009-04-06 17:20:34 +0200 (Mon, 06 Apr 2009)
New Revision: 7348

Added:
   trunk/gforge/cronjobs/get_news_notapproved.pl
Removed:
   trunk/gforge/deb-specific/get_news_notapproved.pl
Modified:
   trunk/
   trunk/gforge/install/db-postgresql
Log:
Merged from 4.8: move get_news_notapproved.pl from deb-specific/ to cronjobs/


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/Branch_4_7:6879,6881,6884,6897,6899,6902,6904,6906,6909,6911,6922,6932,6936,6939,6942,6944,6946-6948,6954,6956,6959,7000-7001,7012,7111,7130-7131,7133-7134,7138,7140-7142,7147-7148,7159-7160,7163,7168,7177,7179,7203,7205,7207,7210,7212,7251-7253,7255,7284,7287,7291,7293,7295-7296,7300
/branches/Branch_4_8:7334-7335,7344

   + /branches/Branch_4_7:6879,6881,6884,6897,6899,6902,6904,6906,6909,6911,6922,6932,6936,6939,6942,6944,6946-6948,6954,6956,6959,7000-7001,7012,7111,7130-7131,7133-7134,7138,7140-7142,7147-7148,7159-7160,7163,7168,7177,7179,7203,7205,7207,7210,7212,7251-7253,7255,7284,7287,7291,7293,7295-7296,7300
/branches/Branch_4_8:7334-7335,7344-7345

Modified: svk:merge
   - 9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7001
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7012
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7291
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7335
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7344

   + 9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7001
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7012
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7291
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7335
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7344
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7345


Copied: trunk/gforge/cronjobs/get_news_notapproved.pl (from rev 7345, branches/Branch_4_8/gforge/cronjobs/get_news_notapproved.pl)
===================================================================
--- trunk/gforge/cronjobs/get_news_notapproved.pl	                        (rev 0)
+++ trunk/gforge/cronjobs/get_news_notapproved.pl	2009-04-06 15:20:34 UTC (rev 7348)
@@ -0,0 +1,113 @@
+#!/usr/bin/perl -w
+#
+# get_news_notapproved.pl: script to get the news not yet approved 
+#   by Vicente J. Ruiz Jurado (vjrj AT ourproject.org) Apr-2004
+#
+# depends: libgetopt-mixed-perl (Getopt::Long), libdbi-perl (DBI),
+#          libtext-autoformat-perl (Text::Autoformat)
+#          libmail-sendmail-perl (Mail::Sendmail)
+#
+use DBI;
+use Text::Autoformat;
+use Getopt::Long qw(:config require_order);
+use Mail::Sendmail;
+
+use strict;
+
+require("/usr/share/gforge/lib/include.pl");  # Include all predefined functions
+
+use vars qw/ $server_admin $sys_name $sys_default_domain /;
+
+# DB 
+#-------------------------------------------------------------------------------
+use vars qw/ $dbh / ; # Predeclaration of global vars
+
+# Variables
+#-------------------------------------------------------------------------------
+
+my $numArgs = @ARGV;
+my @args = @ARGV;
+my $therearenews = 0;
+
+sub usage();
+
+my $debug;
+my @results_array;
+my $emailformatted;
+
+# Options check
+#-------------------------------------------------------------------------------
+
+my $resultOptions = GetOptions(
+"debug" => \$debug
+);
+
+unless (($debug && $resultOptions == 2) || ($resultOptions == 1)) {
+	usage();
+	exit(1);
+}
+
+# Start to get de News
+#-------------------------------------------------------------------------------
+
+if ($debug) {print STDERR "Getting the news not approved.\n"};
+
+&db_connect;
+$dbh->{AutoCommit} = 0;
+$dbh->{RaiseError} = 1;
+
+my $old_date = time()-60*60*24*30;
+my $query = "SELECT group_name,summary,details 
+	FROM news_bytes n, groups g 
+	WHERE is_approved = 0 
+	AND n.group_id=g.group_id
+	AND n.post_date > '$old_date'
+	AND g.is_public=1
+	AND g.status='A'
+	ORDER BY post_date";
+
+my $sth = $dbh->prepare($query);
+$sth->execute();
+
+while (my @array = $sth->fetchrow_array ()) {
+	push @results_array, \@array ;
+}
+$sth->execute() or die "Problems with the query '$query' in DB";
+$sth->finish() or die "Problems with the query '$query' in DB";
+$dbh->commit or die $dbh->errstr;
+
+foreach my $newsnotapprob (@results_array) {
+	$therearenews = 1;
+	my ($group_name, $summary, $details) = @{$newsnotapprob};
+	my $title = "$group_name: $summary\n";
+	$emailformatted .= autoformat $title, {  all => 1, left=>0, right=>78 };
+	$emailformatted .= "----------------------------------------------------------------------\n";
+	$emailformatted .= autoformat $details, {  all => 1, left=>8, right=>78 };
+	$emailformatted .= "\n\n";
+}
+
+if ($therearenews) {
+	if ($debug) {print STDERR "Sending the news not approved.\n"};
+  $emailformatted .= "Please visit: http://$sys_default_domain/news/admin/";
+	$emailformatted .= "\n\n";
+	my %mail = ( To      => "$server_admin",
+		     From    => "noreply\@$sys_default_domain",
+		     Subject => "$sys_name pending news",
+		     Message => $emailformatted
+		   );
+	$mail{'Content-type'} = 'text/plain; charset="UTF-8"';
+	sendmail(%mail) or die $Mail::Sendmail::error;
+}
+else {
+	if ($debug) {print STDERR "No news to approved.\n"};
+}
+
+if ($debug) {print STDERR "get_news_notapproved process finished ok\n"};
+exit(0);
+
+# Funcitions
+#-------------------------------------------------------------------------------
+
+sub usage() {
+	print STDERR "usage: get_news_notapproved.pl [--debug]\n";
+}

Deleted: trunk/gforge/deb-specific/get_news_notapproved.pl
===================================================================
--- trunk/gforge/deb-specific/get_news_notapproved.pl	2009-04-06 15:19:31 UTC (rev 7347)
+++ trunk/gforge/deb-specific/get_news_notapproved.pl	2009-04-06 15:20:34 UTC (rev 7348)
@@ -1,113 +0,0 @@
-#!/usr/bin/perl -w
-#
-# get_news_notapproved.pl: script to get the news not yet approved 
-#   by Vicente J. Ruiz Jurado (vjrj AT ourproject.org) Apr-2004
-#
-# depends: libgetopt-mixed-perl (Getopt::Long), libdbi-perl (DBI),
-#          libtext-autoformat-perl (Text::Autoformat)
-#          libmail-sendmail-perl (Mail::Sendmail)
-#
-use DBI;
-use Text::Autoformat;
-use Getopt::Long qw(:config require_order);
-use Mail::Sendmail;
-
-use strict;
-
-require("/usr/share/gforge/lib/include.pl");  # Include all predefined functions
-
-use vars qw/ $server_admin $sys_name $sys_default_domain /;
-
-# DB 
-#-------------------------------------------------------------------------------
-use vars qw/ $dbh / ; # Predeclaration of global vars
-
-# Variables
-#-------------------------------------------------------------------------------
-
-my $numArgs = @ARGV;
-my @args = @ARGV;
-my $therearenews = 0;
-
-sub usage();
-
-my $debug;
-my @results_array;
-my $emailformatted;
-
-# Options check
-#-------------------------------------------------------------------------------
-
-my $resultOptions = GetOptions(
-"debug" => \$debug
-);
-
-unless (($debug && $resultOptions == 2) || ($resultOptions == 1)) {
-	usage();
-	exit(1);
-}
-
-# Start to get de News
-#-------------------------------------------------------------------------------
-
-if ($debug) {print STDERR "Getting the news not approved.\n"};
-
-&db_connect;
-$dbh->{AutoCommit} = 0;
-$dbh->{RaiseError} = 1;
-
-my $old_date = time()-60*60*24*30;
-my $query = "SELECT group_name,summary,details 
-	FROM news_bytes n, groups g 
-	WHERE is_approved = 0 
-	AND n.group_id=g.group_id
-	AND n.post_date > '$old_date'
-	AND g.is_public=1
-	AND g.status='A'
-	ORDER BY post_date";
-
-my $sth = $dbh->prepare($query);
-$sth->execute();
-
-while (my @array = $sth->fetchrow_array ()) {
-	push @results_array, \@array ;
-}
-$sth->execute() or die "Problems with the query '$query' in DB";
-$sth->finish() or die "Problems with the query '$query' in DB";
-$dbh->commit or die $dbh->errstr;
-
-foreach my $newsnotapprob (@results_array) {
-	$therearenews = 1;
-	my ($group_name, $summary, $details) = @{$newsnotapprob};
-	my $title = "$group_name: $summary\n";
-	$emailformatted .= autoformat $title, {  all => 1, left=>0, right=>78 };
-	$emailformatted .= "----------------------------------------------------------------------\n";
-	$emailformatted .= autoformat $details, {  all => 1, left=>8, right=>78 };
-	$emailformatted .= "\n\n";
-}
-
-if ($therearenews) {
-	if ($debug) {print STDERR "Sending the news not approved.\n"};
-  $emailformatted .= "Please visit: http://$sys_default_domain/news/admin/";
-	$emailformatted .= "\n\n";
-	my %mail = ( To      => "$server_admin",
-		     From    => "noreply\@$sys_default_domain",
-		     Subject => "$sys_name pending news",
-		     Message => $emailformatted
-		   );
-	$mail{'Content-type'} = 'text/plain; charset="UTF-8"';
-	sendmail(%mail) or die $Mail::Sendmail::error;
-}
-else {
-	if ($debug) {print STDERR "No news to approved.\n"};
-}
-
-if ($debug) {print STDERR "get_news_notapproved process finished ok\n"};
-exit(0);
-
-# Funcitions
-#-------------------------------------------------------------------------------
-
-sub usage() {
-	print STDERR "usage: get_news_notapproved.pl [--debug]\n";
-}

Modified: trunk/gforge/install/db-postgresql
===================================================================
--- trunk/gforge/install/db-postgresql	2009-04-06 15:19:31 UTC (rev 7347)
+++ trunk/gforge/install/db-postgresql	2009-04-06 15:20:34 UTC (rev 7348)
@@ -23,8 +23,9 @@
 #
 cronjobs/ftp_create_group_access.php    usr/share/gforge/cronjobs/
 #
+cronjobs/get_news_notapproved.pl	usr/share/gforge/cronjobs/
+#
 deb-specific/stats_projects_logparse.pl usr/share/gforge/bin/
-deb-specific/get_news_notapproved.pl    usr/share/gforge/bin/
 deb-specific/install-db.sh              usr/share/gforge/bin/
 deb-specific/db-upgrade.pl              usr/share/gforge/bin/
 deb-specific/sqlparser.pm               usr/share/gforge/lib/




More information about the Fusionforge-commits mailing list