Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • areyouahuman
      • auth
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
        • default
      • exchange
        • rates
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • quickbooks
            • invoice
      • json
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • recaptcha
      • reports
        • aging
          • invoices
        • custom
          • report
        • invoice
          • creation
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • form
      • html
      • javascript
      • xml
    • lib
  • None
  • PHP

Classes

  • Accounts
  • ApiKeys
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • ModuleClientMeta
  • ModuleManager
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • Taxes
  • Themes
  • Transactions
  • Users

Class Logs

Log System

Model
Extended by AppModel
Extended by Logs
Package: blesta\app\models
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/models/logs.php

Methods summary

public
# __construct( )

Initialize Logs

Initialize Logs

Overrides

AppModel::__construct
public integer
# addEmail( array $vars )

Logs a single email

Logs a single email

Parameters

$vars
array
$vars An array of variable log info, including - company_id The company ID - to_client_id The client ID this log is to (optional) - from_staff_id The staff ID this log is from (optional) - to_address A To email address - from_address A From email address - from_name A from name - cc_address A comma separated list of CC addresses (optional) - subject An email subject - body_text Plain text email body (optional) - body_html HTML email body (optional) - sent Whether this email has been sent, either 0 (default) or 1 (optional) - error A message to be used on error

Returns

integer
The email log ID for this record, void if error
public integer
# addGateway( array $vars )

Logs a gateway requests

Logs a gateway requests

Parameters

$vars
array
$vars An array of variable log info, including - staff_id The staff ID - gateway_id The gateway ID - direction The direction type, either 'input' (default) or 'output' (optional) - url The URL - data Gateway data (optional) - from_name A from name - status The status type, either 'error' (default) or 'success' (optional) - group The gateway group

Returns

integer
The gateway log ID for this record, void if error
public integer
# addModule( array $vars )

Logs a module request

Logs a module request

Parameters

$vars
array
$vars An array of variable log info, including - staff_id The staff ID (optional) - module_id The module ID - direction The direction type, either 'input' (default) or 'output' (optional) - url The URL - data Gateway data (optional) - from_name A from name - status The status type, either 'error' (default) or 'success' (optional) - group The module group

Returns

integer
The module log ID for this record, void if error
public integer
# addUser( array $vars )

Logs a user log in

Logs a user log in

Parameters

$vars
array
$vars An array of variable log info, including - user_id The user ID - ip_address The IP address - company_id The company ID - result The result of the login attempt: - success - failure

Returns

integer
The user log ID for this record, void if error
public
# updateUser( integer $user_id, string $ip_address, integer $company_id )

Updates the user log for a user

Updates the user log for a user

Parameters

$user_id
integer
$user_id The user's ID
$ip_address
string
$ip_address The user's IP address
$company_id
integer
$company_id The company ID
public integer
# addContact( array $vars )

Logs a change to contact information

Logs a change to contact information

Parameters

$vars
array
$vars An array of contact change data including: - contact_id The ID of the contact that has been modified - fields An array of fields where the key if the field that changed and contains: - prev The value of the field prior to the update - cur The value of that field after the update

Returns

integer
The contact log ID for this record, void if error
public integer
# addAccountAccess( array $vars )

Logs access to customer payment account details

Logs access to customer payment account details

Parameters

$vars
array
$vars An array of access information including: - staff_id The ID of the staff member that accessed the account details - first_name The first name of the account holder - last_name The last name of the account holder - type The account type ('ach','cc') - account_type The ACH or CC account type (i.e. 'savings', or 'visa') - last4 The encrypted last 4 digits of the account number (must be encrypted using AppModel::systemEncrypt()) - account_id The ID of the account accessed (accounts_ach.id or accounts_cc.id)

Returns

integer
The account access log ID for this record, void if error

See

AppModel::systemEncrypt()
public integer
# addCron( array $vars )

Logs cron task details

Logs cron task details

Parameters

