Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Log_Manager Class Reference
Inheritance diagram for Log_Manager:
Asset MySource_Object

Public Member Functions

 __construct ($assetid=0)
 
 create (Array &$link)
 
 _getAllowedLinks ()
 
 canClone ()
 
 getLogs ()
 
 getLogSettings ($logname)
 
getLogLine ($logname, $rotation_index=NULL, $offset=0)
 
 getLogSize ($logname, $rotation_index=NULL)
 
 getLogIterator ($logname, $rotation_index=NULL)
 
 rotateLogs ()
 
 rotateLog ($logname, &$log_data)
 
 getCommunicatorUrl ()
 
 paintBackend (Backend_Outputter $o)
 
- Public Member Functions inherited from Asset
 Asset ($assetid=0)
 
 create (Array &$link)
 
 load ($assetid)
 
 _loadDataPaths ()
 
 reload ()
 
 canDelete ()
 
 delete ($release_lock=TRUE, $check_locked=TRUE)
 
 useSystemVersion ()
 
 loadSystemVersion ()
 
 saveSystemVersion ()
 
 clearSystemVersion ()
 
 revertToSystemVersion ()
 
 revertNoticeLinksToSystemVersion ()
 
 _updated ($update_parents=TRUE)
 
 type ()
 
 getTypeAncestors ($include_asset=TRUE)
 
 incrementVersion ($number='micro', $update_parents=TRUE)
 
 getLanguages ()
 
 setLanguages (Array $languages)
 
 setCharset ($charset)
 
 setForceSecure ($force_secure)
 
 remapAssetids (Array $map)
 
 morph ($new_type_code)
 
 _morphCleanup ($new_type_code)
 
 onRequestKeywords (Asset $broadcaster, Array $vars=Array())
 
 canClone ()
 
 cloneComponents (Asset $clone, Array $components, $override=FALSE)
 
 cloneComponentsAdditional (Asset $clone, Array $components)
 
 cloneLinks (Asset $clone)
 
 getStatus ()
 
 getAvailableStatii ()
 
 getStatusDescription ()
 
 processStatusChange ($new_status, $update_parents=TRUE, $run_updated=TRUE)
 
 setDate ($date_type, $time=NULL, $userid=NULL)
 
 lockTypes ()
 
 canForceablyAcquireLock ($lock_type)
 
 getEditingLocks ($keywords)
 
 _getAllowedLinks ()
 
 createLink (Asset $minor, $link_type, $value='', $sort_order=NULL, $dependant='0', $exclusive='0', $moving=FALSE, $locked=0)
 
 prepareLink (Asset $asset, $side_of_link, &$link_type, &$value, &$sort_order, &$dependant, &$exclusive)
 
 canCreateLink (Asset $minor, $link_type, $exclusive)
 
 canMoveLink (Asset $minor, Asset $old_major, $link_type)
 
 describeLink ($linkid)
 
 isDeletableLink ($linkid)
 
 canDeleteLink ($linkid)
 
 deleteLink ($linkid, $check_locked=TRUE)
 
 linksUpdated ()
 
 canCloneLink ()
 
 saveAttributes ($dont_run_updated=FALSE, $log_message=TRUE)
 
 setAttrValue ($name, $value)
 
 attr ($name)
 
attrByRef ($name)
 
 getAttribute ($name, $mute_errors=FALSE)
 
 getAssetKeywords ($descriptions=FALSE)
 
 getAvailableKeywords ()
 
 getKeywordReplacement ($keyword)
 
 getAssetWebPathKeywordReplacement ()
 
 getCustomKeywordReplacements ($keywords=Array(), $invoke_backend=FALSE)
 
 processCustomKeywords ($keywords=Array())
 
 getContent ()
 
 setContent ()
 
 getEffectiveLastUpdatedTime ($assetids)
 
 readAccess (Array $assetids=Array())
 
 writeAccess ($lock_type='', Array $assetids=Array(), $only_workflow=TRUE)
 
 adminAccess ($lock_type='', Array $assetids=Array())
 
 backendAccess ()
 
 liveEditAccess ($lock_type)
 
 canliveEdit ($lock_type)
 
 effectiveUnrestricted ()
 
 checkAccess ($perm, $lock_type, Array $assetids=Array(), $only_workflow=TRUE)
 
 accessEffective ()
 
 permissionsUpdated ()
 
 printFrontend ()
 
 printFrontendAsset (Asset $asset, $design=NULL)
 
 getValidProtocols ()
 
 printHead ()
 
 printBody ()
 
 getCurrentPaintLayoutName ()
 
 getCurrentDesignName ()
 
 printBodyWithPaintLayout ($layout_id='')
 
 initLimbo ()
 
 printLimbo ()
 
 paintBackend (Backend_Outputter $o)
 
 getPrefix ()
 
 processBackend (Backend_Outputter $o, Array &$link)
 
 getEI ()
 
 getEditFns ()
 
 getBackendHref ($screen='', $backend_page=TRUE)
 
 getURL ($base_url=NULL, $ignore_rollback=FALSE, $base_contextid=NULL)
 
 getURLs ()
 
 getHref ($base_url=NULL, $ignore_rollback=FALSE)
 
 getWebDataPath ()
 
 getWebPaths ()
 
 saveWebPaths ($paths, $auto_add_remaps=TRUE)
 
 getLookups ($field='')
 
 getDesignLookups ()
 
 getLookupValues ($inherited=NULL, $prefix='', $like_search=TRUE, $ignore_override=FALSE)
 
 deleteLookupValue ($layout_name, $layout_value)
 
 setPaintLayouts ($layouts)
 
 updateLookups ($auto_add_remaps=TRUE)
 
 setLookupValues (Array $values)
 
 getAssetStatusDescriptionKeywordReplacement ()
 
 getAssetStatusColourKeywordReplacement ()
 
 replaceKeywordsInString ($string)
 
 fastTrack ($tasks)
 
 unFastTrack ($tasks)
 
 shouldFastTrack ($task, $assetid=NULL)
 
 getFaskTrackedTaskAssetids ($task)
 
 getDependantParentsURL ()
 
