File_DNS
[ class tree: File_DNS ] [ index: File_DNS ] [ all elements ]

Class: File_DNS

Source Location: /File_DNS-0.1.0/File/DNS.php

Class Overview


an RFC1033 style zonefile editor


Author(s):

Version:

  • Release: @version@

Copyright:

  • 2004-2005 Cipriano Groenendal <cipri@php.net>

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 116]
an RFC1033 style zonefile editor

The File::DNS class provides an Object Oriented interface to read, edit and create DNS Zonefiles.



[ Top ]


Class Variables

$version =  '@version@'

[line 222]

package Version

Type:   string


[ Top ]



Method Detail

apiVersion   [line 1172]

int apiVersion( )

returns the API version
  • Return: The API version number
  • Access: public

[ Top ]

free   [line 539]

bool free( )

resets the object so one can load another file
  • Return: true

[ Top ]

isIP   [line 1154]

bool isIP( string $value)

checks if a value is an IP address or not.
  • Return: true or false.

Parameters:

string   $value     Value to check.

[ Top ]

load   [line 241]

bool load( string $domain, string $zonefile, [int $lock = false])

cleans the object, then loads the specified zonefile.
  • Return: true on success, PEAR Error on failure.
  • Access: public

Parameters:

string   $domain     domainname of this zone
string   $zonefile     filename of zonefile to load. Can be anything that PEAR::File can read.
int   $lock     type of lock to establish on the zonefile. Set to LOCK_SH for a shared lock (reader) Set to LOCK_EX for an exclusive lock (writer) Add LOCK_NB if you don't want locking to block

[ Top ]

parseFromSeconds   [line 1123]

string parseFromSeconds( int $ttl)

converts seconds to BIND-style timeout(1D, 2H, 15M).
  • Return: String with time on success, PEAR error on failure.

Parameters:

int   $ttl     seconds to convert

[ Top ]

parseToSeconds   [line 1069]

int parseToSeconds( string $time)

converts a BIND-style timeout(1D, 2H, 15M) to seconds.
  • Return: time in seconds on success, PEAR error on failure.

Parameters:

string   $time     Time to convert.

[ Top ]

raiseSerial   [line 1044]

int raiseSerial( [int $serial = 0])

generate a new serial based on given one.

This generates a new serial, based on the often used format YYYYMMDDXX where XX is an ascending serial, allowing up to 100 edits per day. After that the serial wraps into the next day and it still works.

  • Return: New serial

Parameters:

int   $serial     Current serial

[ Top ]

save   [line 584]

true save( [string $filename = null], [string $separator = "\n"], [int $lock = false])

saves the zonefile back to the file.
  • Return: true on success, PEAR Error on failure.

Parameters:

string   $filename     the filename to save to. Defaults to the loaded file.
string   $separator     the lineending separator. Defaults to \n.
int   $lock     file-lock type to use. Defaults to FALSE (none)

[ Top ]

setDomainName   [line 702]

bool setDomainName( string $domain, [bool $migrate = true])

sets the domain name of the currently loaded zone.

It also handles changing all the RR's already saved.

  • Return: true on success, PEAR Error on failure.

Parameters:

string   $domain     the new domain name
bool   $migrate     whether or not to change all occurances of *.oldomain to the new domain name. Defaults to true.

[ Top ]

setMXPref   [line 978]

bool setMXPref( int $pref, [string $server = NULL], [string $name = NULL])

sets the MX Preference of an MX record to the specified value.
  • Return: true on success, PEAR Error on failure.

Parameters:

int   $pref     the preference level.
string   $server     the mailserver this MX points to. (NULL for all)
string   $name     the (sub)domain this MX applies to. (NULL for all)

[ Top ]

setName   [line 881]

bool setName( string $new, [string $name = NULL], [string $type = NULL], [string $data = NULL])

sets the name of a specific, or not so specific, record.
  • Return: true.

Parameters:

string   $new     The new name for this record. If needed, the current domainname will be automaticly appended.
string   $name     The name of the record to edit. (NULL for all)
string   $type     The type of the record to edit. (NULL for all)
string   $data     The data of the record to edit. (NULL for all)

[ Top ]

setSOAValue   [line 765]

bool setSOAValue( array $values)

sets a specific value in the SOA field.

This function updates the list of SOA data we have. List of accepted key => value pairs:

 Array
   (
       [name] => example.com.
       [ttl] => 345600
       [class] => IN
       [origin] => ns1.example.com.
       [person] => hostmaster.example.com.
       [serial] => 204041514
       [refresh] => 14400
       [retry] => 1800
       [expire] => 86400
       [minimum] => 10800
   )

  • Return: true on success, PEAR Error on failure.
  • See: _SOA

Parameters:

array   $values     A list of key -> value pairs

[ Top ]

setTTL   [line 837]

bool setTTL( int $new, [string $name = NULL], [string $type = NULL], [string $data = NULL])

sets the TTL of a specific, or not so specific, record.
  • Return: true.

Parameters:

int   $new     The new TTL for this record
string   $name     The name of the record to edit. (NULL for all)
string   $type     The type of the record to edit. (NULL for all)
string   $data     The data of the record to edit. (NULL for all)

[ Top ]

setValue   [line 935]

bool setValue( string $new, [string $name = NULL], [string $type = NULL], [string $data = NULL])

sets the Value of a specific, or not so specific, record.
  • Return: true on success, PEAR_ERROR on error.

Parameters:

string   $new     The new Value for this record
string   $name     The name of the record to edit. (NULL for all)
string   $type     The type of the record to edit. (NULL for all)
string   $data     The data of the record to edit. (NULL for all)

[ Top ]

toString   [line 560]

string toString( [string $separator = "\n"])

returns a string with the zonefile generated from this object.
  • Return: The generated zone, PEAR Error on failure.

Parameters:

string   $separator     The lineending separator. Defaults to \n

[ Top ]


Documentation generated on Tue, 05 Oct 2010 04:30:03 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.