Skip Menu |

This queue is for tickets about the PowerDNS-Backend-MySQL CPAN distribution.

Report information
The Basics
Id: 102100
Status: new
Priority: 0/
Queue: PowerDNS-Backend-MySQL

People
Owner: Nobody in particular
Requestors: mario [...] prezent.nl
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: FEATURE request for the POWERDNS::Backend::MySQL module
Date: Fri, 13 Feb 2015 09:41:08 +0100
To: bug-PowerDNS-Backend-MySQL [...] rt.cpan.org
From: Mario Jansen <mario [...] prezent.nl>
Hi, First of all nice perl module for powerdns. When using it in our environment I noticed I miss removing a dns zone file. Is it possible to add this function? I created this (but it might be usefull for other people as well) : <code> diff --git a/lib/PowerDNS/Backend/MySQL.pm b/lib/PowerDNS/Backend/MySQL.pm index 641fd10..bf5c452 100644 --- a/lib/PowerDNS/Backend/MySQL.pm +++ b/lib/PowerDNS/Backend/MySQL.pm @@ -13,11 +13,11 @@ PowerDNS::Backend::MySQL - Provides an interface to manipulate PowerDNS data in =head1 VERSION -Version 0.12 +Version 0.12a =cut -our $VERSION = '0.12'; +our $VERSION = '0.12a'; =head1 SYNOPSIS @@ -862,6 +862,24 @@ sub increment_serial($) $self->_unlock; return 1; } +=head2 remove_zone(\$zonename) + +Expects a scalar reference zone name to delete the domain and all it's records from the DB. +Returns 1 on success and 0 on failure. + +=cut + +sub delete_zone($) +{ + my $self = shift; + my $zonename = shift; + # Remove domain. + my $sth = $self->{'dbh'}->prepare("DELETE FROM records WHERE domain_id = (SELECT id from domains WHERE name = ? limit 1)"); + $sth->execute($$zonename) or die $sth->errstr; + $sth = $self->{'dbh'}->prepare("DELETE FROM domains WHERE name = ?"); + if ( $sth->execute($$zonename) != 1 ) { return 0; } + return 1; +} 1; </code> I am not sure how I can commit it to your module (I downloaded the pm file from cpan, but I don't see any git url to checkout and request a git pull request. Regards, Mario Jansen