- Public Member Functions inherited from MySource_Object
 MySource_Object ()
 
 __sleep ()
 
 __wakeup ()
 

Protected Member Functions

 _getName ($short_name=FALSE)
 
 _getLogPrefixFromFileName ($file)
 
 _setLogDefaults ($log=Array())
 
 _decodeLine ($line)
 
 _readLineFromFile ($file, $offset=0)
 
 _getFileSize ($file)
 
 _rotateLogFiles ($file, $current_rotation, $new_rotation)
 
 _directCommunicator ()
 
- Protected Member Functions inherited from Asset
 _preCreateCheck (Array &$link)
 
 _createAdditional (Array &$link)
 
 _abortCreate ($trigger_level_changed=FALSE, $linkid=0)
 
 _loadVars ()
 
 _getName ($short_name=FALSE, $contextid=NULL)
 
 _getKeywordReplacement ($keyword)
 
 _checkPermissionAccess ($perm, $assetids=Array(), $only_workflow=TRUE)
 
 makeAndSaveInitialWebPath ($path, $parent_link=NULL)
 

Protected Attributes

 $log_level_map
 
 $min_tail_lines = 10
 

Additional Inherited Members

- Data Fields inherited from Asset
 $id = 0
 
 $version = ''
 
 $name = ''
 
 $short_name = ''
 
 $status
 
 $languages = ''
 
 $charset = ''
 
 $force_secure = '0'
 
 $created
 
 $created_userid
 
 $updated
 
 $updated_userid
 
 $published
 
 $published_userid
 
 $status_changed
 
 $status_changed_userid
 
 $_is_cacheable = FALSE
 
 $vars = Array()
 
 $_available_keywords = Array()
 
 $data_path_suffix = ''
 
 $data_path = ''
 
 $data_path_public = ''
 
 $_ser_attrs = FALSE
 

Detailed Description

Definition at line 30 of file log_manager.inc.

Constructor & Destructor Documentation

__construct (   $assetid = 0)

Constructor

Parameters
int$assetidthe asset id to be loaded

Definition at line 44 of file log_manager.inc.

Member Function Documentation

_decodeLine (   $line)
protected

Decodes a line after being read from a logfile

Returns an array in the following format:

Array(
      'userid'    => int,
      'user'      => string,
      'date'      => int,
      'level'     => int,
      'data'     => string|array,
      );

or FALSE if the metadata can't be decoded or the line is empty

Parameters
string$lineThe line of raw data to decode
Returns
mixed boolean|array private

Definition at line 333 of file log_manager.inc.

_directCommunicator ( )
protected

Direct Communicator

Performs the direct communication bypassing matrix interface

Returns
void public

Get the absolute co-ordinates of an element

Parameters
Objectelt The element to find the position of
Returns
Array The co-ordinates (x=>123, y=>456)

Scroll to the bottom of the page

Returns
boolean

Definition at line 664 of file log_manager.inc.

_getAllowedLinks ( )

Return an array of all the permitted link types, the type asset and the cardinality

Returns
array private
See Also
Asset::_getAllowLinks()

Definition at line 98 of file log_manager.inc.

_getFileSize (   $file)
protected

Returns the size (in bytes) of a particular file

Parameters
string$filethe file to read
Returns
int private

Definition at line 429 of file log_manager.inc.

_getLogPrefixFromFileName (   $file)
protected

Determines the prefix of a log by the filename

Returns FALSE if it can't work it out

Parameters
string$fileThe filename to get the prefix from
Returns
mixed boolean|string private

Definition at line 193 of file log_manager.inc.

_getName (   $short_name = FALSE)
protected

Return a name to use to describe this instance of the asset

