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 CronTasks

Cron Task management

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

Methods summary

public
# __construct( )

Initialize Cron Tasks

Initialize Cron Tasks

Overrides

AppModel::__construct
public mixed
# get( integer $id )

Retrieves a cron task

Retrieves a cron task

Parameters

$id
integer
$id The cron task ID

Returns

mixed
An stdClass object representing the cron task, or false if it does not exist
public mixed
# getByKey( string $key, string $plugin_dir = null )

Retrieves a cron task

Retrieves a cron task

Parameters

$key
string
$key The cron task key
$plugin_dir
string
$plugin_dir The plugin directory of the plugin this cron task belongs to

Returns

mixed
An stdClass object representing the cron task, or false if it does not exist
public array
# getAll( )

Retrieves a list of all cron tasks in the system

Retrieves a list of all cron tasks in the system

Returns

array
An array of stdClass objects representing each cron task
public mixed
# add( array $vars )

Adds a new cron task

Adds a new cron task

Parameters

$vars
array
$vars An array of key=>value fields including: - key A unique key representing this cron task - plugin_dir The plugin directory of the plugin this cron task belongs to (optional) - name The name of this cron task - description The description of this cron task (optional) - is_lang 1 if name and description are language definitions in the language file, 0 otherwise (optional, default 0) - type The type of cron task this is ("time" or "interval" based, optional, default "interval")

Returns

mixed
The cron task ID created, or void on error
public
# edit( integer $task_id, array $vars )

Edits a cron task

Edits a cron task

Parameters

$task_id
integer
$task_id The cron task ID to edit
$vars
array
$vars A list of key=>value fields to update, including: - name The name of this cron task - description The description of this cron task (optional) - is_lang 1 if name and description are language definitions in the language file, 0 otherwise (optional, default 0)
public
# delete( integer $task_id, integer $plugin_dir )

Deletes a plugin's cron task

Deletes a plugin's cron task

Parameters

$task_id
integer
$task_id The ID of this cron task
$plugin_dir
integer
$plugin_dir The plugin directory of the plugin this cron task belongs to
public mixed
# addTaskRun( integer $task_id, array $vars )

Sets when a cron task should run for a given company

Sets when a cron task should run for a given company

Parameters

$task_id
integer
$task_id The cron task ID associated with this runnable task
$vars
array
$vars A list of key=>value fields to add, including: - time The daily 24-hour time that this task should run (e.g. "14:25", optional, required if interval is not given) - interval The interval, in minutes, that this cron task should run (optional, required if time is not given) - enabled 1 if this cron task is enabled, 0 otherwise (optional, default 1)

Returns

mixed
The cron task run ID created, or void on error
public
# editTaskRun( integer $task_run_id, array $vars )

Updates when a cron task should run for the given company

Updates when a cron task should run for the given company

Parameters

$task_run_id
integer
$task_run_id The cron task run ID
$vars
array
$vars A list of key=>value fields to update, including: - time The daily 24-hour time that this task should run (e.g. "14:25", optional, required if interval is not given) - interval The interval, in minutes, that this cron task should run (optional, required if time is not given) - enabled 1 if this cron task is enabled, 0 otherwise (optional, default 1)
public
# deleteTaskRun( integer $task_run_id )

Deletes when a cron task should run for the given company. NOTE: This will also delete the cron task itself iff the cron task is no longer used by any other company and this cron task is related to a plugin

Deletes when a cron task should run for the given company. NOTE: This will also delete the cron task itself iff the cron task is no longer used by any other company and this cron task is related to a plugin

Parameters

$task_run_id
integer
$task_run_id The cron task run ID
public mixed
# getTaskRun( integer $task_run_id, boolean $system = false )

Retrieves a cron task and its company-specific run settings

Retrieves a cron task and its company-specific run settings

Parameters

$task_run_id
integer
$task_run_id The cron task run ID
$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 runnable cron task, or false if one does not exist
public mixed
# getTaskRunByKey( string $key, string $plugin_dir = null, boolean $system = false )

Retrieves a cron task and its company-specific run settings

Retrieves a cron task and its company-specific run settings

Parameters

$key
string
$key The cron task key
$plugin_dir
string
$plugin_dir The cron task plugin directory (optional, default null)
$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 runnable cron task, or false if one does not exist
public array
# getAllTaskRun( boolean $system = false )

Retrieves a list of all cron tasks and their company-specific run settings for this company

Retrieves a list of all cron tasks and their company-specific run settings for this company

Parameters

$system
boolean
$system True to fetch only system cron tasks, false to fetch company cron tasks (default false)

Returns

array
A list of stdClass objects representing each cron task, or an empty array if none exist
public boolean
# validateKeyUnique( string $key, string $plugin_dir, integer $cron_task_id = null )

Validates whether the given cron task key and plugin directory are in use by another cron task

Validates whether the given cron task key and plugin directory are in use by another cron task

Parameters

$key
string
$key The key to check
$plugin_dir
string
$plugin_dir The plugin directory
$cron_task_id
integer
$cron_task_id The cron task ID to exclude from the check (optional)

Returns

boolean
True if the given key is unique, false otherwise
public boolean
# validateTaskType( string $type )

Validates that the given task type is a valid type

Validates that the given task type is a valid type

Parameters

$type
string
$type The cron task type

Returns

boolean
True if the type is valid, 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