$vars
array
$vars An array of cron task information including: - run_id The cron task run ID - event This cron log event (optional, default "") - group The group associated with this cron event - output The output from running this task (optional) - start_date The date time that the cron task began running - end_date The date time that the cron task completed (optional)

Returns

integer
The cron log ID, or void on error
public
# updateCron( integer $cron_task_run_id, string $group, string $event = "", array $vars = array() )

Updates the cron log for a particular logged task

Updates the cron log for a particular logged task

Parameters

$cron_task_run_id
integer
$cron_task_run_id The cron task run ID of the logged task
$group
string
$group The group of the logged task
$event
string
$event The cron log event (optional, default "")
$vars
array
$vars An array of cron task information including: - output The output from running this task (optional) - end_date The date time that the cron task completed (optional)
public integer
# addTransaction( array $vars )

Logs a change to transaction information

Logs a change to transaction information

Parameters

$vars
array
$vars An array of transaction change data including: - staff_id The ID of the staff member that made the change (optional) - transaction_id The ID of the transaction that has been modified - fields An array of fields where the key if the field that changed and contains: - prev The value of the field prior to the update - cur The value of that field after the update

Returns

integer
The transaction log ID for this record, void if error
public mixed
# getModuleList( integer $page = 1, array $order_by = array('date_added'=>"DESC"), boolean $group_results = false )

Fetches a list of all module log entries

Fetches a list of all module log entries

Parameters

$page
integer
$page The page to return results for (optional, default 1)
$order_by
string
$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)
$group_results
boolean
$group_results True to group results by group, false to not group at all (useful for page nav, optional, default false)

Returns

mixed
An array of stdClass objects representing module logs, or false if no logs found
public integer
# getModuleListCount( boolean $group_results = false )

Returns the total number of module log entries returned from Logs::getModuleList(), useful in constructing pagination for the getModuleList() method.

Returns the total number of module log entries returned from Logs::getModuleList(), useful in constructing pagination for the getModuleList() method.

Parameters

$group_results
boolean
$group_results True to group results by group, false to not group at all (useful for page nav, optional, default false)

Returns

integer
The total number of module logs

See

Logs::getModuleList()
public mixed
# getModuleGroupList( string $group )

Retrieves a list of all module log entries for a particular module group

Retrieves a list of all module log entries for a particular module group

Parameters

$group
string
$group The name of the group whose logs to retrieve

Returns

mixed
An array of stdClass objects representing module logs for a particular group, false otherwise
public integer
# deleteModuleLogs( string $datetime )

Deletes all of the module logs up until the date given for the current company

Deletes all of the module logs up until the date given for the current company

Parameters

$datetime
string
$datetime The datetime of the earliest log to keep. All older logs will be purged

Returns

integer
The number of records deleted
public mixed
# getGatewayList( integer $page = 1, array $order_by = array('date_added'=>"DESC"), boolean $group_results = false )

Fetches a list of all gateway log entries

Fetches a list of all gateway log entries

Parameters

$page
integer
$page The page to return results for (optional, default 1)
$order_by
string
$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)
$group_results
boolean
$group_results True to group results by group, false to not group at all (useful for page nav, optional, default false)

Returns

mixed
An array of stdClass objects representing gateway logs, or false if no logs found
public integer
# getGatewayListCount( boolean $group_results = false )

Returns the total number of gateway log entries returned from Logs::getGatewayList(), useful in constructing pagination for the getGatewayList() method.

Returns the total number of gateway log entries returned from Logs::getGatewayList(), useful in constructing pagination for the getGatewayList() method.

Parameters

$group_results
boolean
$group_results True to group results by group, false to not group at all (useful for page nav, optional, default false)

Returns

integer
The total number of gateway logs

See

Logs::getGatewayList()
public mixed
# getGatewayGroupList( string $group )

Retrieves a list of all gateway log entries for a particular gateway group

Retrieves a list of all gateway log entries for a particular gateway group

Parameters

$group
string
$group The name of the group whose logs to retrieve

Returns

mixed
An array of stdClass objects representing gateway logs for a particular group, false otherwise
public integer
# deleteGatewayLogs( string $datetime )

Deletes all of the gateway logs up until the date given for the current company

Deletes all of the gateway logs up until the date given for the current company

Parameters

$datetime
string
$datetime The datetime of the earliest log to keep. All older logs will be purged

Returns

integer
The number of records deleted
public mixed
# getEmail( integer $email_log_id )

Fetches a single email log

Fetches a single email log

Parameters

$email_log_id
integer
$email_log_id The email log ID of the email to get

Returns

mixed
An stdClass representing the email log, or false if none found
public array
# getEmailList( integer $page = 1, array $order_by = array('date_sent'=>"DESC") )

Fetches a list of all email log entries

Fetches a list of all email log entries

Parameters

$page
integer
$page The page to return results for (optional, default 1)
$order_by
string
$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)

Returns

array
An array of stdClass objects representing email logs
public integer
# getEmailListCount( )

Returns the total number of email log entries returned from Logs::getEmailList(), useful in constructing pagination for the getEmailList() method.

Returns the total number of email log entries returned from Logs::getEmailList(), useful in constructing pagination for the getEmailList() method.

Returns

integer
The total number of email logs

See

Logs::getEmailList()
public integer
# deleteEmailLogs( string $datetime )

Deletes all of the email logs up until the date given for the current company

Deletes all of the email logs up until the date given for the current company

Parameters

$datetime
string
$datetime The datetime of the earliest log to keep. All older logs will be purged

Returns

integer
The number of records deleted
public mixed
# getUserLog( integer $user_id, string $type = "any" )

Fetches the last log entry for the given user

Fetches the last log entry for the given user

Parameters

$user_id
integer
$user_id The ID of the user
$type
string
$type The specific log result to fetch (optional), one of: - success The last successful log entry - failure The last failure log entry - any The last log entry (default)

Returns

mixed
An stdClass object representing the user log entry, or false if none exist
public mixed
# getUserList( integer $page = 1, array $order_by = array('date_added'=>"DESC") )

Fetches a list of all user log entries

Fetches a list of all user log entries

Parameters

$page
integer
$page The page to return results for (optional, default 1)
$order_by
string
$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)

Returns

mixed
An array of stdClass objects representing user logs, or false if no logs found
public integer
# getUserListCount( )

Returns the total number of user log entries returned from Logs::getUserList(), useful in constructing pagination for the getUserList() method.

Returns the total number of user log entries returned from Logs::getUserList(), useful in constructing pagination for the getUserList() method.

Returns

integer
The total number of user logs

See

Logs::getUserList()
public integer
# deleteUserLogs( string $datetime )

Deletes all of the users logs up until the date given for the current company

Deletes all of the users logs up until the date given for the current company

Parameters

$datetime
string
$datetime The datetime of the earliest log to keep. All older logs will be purged

Returns

integer
The number of records deleted
public mixed
# getContactList( integer $page = 1, array $order_by = array('date_changed'=>"DESC") )

Fetches a list of all contact log entries

Fetches a list of all contact log entries

Parameters

$page
integer
$page The page to return results for (optional, default 1)
$order_by
string
$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)

Returns

mixed
An array of stdClass objects representing contact logs, or false if no logs found
public integer
# getContactListCount( )

Returns the total number of contact log entries returned from Logs::getContactList(), useful in constructing pagination for the getContactList() method.

Returns the total number of contact log entries returned from Logs::getContactList(), useful in constructing pagination for the getContactList() method.

Returns

integer
The total number of contact logs

See

Logs::getContactList()
public integer
# deleteContactLogs( string $datetime )

Deletes all of the contact logs up until the date given for the current company

Deletes all of the contact logs up until the date given for the current company

Parameters

$datetime
string
$datetime The datetime of the earliest log to keep. All older logs will be purged

Returns

integer
The number of records deleted
public array
# getTransactionList( integer $page = 1, array $order_by = array('date_changed'=>"DESC") )

Fetches a list of all transaction log entries

Fetches a list of all transaction log entries

Parameters

$page
integer
$page The page to return results for (optional, default 1)
$order_by
string
$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)

Returns

array
An array of stdClass objects representing transaction logs
public integer
# getTransactionListCount( )

Returns the total number of transaction log entries returned from Logs::getTransactionLogs(), useful in constructing pagination for the getTransactionList() method.

Returns the total number of transaction log entries returned from Logs::getTransactionLogs(), useful in constructing pagination for the getTransactionList() method.

Returns

integer
The total number of transaction logs

See

Logs::getTransactionList()
public integer
# deleteTransactionLogs( string $datetime )

Deletes all of the transaction logs up until the date given for the current company

Deletes all of the transaction logs up until the date given for the current company

Parameters

$datetime
string
$datetime The datetime of the earliest log to keep. All older logs will be purged

Returns

integer
The number of records deleted
public mixed
# getAccountAccessList( integer $page = 1, array $order_by = array('date_accessed'=>"DESC") )

Fetches a list of all account access log entries

Fetches a list of all account access log entries

Parameters

$page
integer
$page The page to return results for (optional, default 1)
$order_by
string
$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)

Returns

mixed
An array of stdClass objects representing account access logs, or false if no logs found
public integer
# getAccountAccessListCount( )

Returns the total number of contact log entries returned from Logs::getAccountAccessList(), useful in constructing pagination for the getAccountAccessList() method.

Returns the total number of contact log entries returned from Logs::getAccountAccessList(), useful in constructing pagination for the getAccountAccessList() method.

Returns

integer
The total number of account access logs

See

Logs::getAccountAccessList()
public An
# getAccountAccessLog( integer $log_id )

Fetches account data that was accessed

Fetches account data that was accessed

Parameters

$log_id
integer
$log_id The access log ID

Returns

An
array of stdClass objects representing an account access log, or false if no log found
public integer
# deleteAccountAccessLogs( string $datetime )

Deletes all of the account access logs up until the date given for the current company

Deletes all of the account access logs up until the date given for the current company

Parameters

$datetime
string
$datetime The datetime of the earliest log to keep. All older logs will be purged

Returns

integer
The number of records deleted
public mixed
# getLatestCron( integer $cron_task_run_id, string $group = null )

Fetches the latest cron log for the given run task belonging to this company

Fetches the latest cron log for the given run task belonging to this company

Parameters

$cron_task_run_id
integer
$cron_task_run_id The cron task run ID
$group
string
$group The group the cron task is apart of (optional, default null)

Returns

mixed
An stdClass object representing the cron log for this task, or false if none exist
public mixed
# getCronLastRun( integer $cron_task_key, string $plugin_dir = null, boolean $system = false )

Fetches the date at which the given cron task has last been executed

Fetches the date at which the given cron task has last been executed

Parameters

$cron_task_key
integer
$cron_task_key The cron task key
$plugin_dir
string
$plugin_dir The plugin directory of the plugin this task belongs to (optional)
$system
boolean
$system True to fetch only system cron tasks, false to fetch company cron tasks (default false)

Returns

mixed
An stdClass object representing the date this cron task was last executed, or false if it has never run
public mixed
# getSystemCronLastRun( string $group = null )

Fetches the date at which the system cron has last been executed

Fetches the date at which the system cron has last been executed

Parameters

$group
string
$group The group the cron task is apart of (optional, default null)

Returns

mixed
An stdClass object representing the system cron, or false if it has never run
public
# clearCronTask( integer $cron_task_run_id, string $group = null )

Clears an incomplete cron task if it has not finished

Clears an incomplete cron task if it has not finished

Parameters

$cron_task_run_id
integer
$cron_task_run_id The cron task run ID
$group
string
$group The group the cron task is apart of (optional, default null)
public array
# getRunningCronTasks( integer $seconds = null )