Parameters
boolean$short_namewhether or not we are after the shortname or the full name
Returns
string private
See Also
Asset::_getName()

Definition at line 132 of file log_manager.inc.

_readLineFromFile (   $file,
  $offset = 0 
)
protected

Read a line starting from a particular offset, and return it along with the new offset

The returned array is in the format:

Array(
      'line'   => string   // the line read from the file
      'offset' => integer  // the new offset
      }
Parameters
string$filethe logfile to read
int$offsetthe offset from which the read will start, defaults to 0
Returns
mixed boolean|array private

Definition at line 392 of file log_manager.inc.

_rotateLogFiles (   $file,
  $current_rotation,
  $new_rotation 
)
protected

Rotate a logfile from the specified rotation index to the new rotation index. eg "$file.$current_index" to "$file.$new_rotation" if current_rotation is empty, we're trying to move 'file.log' for example to 'file.log.1' if it's not empty, we're moving 'file.log.1' to 'file.log.2'

Parameters
string$filethe logfile to rotate
string$current_rotationthe current rotation index
string$new_rotationthe new rotation index
Returns
boolean private

Definition at line 593 of file log_manager.inc.

_setLogDefaults (   $log = Array())
protected

Sets the default settings for 'logs', if they are not already set Returns the updated settings

Parameters
array$logThe array containing the settings for a particular log type, ie. $_vars['logs']['logname']
Returns
array private

Definition at line 299 of file log_manager.inc.

canClone ( )

Return FALSE always because we don't want to be able to clone a log manager

Returns
boolean public

Definition at line 116 of file log_manager.inc.

create ( Array &  $link)

Create this asset

Returns either the linkid or FALSE on error

Parameters
array&$linkinformation used to create the initial link
Returns
mixed int|boolean public
See Also
Asset::create()

Definition at line 63 of file log_manager.inc.

getCommunicatorUrl ( )

Get URL of this asset for direct communication

Returns a backend URL of this asset that can service direct connections (ignoring backend frames)

Returns
void public

Definition at line 623 of file log_manager.inc.

getLogIterator (   $logname,
  $rotation_index = NULL 
)

Returns a reference to a new Log_Iterator that acts as a bridge between a log_report and the log_manager

Parameters
string$lognamethe name of the log
NULL | int$rotation_indexthe index of the log rotation
Returns
object private

Definition at line 280 of file log_manager.inc.

& getLogLine (   $logname,
  $rotation_index = NULL,
  $offset = 0 
)

Returns a line from a specified logfile

Parameters
string$lognamethe logfile prefix
int$rotation_indexoptional, the rotation index of the past log to access
int$offsetstart from this offset
Returns
mixed boolean|array public

Definition at line 238 of file log_manager.inc.

getLogs ( )

Returns a list of all the logs and their details If an unregistered log is found in the log directory, this function will return it with default settings If no logs are found, an empty array will be returned

Logs are returned in the following format:

Array(
      logname => Array(
                       rotation => Array(
                                         last_timestamp        => int  // unix time
                                         min_index             => int  // the smallest index a log rotation can have
                                         max_index             => int  // the largest index a log rotation can have
                                         interval => int  // the number of seconds between rotations
                                         ),
                       ),
      )
Returns
array public

Definition at line 164 of file log_manager.inc.

getLogSettings (   $logname)

Returns the settings for one log (or FALSE if it doesn't exist)

Parameters
string$lognamethe name of the log
Returns
mixed boolean|array public

Definition at line 213 of file log_manager.inc.

getLogSize (   $logname,
  $rotation_index = NULL 
)

Returns the size of the log in bytes

Parameters
string$lognamethe name of the log to get the size of
NULL | int$rotation_indexthe index of the log rotation
Returns
int private

Definition at line 263 of file log_manager.inc.

paintBackend ( Backend_Outputter  $o)

Backend Painter

Parameters
Backend_Outputter$othe Backend Outputter class
Returns
void public

Definition at line 638 of file log_manager.inc.

rotateLog (   $logname,
$log_data 
)

Rotates the specified log, modifies and returns the settings it was passed

Parameters
string$lognamethe log to rotate
string&$log_datathe settings associated with the log
Returns
mixed boolean|array public

Get an array of existing log filenames Saves doing file_exists checks inside the while loop below but does have small room for a race condition

  • file exists when we do the glob
  • doesn't exist by the time we get to the rotate part. or vice-versa

Start at $max_index and work our way backwards. If the log exists, move it to the next name.

The max_index file is a special case the highest file just gets deleted, not moved. once we've dealt with the max_index case, skip to the next log to look at.

After moving the rest, move the original log file.

Definition at line 502 of file log_manager.inc.

rotateLogs ( )

Rotates all the logs in the system Returns a list of logs that were rotated

Returns
array public

Definition at line 453 of file log_manager.inc.


The documentation for this class was generated from the following file: