Commit 11666090 authored by Dries's avatar Dries

- Addition: added new "cvs.module" to display and mail drupal's

  CVS log messages.  Our additional Perl script that hooks into
  the CVS repository is also provided in ./scripts.  Requires a
  SQL update, see 2.00-to-x.xx.sql.
parent d001c733
<?php
$module = array("cron" => "cvs_cron",
"conf" => "cvs_conf",
"page" => "cvs_page");
function cvs_cron() {
$result = db_query("SELECT * FROM cvs WHERE status = '0' ORDER BY timestamp DESC LIMIT 50");
while ($cvs = db_fetch_object($result)) {
$body .= "File: $cvs->files\nDate: ". format_date($cvs->timestamp) ."\nUser: $cvs->user\n\n$cvs->message\n----------------------------------------------------------------------\n";
}
$result = db_query("UPDATE cvs SET status = '1'");
if ($body) mail(variable_get(cvs_mail, "root@localhost"), "CVS log messages", $body, "From: no-reply");
}
function cvs_conf() {
$output .= "<B>Recepient for log messages:</B><BR>\n";
$output .= "<INPUT NAME=\"edit[cvs_mail]\" MAXLENGTH=\"55\" SIZE=\"30\" VALUE=\"". variable_get(cvs_mail, "root@localhost") ."\"><BR>\n";
$output .= "<I><SMALL>The e-mail address to mail the CVS log messages to. Multiple recipients can be specified by putting a comma between each address.</SMALL></I><P>\n";
return $output;
}
function cvs_page() {
global $theme;
$result = db_query("SELECT * FROM cvs ORDER BY timestamp DESC LIMIT 50");
while ($cvs = db_fetch_object($result)) {
$output .= "<b>File:</b> $cvs->files<br />";
$output .= "<b>Date:</b> ". format_date($cvs->timestamp) ."<br />";
$output .= "<b>User:</b> $cvs->user<br />";
$output .= "\n". htmlentities($cvs->message) ."<hr />";
}
$theme->header();
$theme->box("CVS commit messages", "<pre>$output</pre>");
$theme->footer();
}
?>
\ No newline at end of file
#!/usr/bin/perl -w
use DBI;
my $db_name = 'drupal';
my $db_user = 'drupal';
my $db_pass = 'drupal';
my $files = $ARGV[0];
my @message = <STDIN>;
my $message = join '' , @message;
my $user = $ENV{USER};
my $timestamp = time();
my $db = DBI->connect("DBI:mysql:$db_name", "$db_user", "$db_pass") or die "Couldn't connect to database: " . DBI->errstr;
$db->do("INSERT INTO cvs (user, files, message, timestamp) VALUES (". $db->quote($user) .", ". $db->quote($files) .", ". $db->quote($message) .", ". $db->quote($timestamp) .")") or die "Couldn't execute query: " . $db->errstr;
$db->disconnect();
# 14/04/2001:
ALTER TABLE node ADD cid int(10) unsigned DEFAULT '0' NOT NULL;
ALTER TABLE node ADD tid int(10) unsigned DEFAULT '0' NOT NULL;
ALTER TABLE story DROP section;
ALTER TABLE comments ADD KEY(lid);
# 19/04/2001:
ALTER TABLE node ADD comment int(2) DEFAULT '1' NOT NULL;
CREATE TABLE cvs (
user varchar(32) DEFAULT '' NOT NULL,
......@@ -12,6 +9,12 @@ CREATE TABLE cvs (
timestamp int(11) DEFAULT '0' NOT NULL
);
# 14/04/2001:
ALTER TABLE node ADD cid int(10) unsigned DEFAULT '0' NOT NULL;
ALTER TABLE node ADD tid int(10) unsigned DEFAULT '0' NOT NULL;
ALTER TABLE story DROP section;
ALTER TABLE comments ADD KEY(lid);
CREATE TABLE category (
cid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
name varchar(32) DEFAULT '' NOT NULL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment