Net_LDAP_LDIF Net_LDAP_LDIF(
string|ressource
$file, [string
$mode = 'r'], [array
$options = array()])
|
|
Open LDIF file for reading or for writing
new (FILE): Open the file read-only. FILE may be the name of a file or an already open filehandle. If the file doesn't exist, it will be created if in write mode.
new (FILE, MODE, OPTIONS): Open the file with the given MODE (see PHPs fopen()), eg "w" or "a". FILE may be the name of a file or an already open filehandle. PERLs Net_LDAP "FILE|" mode does not work curently.
OPTIONS is an associative array and may contain: encode => 'none' | 'canonical' | 'base64' Some DN values in LDIF cannot be written verbatim and have to be encoded in some way: 'none' No encoding. 'canonical' See "canonical_dn()" in Net::LDAP::Util. 'base64' Use base64. (default, this differs from the Perl interface. The perl default is "none"!)
onerror => 'die' | 'warn' | undef Specify what happens when an error is detected. 'die' Net_LDAP_LDIF will croak with an appropriate message. 'warn' Net_LDAP_LDIF will warn (echo) with an appropriate message. undef Net_LDAP_LDIF will not warn (default), use error().
change => 1 Write entry changes to the LDIF file instead of the entries itself. I.e. write LDAP operations acting on the entries to the file instead of the entries contents. This writes the changes usually carried out by an update() to the LDIF file.
lowercase => 1 Convert attribute names to lowercase when writing.
sort => 1 Sort attribute names when writing entries according to the rule: objectclass first then all other attributes alphabetically sorted by attribute name
version => '1' Set the LDIF version to write to the resulting LDIF file. According to RFC 2849 currently the only legal value for this option is 1. When this option is set Net_LDAP_LDIF tries to adhere more strictly to the LDIF specification in RFC2489 in a few places. The default is undef meaning no version information is written to the LDIF file.
wrap => 78 Number of columns where output line wrapping shall occur. Default is 78. Setting it to 40 or lower inhibits wrapping.
[NOT IMPLEMENTED] raw => REGEX Use REGEX to denote the names of attributes that are to be considered binary in search results if writing entries. Example: raw => "/(?i:^jpegPhoto|;binary)/i"
Parameters:
Returns lines that resulted in error.
Perl returns an array of faulty lines in list context, but we always just return an int because of PHPs language.
Returns the file handle the Net_LDAP_LDIF object reads from or writes to.
You can, for example, use this to fetch the content of the LDIF file yourself
array next_lines(
[boolean
$force = false])
|
|
Returns the lines that will generate the next Net::LDAP::Entry object.
If you set $force to TRUE then you can iterate over the lines that build up entries manually. Otherwise, iterating is done using read_entry(). Force will move the file pointer forward, thus returning the next entries lines.
Wrapped lines will be unwrapped. Comments are stripped.
Parameters:
Write the entry or entries to the LDIF file.
If you want to build an LDIF file containing several entries AND you want to call write_entry() several times, you must open the filehandle in append mode ("a"), otherwise you will always get the last entry only.
Parameters:
Write version to LDIF
If the object's version is defined, this method allows to explicitely write the version before an entry is written. If not called explicitely, it gets called automatically when writing the first entry.