Overview

Namespaces

  • Jlab
    • Eloglib

Classes

  • Attachment
  • FileAttachment
  • Logentry
  • LogentryUtil
  • URLAttachment
  • User

Exceptions

  • InvalidXMLException
  • IOException
  • LogentryException
  • LogRuntimeException
  • ServerException
  • UserException
  • Overview
  • Namespace
  • Class

Class LogentryUtil

Namespace: Jlab\Eloglib
Located at LogentryUtil.php
Methods summary
public static
# saveToFile( string $filename, Jlab\Eloglib\Logentry $entry )

Saves a Logentry object to an XML file

Saves a Logentry object to an XML file

Parameters

$filename
$entry

Throws

public static string
# saveToQueue( Jlab\Eloglib\Logentry $entry, boolean $validate = true )

Saves a Logentry's XML output to a file in the elog queue directory Returns the name of the file that was saved

Saves a Logentry's XML output to a file in the elog queue directory Returns the name of the file that was saved

Parameters

$entry
$validate
whether to perform schema validation before queuing.

Returns

string

Throws

Jlab\Eloglib\IOException
if unable to write queue file
Jlab\Eloglib\InvalidXMLException
public static
# queuePath( )
public static string
# queueFileName( )

Returns a file name in the recommended format: YYYYMMDD_HHMMSS_PID_HOSTNAME_RND.xml

Returns a file name in the recommended format: YYYYMMDD_HHMMSS_PID_HOSTNAME_RND.xml

Returns

string
public static string
# saveToServer( Jlab\Eloglib\Logentry $entry )

Saves a Logentry to the server via HTTPS.

Saves a Logentry to the server via HTTPS.

Returns boolean indicating sucess or failure. The raw server response is stored in LogentryUtil::$lastServerMsg

Parameters

$entry

Returns

string

Throws

protected static
# tmpXMLFile( $xml )
protected static
# submitUrl( $filename )
public static
# certificateFile( )
public static boolean
# isSimpleFilename( string $filename )

Determines if the file name is simple (with no path component) or not.

Determines if the file name is simple (with no path component) or not.

Parameters

$filename

Returns

boolean
public static mixed
# userHome( )

Return the user's home directory.

Return the user's home directory.

The code below was borrowed from https://github.com/drush-ops/drush

Returns

mixed
string or null
public static integer
# extractLognumber( string $text )

Extracts and returns the log number out of an XML-formatted server response.

Extracts and returns the log number out of an XML-formatted server response.

Parameters

$text
XML server response

Returns

integer

Throws

Jlab\Eloglib\ServerException
public static boolean
# isValidEntry( Jlab\Eloglib\Logentry $entry, string $schema = null )

Determines whether a Logentry object validates against the XML schema.

Determines whether a Logentry object validates against the XML schema.

If the optional schema parameter is not provided, the environment variable LOG_ENTRY_SCHEMA_URL will be used.

If the validation fails, return value will be false and the validationErrors() method can be called in order to obtain the text of any error message(s).

Parameters

$entry
$schema
URL of XML schema to use for validation

Returns

boolean

Throws

Jlab\Eloglib\IOException
if XML cannot be written to a text file.
public static boolean
# isValidXMLFile( string $filename, string $schema = null )

Determines whether a Logentry XML file validates against the XML schema.

Determines whether a Logentry XML file validates against the XML schema.

If the optional schema parameter is not provided, the environment variable LOG_ENTRY_SCHEMA_URL will be used.

If the validation fails, return value will be false and the validationErrors() method can be called in order to obtain the text of any error message(s).

Parameters

$filename
containing Logentry XML
$schema
URL of XML schema to use for validation

Returns

boolean

Throws

Jlab\Eloglib\IOException
if XML file not readable
public static string;
# validationErrors( )

Returns the buffered error messages from the last XML validation attempt and clears the buffer.

Returns the buffered error messages from the last XML validation attempt and clears the buffer.

Returns

string;
public static
# getXMLresponse( stdClass $O, string $stat = 'ok' )

returns an XML Response entity.

returns an XML Response entity.

The XML of the wrapped inside tags like so 123456 https://logboks.jlab.org/entry/123456

Parameters

$O
object containing data to return
$stat
status to return (ok|fail)
protected
# hostOS( )
Properties summary
public static string $lastServerMsg

Stores the most recently returned message from saveToServer.

Stores the most recently returned message from saveToServer.

#
API documentation generated by ApiGen