LDAP Account Manager

Importer
in package

Imports LDIF files.

Tags
author

Roland Gruber

Table of Contents

CHANGETYPE  = 'changetype'
DATA  = 'data'
KEY  = 0
PROGRESS  = 'progress'
SESSION_KEY_COUNT  = 'import_count'
SESSION_KEY_STOP_ON_ERROR  = 'import_stop_on_error'
SESSION_KEY_TASKS  = 'import_tasks'
STATUS  = 'status'
TIME_LIMIT  = 10
VALUE  = 1
doImport()  : mixed
Processes the import data stored in session.
formatMessage()  : string
Returns the HTML for an error message.
getTasks()  : array<string|int, ImporterTask>
Converts the lines to LDAP import tasks.
convertToTasks()  : array<string|int, ImporterTask>
Continues the import with processing of a single entry.
createModRdnTask()  : mixed
Returns a modrdn task.
extractImportChunks()  : string|array<string|int, mixed>
Extracts the single entries in the file.
getChangeTypeTask()  : ImporterTask
Returns a task for LDIF changetype entry.
getEndTime()  : number
Returns the time when processing should end.
getLineKeyValue()  : array<string|int, string>
Returns the key and value part of the line.
getStatus()  : string
Returns the current status as JSON.
processDnEntry()  : ImporterTask
Checks a dn entry.
processVersion()  : mixed
Checks a version entry.
stopImport()  : string
Stops the import process because of an exception.

Constants

CHANGETYPE

public mixed CHANGETYPE = 'changetype'

PROGRESS

public mixed PROGRESS = 'progress'

SESSION_KEY_COUNT

public mixed SESSION_KEY_COUNT = 'import_count'

SESSION_KEY_STOP_ON_ERROR

public mixed SESSION_KEY_STOP_ON_ERROR = 'import_stop_on_error'

SESSION_KEY_TASKS

public mixed SESSION_KEY_TASKS = 'import_tasks'

STATUS

public mixed STATUS = 'status'

TIME_LIMIT

public mixed TIME_LIMIT = 10

Methods

doImport()

Processes the import data stored in session.

public doImport() : mixed
Return values
mixed

formatMessage()

Returns the HTML for an error message.

public static formatMessage(string $type, string $title, string $message) : string
Parameters
$type : string

message type (e.g. INFO)

$title : string

title

$message : string

message

Return values
string

HTML

getTasks()

Converts the lines to LDAP import tasks.

public getTasks(array<string|int, string> $lines) : array<string|int, ImporterTask>
Parameters
$lines : array<string|int, string>

import lines

Tags
throws
LAMException

if invalid format was found

Return values
array<string|int, ImporterTask>

tasks

convertToTasks()

Continues the import with processing of a single entry.

private convertToTasks(array<string|int, array<string|int, mixed>> $entries) : array<string|int, ImporterTask>
Parameters
$entries : array<string|int, array<string|int, mixed>>

import entries

Return values
array<string|int, ImporterTask>

tasks

createModRdnTask()

Returns a modrdn task.

private createModRdnTask(string $dn, array<string|int, string> $entry) : mixed
Parameters
$dn : string

DN

$entry : array<string|int, string>

entry lines

Tags
throws
LAMException

syntax error

Return values
mixed

extractImportChunks()

Extracts the single entries in the file.

private extractImportChunks(array<string|int, string> $lines) : string|array<string|int, mixed>
Parameters
$lines : array<string|int, string>

LDIF lines

Tags
throws
LAMException

invalid format

Return values
string|array<string|int, mixed>

array of string[]

getChangeTypeTask()

Returns a task for LDIF changetype entry.

private getChangeTypeTask(string $dn, string $lines) : ImporterTask
Parameters
$dn : string

DN

$lines : string

lines

Return values
ImporterTask

task

getEndTime()

Returns the time when processing should end.

private getEndTime() : number
Return values
number

end time as Unix timestamp

getLineKeyValue()

Returns the key and value part of the line.

private getLineKeyValue(string $line) : array<string|int, string>
Parameters
$line : string

line

Return values
array<string|int, string>

array(key, value)

getStatus()

Returns the current status as JSON.

private getStatus(string $data) : string
Parameters
$data : string

HTML output to display

Return values
string

JSON status

processDnEntry()

Checks a dn entry.

private processDnEntry(array<string|int, string> $entry) : ImporterTask
Parameters
$entry : array<string|int, string>

entry

Tags
throws
LAMException

if invalid format

Return values
ImporterTask

task

processVersion()

Checks a version entry.

private processVersion(array<string|int, string> $entry) : mixed
Parameters
$entry : array<string|int, string>

entry

Tags
throws
LAMException

if version is invalid

Return values
mixed

stopImport()

Stops the import process because of an exception.

private stopImport(string $data, LAMException $e) : string
Parameters
$data : string

HTML output

$e : LAMException

exception

Return values
string

JSON status

Search results