Overview

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • auth
        • ldap
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
      • exchange
        • rates
          • currency
            • layer
          • fixer
          • open
            • exchange
              • rates
          • x
            • rates
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • perforated
            • invoice
          • quickbooks
            • invoice
          • templates
            • default
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • reports
        • aging
          • invoices
        • client
          • data
            • portability
        • custom
          • report
        • invoice
          • creation
        • package
          • revenue
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • core
      • Automation
        • Tasks
          • Common
          • Task
        • Type
          • Common
          • Cron
      • Pricing
        • ItemComparator
        • MetaItem
        • Modifier
          • Type
            • Description
              • Type
                • Discount
                • Option
                • Service
                • Tax
            • Discount
            • Price
            • Proration
        • Presenter
          • Build
            • Invoice
            • InvoiceData
            • Options
            • Service
            • ServiceChange
            • ServiceData
          • Collection
          • Format
            • Fields
            • Type
              • Discount
              • Item
              • Option
              • Options
              • Package
              • Pricing
              • Service
              • Tax
          • Items
            • Invoice
            • Service
          • Type
      • ServiceProviders
      • Util
        • Captcha
          • Captchas
          • Common
        • Common
          • Traits
        • Events
          • Common
          • Handlers
          • Observers
        • Filters
          • Common
        • GeoIp
        • Input
          • Fields
            • Common
        • Tax
        • Widgets
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • helpers
      • color
      • data
        • structure
  • None
  • PHP

Classes

  • Accounts
  • Actions
  • ApiKeys
  • Backup
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CouponTerms
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • EmailVerifications
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • MessageGroups
  • Messages
  • MessengerManager
  • ModuleClientMeta
  • ModuleManager
  • ModuleTypes
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • ServiceInvoices
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • SystemEvents
  • Taxes
  • Themes
  • Transactions
  • Users
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Class CronTasks

Cron Task management

Model
Extended by AppModel uses Blesta\Core\Util\Common\Traits\Container
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
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, string $task_type = 'plugin' )

Retrieves a cron task

Retrieves a cron task

Parameters

$key
The cron task key
$plugin_dir

The plugin directory of the plugin this cron task belongs to OR if $task_type is given, the directory that this cron task belongs to, plugin or not

$task_type

The type of task to fetch (one of 'system', 'plugin', or 'module'), default 'plugin' for backward compatibility

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

An array of key=>value fields including:

  • key A unique key representing this cron task
  • task_type The type of cron task this represents (system, module, or plugin)
  • dir The directory 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
The cron task ID to edit
$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
# deleteTask( integer $task_id, string $task_type, string $dir )

Deletes a cron task

Deletes a cron task

Parameters

$task_id
The ID of the cron task to delete
$task_type
The task's task_type (i.e., 'plugin', or 'module')
$dir
The directory 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
The cron task ID associated with this runnable task
$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
The cron task run ID
$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
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
The cron task run ID
$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, string $task_type = 'plugin' )

Retrieves a cron task and its company-specific run settings

Retrieves a cron task and its company-specific run settings

Parameters

$key
The cron task key
$plugin_dir

The plugin directory of the plugin this cron task belongs to OR if $task_type is given, the directory that this cron task belongs to, plugin or not (default null)

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

The type of task to fetch (one of 'system', 'plugin', or 'module'), (default 'plugin' for backward compatibility)

Returns

mixed
An stdClass object representing the runnable cron task, or false if one does not exist
public array
# getAllTaskRun( boolean $system = false, string $task_type = 'all', string $dir = null )

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
True to fetch only system cron tasks, false to fetch company cron tasks (default false)
$task_type

The type of task to fetch (i.e. 'system', 'plugin', 'module', or 'all' for any, default 'all')

$dir

The directory this cron task belongs to iff $task_type is 'plugin' or 'module' (optional)

Returns

array
A list of stdClass objects representing each cron task, or an empty array if none exist
public array
# getTaskTypes( )

Retrieves a list of the task types and their language

Retrieves a list of the task types and their language

Returns

array
A key/value list of task types and their language
Methods inherited from AppModel
_(), boolToInt(), currencyToDecimal(), dateToUtc(), errors(), getPerPage(), ifSet(), loadCrypto(), setDefaultIfEmpty(), setPerPage(), setRulesIfSet(), strToBool(), systemDecrypt(), systemEncrypt(), systemHash(), truncateDecimal(), validateExists(), validateStateCountry()
Methods used from Blesta\Core\Util\Common\Traits\Container
getFromContainer()
Properties inherited from AppModel
$logger, $replacement_keys
Blesta API documentation generated by ApiGen