PHP 클래스 LogModel, vanilla

상속: extends Model
파일 보기 프로젝트 열기: vanilla/vanilla 1 사용 예제들

공개 메소드들

메소드 설명
arrayFlipAndCombine ( array $array ) : array | null Takes an array and returns a flip, making values the keys and making the keys values.
beginTransaction ( ) Begin a log transaction.
delete ( int[] | string $LogIDs ) Purge entries from the log.
endTransaction ( ) End a log transaction.
formatConfiguration ( array $Data ) : string Format a configuration subtree.
formatContent ( array $Log ) : string Format the content of a log file.
formatDiff ( string $Old, string $New, string $Method = 'html' ) : string | array Format a diff of an edit.
formatKey ( string $Key, array $Data ) : string Format a specific column from the log.
formatRecord ( string[] $Keys, array $Data ) : string Format a record that the log points to.
getCountWhere ( array $Where ) : integer Get the count of log entries matching a query.
getIDs ( int[] | string $IDs ) : array Get the log rows by array of IDs.
getOperationCount ( string $Operation ) : integer A wrapper for GetCountWhere that takes care of caching specific operation counts.
getWhere ( array | false $Where = false, string $OrderFields = '', string $OrderDirection = 'asc', boolean $Offset = false, boolean $Limit = false ) : array Get log rows by a query.
insert ( string $Operation, string $RecordType, array $Data, array $Options = [] ) : integer | false Log an operation into the log table.
logChange ( string $Operation, string $RecordType, array $NewData, array | null $OldData = null ) Log a record edit.
recalculate ( ) Recalculate a record after a log operation.
restore ( array | integer $Log, boolean $DeleteLog = true ) Restore an entry from the log.

비공개 메소드들

메소드 설명
instance ( ) : LogModel Returns the shared instance of this class.
logValue ( array $Data, string $LogKey, string $BakKey1 = '', string $BakKey2 = '' ) : mixed Get a value from a log entry.
restoreOne ( array $Log, boolean $DeleteLog = true ) Restores a single entry from the log.

메소드 상세

arrayFlipAndCombine() 공개 메소드

In case of multiple values with the several occurrences, this reserves all original keys by pushing them onto an array.
public arrayFlipAndCombine ( array $array ) : array | null
$array array An array in the format {[id1] => count, [id2] => count }.
리턴 array | null A 2D array the format {[count] => [id1, id2]}

beginTransaction() 공개 정적인 메소드

Begin a log transaction.
public static beginTransaction ( )

delete() 공개 메소드

Purge entries from the log.
public delete ( int[] | string $LogIDs )
$LogIDs int[] | string An array or CSV of log IDs.

endTransaction() 공개 정적인 메소드

End a log transaction.
public static endTransaction ( )

formatConfiguration() 공개 메소드

Format a configuration subtree.
public formatConfiguration ( array $Data ) : string
$Data array The data to format.
리턴 string Returns the formatted entry.

formatContent() 공개 메소드

Format the content of a log file.
public formatContent ( array $Log ) : string
$Log array The log entry to format.
리턴 string Returns the formatted log entry.

formatDiff() 공개 메소드

Format a diff of an edit.
public formatDiff ( string $Old, string $New, string $Method = 'html' ) : string | array
$Old string The record before the edit.
$New string The record after the edit.
$Method string Either **normal**, **html**, or **mixed**.
리턴 string | array Returns the diff formatted according to {@link $Method}.

formatKey() 공개 메소드

Format a specific column from the log.
public formatKey ( string $Key, array $Data ) : string
$Key string The key in the log row to format.
$Data array The log row.
리턴 string Returns the formatted entry.

formatRecord() 공개 메소드

Format a record that the log points to.
public formatRecord ( string[] $Keys, array $Data ) : string
$Keys string[] The keys to use from the record.
$Data array The log row.
리턴 string Returns the formatted record.

getCountWhere() 공개 메소드

Get the count of log entries matching a query.
public getCountWhere ( array $Where ) : integer
$Where array The filter.
리턴 integer Returns the count.

getIDs() 공개 메소드

Get the log rows by array of IDs.
public getIDs ( int[] | string $IDs ) : array
$IDs int[] | string And array or CSV of IDs.
리턴 array Returns an array of log rows.

getOperationCount() 공개 메소드

A wrapper for GetCountWhere that takes care of caching specific operation counts.
public getOperationCount ( string $Operation ) : integer
$Operation string Comma-delimited list of operation types to get (sum of) counts for.
리턴 integer Returns a count.

getWhere() 공개 메소드

Get log rows by a query.
public getWhere ( array | false $Where = false, string $OrderFields = '', string $OrderDirection = 'asc', boolean $Offset = false, boolean $Limit = false ) : array
$Where array | false The where filter.
$OrderFields string The fields to order by.
$OrderDirection string The order direction.
$Offset boolean The database offset.
$Limit boolean The database limit.
리턴 array Returns a data set.

insert() 공개 정적인 메소드

Log an operation into the log table.
public static insert ( string $Operation, string $RecordType, array $Data, array $Options = [] ) : integer | false
$Operation string The operation being performed. This is usually one of: - Delete: The record has been deleted. - Edit: The record has been edited. - Spam: The record has been marked spam. - Moderate: The record requires moderation. - Pending: The record needs pre-moderation.
$RecordType string The type of record being logged. This usually correspond to the tablename of the record.
$Data array The record data. - If you are logging just one row then pass the row as an array. - You can pass an additional _New element to tell the logger what the new data is.
$Options array Additional options to affect the insert.
리턴 integer | false The log ID or **false** if there was a problem.

logChange() 공개 정적인 메소드

Log a record edit.
public static logChange ( string $Operation, string $RecordType, array $NewData, array | null $OldData = null )
$Operation string The specific operation being logged.
$RecordType string The type of record. This matches the name of the record's table.
$NewData array The record after the edit.
$OldData array | null The record before the edit.

recalculate() 공개 메소드

Recalculate a record after a log operation.
public recalculate ( )

restore() 공개 메소드

Restore an entry from the log.
public restore ( array | integer $Log, boolean $DeleteLog = true )
$Log array | integer The log row or the ID of the log row.
$DeleteLog boolean Whether or not to delete the log row after restoring.