Fetches a list of cron tasks that are currently running for this company within the past 24 hours (i.e. started but not finished)

Fetches a list of cron tasks that are currently running for this company within the past 24 hours (i.e. started but not finished)

Parameters

$seconds
integer
$seconds Filter on the number of seconds that have passed since the task has started but not yet completed (optional, null to fetch all tasks currently running)

Returns

array
A list of stdClass objects representing each cron task
public mixed
# getCronList( integer $page = 1, array $order_by = array('start_date'=>"DESC") )

Fetches a list of all cron log entries

Fetches a list of all cron log entries

Parameters

$page
integer
$page The page to return results for (optional, default 1)
$order_by
string
$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)

Returns

mixed
An array of stdClass objects representing user logs, or false if no logs found
public integer
# getCronListCount( )

Returns the total number of cron log entries returned from Logs::getCronList(), useful in constructing pagination for the getCronList() method.

Returns the total number of cron log entries returned from Logs::getCronList(), useful in constructing pagination for the getCronList() method.

Returns

integer
The total number of cron logs

See

Logs::getCronList()
public integer
# deleteCronLogs( string $datetime )

Deletes all of the cron logs up until the date given for the current company

Deletes all of the cron logs up until the date given for the current company

Parameters

$datetime
string
$datetime The datetime of the earliest log to keep. All older logs will be purged

Returns

integer
The number of records deleted
public boolean
# validateDirection( string $direction )

Validates the 'direction' field for module and gateway logs

Validates the 'direction' field for module and gateway logs

Parameters

$direction
string
$direction The direction

Returns

boolean
True if direction is validated, false otherwise
public boolean
# validateStatus( string $status )

Validates the 'status' field for module and gateway logs

Validates the 'status' field for module and gateway logs

Parameters

$status
string
$status The status

Returns

boolean
True if status is validated, false otherwise
public boolean
# validateType( string $type )

Validates the 'type' field for the account access logs

Validates the 'type' field for the account access logs

Parameters

$type
string
$type The type

Returns

boolean
True if type is validated, false otherwise
public boolean
# validateCronExists( integer $cron_task_run_id )

Validates that the given cron task run ID exists

Validates that the given cron task run ID exists

Parameters

$cron_task_run_id
integer
$cron_task_run_id The cron task run ID

Returns

boolean
True if the cron task run ID exists, false otherwise
public boolean
# validateCronLogUnique( string $group, integer $cron_task_run_id, string $event )

Checks whether the given cron task ID and group are unique

Checks whether the given cron task ID and group are unique

Parameters

$group
string
$group The cron task group
$cron_task_run_id
integer
$cron_task_run_id The cron task run ID
$event
string
$event The cron event

Returns

boolean
True if the given cron task run ID, group, and event are unique, false otherwise
public boolean
# validateUserLogExists( integer $user_id, string $ip_address, integer $company_id )

Checks whether the given information corresponds to a valid user log entry

Checks whether the given information corresponds to a valid user log entry

Parameters

$user_id
integer
$user_id The user's ID to check
$ip_address
string
$ip_address The IP address of the user
$company_id
integer
$company_id The ID of the company

Returns

boolean
True if the given information matches a user in the log, false otherwise

Methods inherited from AppModel

_(), boolToInt(), currencyToDecimal(), dateToUtc(), errors(), getPerPage(), ifSet(), loadCrypto(), setDefaultIfEmpty(), setPerPage(), setRulesIfSet(), strToBool(), systemDecrypt(), systemEncrypt(), systemHash(), truncateDecimal(), validateExists(), validateStateCountry()

Methods inherited from Model

affectedRows(), begin(), commit(), getConnection(), lastInsertId(), makeDSN(), prepare(), query(), rollBack(), setAttribute(), setFetchMode()

Magic methods summary

Properties summary

Properties inherited from AppModel

$replacement_keys

Blesta API documentation generated by ApiGen 2.8.0