dolibarr 18.0.6
|
Class to manage Blocked Log. More...
Public Member Functions | |
__construct (DoliDB $db) | |
Constructor. | |
loadTrackedEvents () | |
Load list of tracked events into $this->trackedevents. | |
getObjectLink () | |
Try to retrieve source object (it it still exists). | |
getUser () | |
setObjectData (&$object, $action, $amounts, $fuser=null) | |
Populate properties of log from object data. | |
fetch ($id) | |
Get object from database. | |
dolEncodeBlockedData ($data, $mode=0) | |
Encode data. | |
dolDecodeBlockedData ($data, $mode=0) | |
Decode data. | |
setCertified () | |
Set block certified by authority. | |
create ($user, $forcesignature='') | |
Create blocked log in database. | |
checkSignature ($previoushash='', $returnarray=0) | |
Check if current signature still correct compared to the value in chain. | |
getPreviousHash ($withlock=0, $beforeid=0) | |
Get previous signature/hash in chain. | |
getLog ($element, $fk_object, $limit=0, $sortfield='', $sortorder='', $search_fk_user=-1, $search_start=-1, $search_end=-1, $search_ref='', $search_amount='', $search_code='') | |
Return array of log objects (with criterias) | |
getSignature () | |
Return the signature (hash) of the "genesis-block" (Block 0). | |
alreadyUsed ($ignoresystem=0) | |
Check if module was already used or not for at least one recording. | |
Private Member Functions | |
buildKeyForSignature () | |
Return a string for signature. | |
Class to manage Blocked Log.
Definition at line 26 of file blockedlog.class.php.
BlockedLog::__construct | ( | DoliDB | $db | ) |
Constructor.
Definition at line 126 of file blockedlog.class.php.
BlockedLog::alreadyUsed | ( | $ignoresystem = 0 | ) |
Check if module was already used or not for at least one recording.
int | $ignoresystem | Ignore system events for the test |
Definition at line 1195 of file blockedlog.class.php.
References dol_print_error(), and dol_syslog().
|
private |
Return a string for signature.
Note: rowid of line not included as it is not a business data and this allow to make backup of a year and restore it into another database with different id wihtout comprimising checksums
Definition at line 1020 of file blockedlog.class.php.
Referenced by checkSignature(), and create().
BlockedLog::checkSignature | ( | $previoushash = '', | |
$returnarray = 0 ) |
Check if current signature still correct compared to the value in chain.
string | $previoushash | If previous signature hash is known, we can provide it to avoid to make a search of it in database. |
int | $returnarray | 1=Return array of details, 2=Return array of details including keyforsignature, 0=Boolean |
Definition at line 982 of file blockedlog.class.php.
References buildKeyForSignature(), dol_hash(), and getPreviousHash().
BlockedLog::create | ( | $user, | |
$forcesignature = '' ) |
Create blocked log in database.
User | $user | Object user that create |
int | $forcesignature | Force signature (for example '0000000000' when we disabled the module) |
Definition at line 855 of file blockedlog.class.php.
References buildKeyForSignature(), dol_hash(), dol_now(), dol_syslog(), dolEncodeBlockedData(), and getPreviousHash().
BlockedLog::dolDecodeBlockedData | ( | $data, | |
$mode = 0 ) |
Decode data.
string | $data | Data to unserialize |
string | $mode | 0=unserialize, 1=json_decode |
Definition at line 819 of file blockedlog.class.php.
References jsonOrUnserialize().
Referenced by fetch().
BlockedLog::dolEncodeBlockedData | ( | $data, | |
$mode = 0 ) |
Encode data.
string | $data | Data to serialize |
string | $mode | 0=serialize, 1=json_encode |
Definition at line 799 of file blockedlog.class.php.
Referenced by create().
BlockedLog::fetch | ( | $id | ) |
Get object from database.
int | $id | Id of object to load |
Definition at line 734 of file blockedlog.class.php.
References dolDecodeBlockedData(), and ref.
BlockedLog::getLog | ( | $element, | |
$fk_object, | |||
$limit = 0, | |||
$sortfield = '', | |||
$sortorder = '', | |||
$search_fk_user = -1, | |||
$search_start = -1, | |||
$search_end = -1, | |||
$search_ref = '', | |||
$search_amount = '', | |||
$search_code = '' ) |
Return array of log objects (with criterias)
string | $element | element to search |
int | $fk_object | id of object to search |
int | $limit | max number of element, 0 for all |
string | $sortfield | sort field |
string | $sortorder | sort order |
int | $search_fk_user | id of user(s) |
int | $search_start | start time limit |
int | $search_end | end time limit |
string | $search_ref | search ref |
string | $search_amount | search amount |
string | $search_code | search code |
Definition at line 1087 of file blockedlog.class.php.
References natural_search().
BlockedLog::getObjectLink | ( | ) |
Try to retrieve source object (it it still exists).
Definition at line 223 of file blockedlog.class.php.
BlockedLog::getPreviousHash | ( | $withlock = 0, | |
$beforeid = 0 ) |
Get previous signature/hash in chain.
int | $withlock | 1=With a lock |
int | $beforeid | ID of a record |
Definition at line 1038 of file blockedlog.class.php.
References dol_print_error(), and getSignature().
Referenced by checkSignature(), and create().
BlockedLog::getSignature | ( | ) |
Return the signature (hash) of the "genesis-block" (Block 0).
Definition at line 1169 of file blockedlog.class.php.
References dol_hash(), dolibarr_set_const(), and getRandomPassword().
Referenced by getPreviousHash().
BlockedLog::getUser | ( | ) |
BlockedLog::loadTrackedEvents | ( | ) |
Load list of tracked events into $this->trackedevents.
Definition at line 137 of file blockedlog.class.php.
BlockedLog::setCertified | ( | ) |
Set block certified by authority.
Definition at line 837 of file blockedlog.class.php.
BlockedLog::setObjectData | ( | & | $object, |
$action, | |||
$amounts, | |||
$fuser = null ) |
Populate properties of log from object data.
Object | $object | object to store |
string | $action | action |
string | $amounts | amounts |
User | $fuser | User object (forced) |
Definition at line 366 of file blockedlog.class.php.
References dol_getIdFromCode(), and dol_syslog().