summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Blake Kongslie <jblake@omgwallhack.org>2011-04-27 19:31:37 -0700
committerJulian Blake Kongslie <jblake@omgwallhack.org>2011-04-27 19:31:37 -0700
commit127b307d286fd851bebf2b067bc8645a6e22f04a (patch)
tree8bacb11c0eaf56d8da4275916c218f9ab73d4293
parent430a5c47e38611704acebba04fac2927a9a0beff (diff)
downloadpiny-code-127b307d286fd851bebf2b067bc8645a6e22f04a.tar.gz
piny-code-127b307d286fd851bebf2b067bc8645a6e22f04a.zip
Emails for creating and removing repos.
-rwxr-xr-xpinyadmin/sbin/newrepo17
-rwxr-xr-xpinyadmin/sbin/rmrepo15
2 files changed, 32 insertions, 0 deletions
diff --git a/pinyadmin/sbin/newrepo b/pinyadmin/sbin/newrepo
index 5df6ee5..a63d96a 100755
--- a/pinyadmin/sbin/newrepo
+++ b/pinyadmin/sbin/newrepo
@@ -44,6 +44,23 @@ while( 1 ) {
};
+my $config = Piny::Config->new( );
+my $dest = $config->piny_newuseremail;
+
+unless( open( MAIL, "|/usr/lib/sendmail -t" ) ) {
+ die "Couldn't execute sendmail: $!\n";
+};
+print MAIL <<END;
+To: $dest
+Subject: Creating piny repo $name
+Content-type: text/plain; charset=us-ascii
+
+A new piny repo ``$name'' has been created.
+
+Description: $description
+END
+close( MAIL );
+
my $repo = Piny::Repo->create( $name, $description );
print "Repo URL: " . $repo->ikiwiki_url . "\n";
diff --git a/pinyadmin/sbin/rmrepo b/pinyadmin/sbin/rmrepo
index dff8fe5..acc9c56 100755
--- a/pinyadmin/sbin/rmrepo
+++ b/pinyadmin/sbin/rmrepo
@@ -7,6 +7,9 @@ use Piny;
my $env = Piny::Environment->instance( );
+my $config = Piny::Config->new( );
+my $dest = $config->piny_newuseremail;
+
foreach my $reponame ( @ARGV ) {
my $repo = Piny::Repo->new( $reponame );
@@ -16,6 +19,18 @@ foreach my $reponame ( @ARGV ) {
exit 1;
};
+ unless( open( MAIL, "|/usr/lib/sendmail -t" ) ) {
+ die "Couldn't execute sendmail: $!\n";
+ };
+ print MAIL <<END;
+ To: $dest
+ Subject: Removing piny repo $reponame
+ Content-type: text/plain; charset=us-ascii
+
+ The piny repo ``$reponame'' has been removed.
+ END
+ close( MAIL );
+
$repo->destroy;
};