Upgrade4_0_0B1 extends UpgradeUtil
Upgrades to version 4.0.0-b1
Table of Contents
Properties
| $tasks |
Methods
| __construct() | Setup |
| addConfig() | Adds a config setting to the given file |
| addDefaultClientTheme() | Adds a new default client theme |
| addDefaultTheme() | Adds a new default admin theme |
| editConfig() | Updates a config setting in the given file with the given value |
| errors() | Return all validation errors encountered |
| fixPaymentApprovedCompanyEmailTag() | Fixes the CC and ACH Payment Approved email template {company.name} tag |
| getEnvironment() | Fetches the current tasks environment |
| mergeConfig() | Extracts all config settings from $file, merges their values into $template and writes the result back in $file. |
| process() | Processes the given task |
| removeCompanyTaxIdInheritance() | Makes the tax_id setting uninheritable for all companies |
| rollback() | Rolls back all tasks completed for the upgrade process |
| setEnvironment() | Set the environment where the task are going to be executed |
| tasks() | Returns a numerically indexed array of tasks to execute for the upgrade process |
| updateAdminThemeSettings() | Updates all admin themes to include new theme settings |
| newRecord() | Creates a new database connection |
| replaceConfig() | Replaces a config setting within the context of a string |
| addTheme() | Adds the new default FOUR theme |
| getAllCompanies() | Retrieves a list of all companies |
| getAllLanguages() | Retrieves a list of all languages installed for this company |
| getEmail() | Retrieves an email template |
| getTheme() | Retrieves the theme fields for the new FOUR admin theme |
| switchThemes() | Adds the default Blesta Blue theme to every company and sets the default theme to the new theme on companies that are using Blesta Blue |
Methods
__construct()
Setup
public
__construct() : mixed
addConfig()
Adds a config setting to the given file
public
addConfig(string $file, string $key, mixed $value) : mixed
Parameters
- $file : string
-
The full path to the config file
- $key : string
-
The config setting name
- $value : mixed
-
The config setting value
addDefaultClientTheme()
Adds a new default client theme
public
addDefaultClientTheme([bool $undo = false ]) : mixed
Parameters
- $undo : bool = false
-
Whether to add or undo the change
addDefaultTheme()
Adds a new default admin theme
public
addDefaultTheme([bool $undo = false ]) : mixed
Parameters
- $undo : bool = false
-
Whether to add or undo the change
editConfig()
Updates a config setting in the given file with the given value
public
editConfig(string $file, string $key, mixed $value) : mixed
Parameters
- $file : string
-
The full path to the config file
- $key : string
-
The config setting name
- $value : mixed
-
The config setting value
errors()
Return all validation errors encountered
public
errors() : mixed
Return values
mixed —Boolean false if no errors encountered, an array of errors otherwise
fixPaymentApprovedCompanyEmailTag()
Fixes the CC and ACH Payment Approved email template {company.name} tag
public
fixPaymentApprovedCompanyEmailTag([bool $undo = false ]) : mixed
Parameters
- $undo : bool = false
-
Whether to add or undo the change
getEnvironment()
Fetches the current tasks environment
public
getEnvironment() : string
Return values
string —The environment where the tasks are running
mergeConfig()
Extracts all config settings from $file, merges their values into $template and writes the result back in $file.
public
mergeConfig(string $file, string $template) : mixed
Parameters
- $file : string
-
The full path to the config
- $template : string
-
The full path to the config template
process()
Processes the given task
public
process(string $task) : mixed
Parameters
- $task : string
-
The task to process
removeCompanyTaxIdInheritance()
Makes the tax_id setting uninheritable for all companies
public
removeCompanyTaxIdInheritance([bool $undo = false ]) : mixed
Parameters
- $undo : bool = false
-
Whether to add or undo the change
rollback()
Rolls back all tasks completed for the upgrade process
public
rollback() : mixed
setEnvironment()
Set the environment where the task are going to be executed
public
setEnvironment(string $environment) : mixed
Parameters
- $environment : string
-
The environment where the upgrade tasks are running, "install" or "upgrade"
tasks()
Returns a numerically indexed array of tasks to execute for the upgrade process
public
tasks() : mixed
Tags
updateAdminThemeSettings()
Updates all admin themes to include new theme settings
public
updateAdminThemeSettings([bool $undo = false ]) : mixed
Parameters
- $undo : bool = false
-
True to undo the change, or false to perform the change
newRecord()
Creates a new database connection
protected
newRecord() : Record
Return values
Record —a new instance of Record
replaceConfig()
Replaces a config setting within the context of a string
protected
replaceConfig(string $key, string $value, string $contents) : string
Parameters
- $key : string
-
The config key to replace the value of
- $value : string
-
The new value
- $contents : string
-
The context in which the $key is set
Return values
string —$contents with the given $value replaced
addTheme()
Adds the new default FOUR theme
private
addTheme([bool $undo = false ][, string $type = 'admin' ]) : mixed
Parameters
- $undo : bool = false
-
Whether to undo the theme
- $type : string = 'admin'
-
The type of theme to add, 'admin' or 'client', default 'admin'
getAllCompanies()
Retrieves a list of all companies
private
getAllCompanies() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of stdClass objects representing each company
getAllLanguages()
Retrieves a list of all languages installed for this company
private
getAllLanguages(int $company_id) : array<string|int, mixed>
Parameters
- $company_id : int
-
The company ID
Return values
array<string|int, mixed> —An array of stdClass objects representing each company
getEmail()
Retrieves an email template
private
getEmail(int $company_id, string $email_action, string $language_code) : mixed
Parameters
- $company_id : int
-
The company ID
- $email_action : string
-
The email action
- $language_code : string
-
The email language
Return values
mixed —An stdClass object representing the email, otherwise bool false
getTheme()
Retrieves the theme fields for the new FOUR admin theme
private
getTheme([string $type = 'admin' ]) : array<string|int, mixed>
Parameters
- $type : string = 'admin'
-
The type of theme, 'admin' or 'client', default admin
Return values
array<string|int, mixed> —The theme fields
switchThemes()
Adds the default Blesta Blue theme to every company and sets the default theme to the new theme on companies that are using Blesta Blue
private
switchThemes(int $theme_id[, string $type = 'admin' ]) : mixed
Parameters
- $theme_id : int
-
The ID of the new theme
- $type : string = 'admin'
-
The type of theme, 'admin' or 'client', default admin