Updates ​
- Type
- Class
- Namespace
- craft\services
- Inherits
- craft\services\Updates » yii\base\Component » yii\base\BaseObject
- Implements
- yii\base\Configurable
- Since
- 3.0.0
Updates service.
An instance of the service is available via Craft::$app->updates
.
Public Properties ​
Property | Description |
---|---|
areMigrationsPending | boolean |
behaviors | yii\base\Behavior – List of behaviors attached to this component. |
cacheKey | string |
hasCraftVersionChanged | boolean |
isCraftDbMigrationNeeded | boolean – Whether Craft needs to run any database migrations |
isCraftSchemaVersionCompatible | boolean – Whether the uploaded DB schema is equal to or greater than the installed schema |
isCraftUpdatePending | boolean |
isCriticalUpdateAvailable | boolean – Whether a critical update is available |
isPluginDbUpdateNeeded | boolean – Whether a plugin needs to run a database update |
isPluginUpdatePending | boolean |
isUpdateInfoCached | boolean – Whether the update info is cached |
isUpdatePending | boolean |
newPluginInfo | craft\base\PluginInterface |
pendingMigrationHandles | string[] |
totalAvailableUpdates | integer |
updates | craft\models\Updates |
wasCraftBreakpointSkipped | boolean – Whether the build stored in craft_info is less than the minimum required build on the file system |
areMigrationsPending
​
- Type
- boolean
- Default value
null
- Access
- Read-only
- Since
- 3.5.15
cacheKey
​
- Type
- string
- Default value
'updates'
hasCraftVersionChanged
​
- Type
- boolean
- Default value
null
- Access
- Read-only
isCraftDbMigrationNeeded
​
- Type
- boolean
- Default value
null
Whether Craft needs to run any database migrations
isCraftSchemaVersionCompatible
​
- Type
- boolean
- Default value
null
Whether the uploaded DB schema is equal to or greater than the installed schema
isCraftUpdatePending
​
- Type
- boolean
- Default value
null
- Access
- Read-only
- Since
- 4.0.0
isCriticalUpdateAvailable
​
- Type
- boolean
- Default value
null
Whether a critical update is available
isPluginDbUpdateNeeded
​
- Type
- boolean
- Default value
null
Whether a plugin needs to run a database update
isPluginUpdatePending
​
- Type
- boolean
- Default value
null
- Access
- Read-only
- Since
- 4.0.0
isUpdateInfoCached
​
- Type
- boolean
- Default value
null
Whether the update info is cached
isUpdatePending
​
- Type
- boolean
- Default value
null
- Access
- Read-only
- Since
- 3.6.15
newPluginInfo
​
- Type
- craft\base\PluginInterface
- Default value
null
- Access
- Write-only
pendingMigrationHandles
​
- Type
- string[]
- Default value
null
- Access
- Read-only
totalAvailableUpdates
​
- Type
- integer
- Default value
null
- Access
- Read-only
updates
​
- Type
- craft\models\Updates
- Default value
null
- Access
- Read-only
wasCraftBreakpointSkipped
​
- Type
- boolean
- Default value
null
Whether the build stored in craft_info is less than the minimum required build on the file system
Public Methods ​
Method | Description |
---|---|
__call() | Calls the named method which is not a class method. |
__clone() | This method is called after the object is created by cloning an existing one. |
__construct() | Constructor. |
__get() | Returns the value of a component property. |
__isset() | Checks if a property is set, i.e. defined and not null. |
__set() | Sets the value of a component property. |
__unset() | Sets a component property to be null. |
attachBehavior() | Attaches a behavior to this component. |
attachBehaviors() | Attaches a list of behaviors to the component. |
behaviors() | Returns a list of behaviors that this component should behave as. |
cacheUpdates() | Caches new update info. |
canGetProperty() | Returns a value indicating whether a property can be read. |
canSetProperty() | Returns a value indicating whether a property can be set. |
className() | Returns the fully qualified name of this class. |
detachBehavior() | Detaches a behavior from the component. |
detachBehaviors() | Detaches all behaviors from the component. |
ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. |
getAreMigrationsPending() | Returns whether there are any pending migrations. |
getBehavior() | Returns the named behavior object. |
getBehaviors() | Returns all behaviors attached to this component. |
getHasCraftVersionChanged() | Returns whether a different Craft version has been uploaded. |
getIsCraftSchemaVersionCompatible() | Returns whether the uploaded DB schema is equal to or greater than the installed schema. |
getIsCraftUpdatePending() | Returns whether Craft needs to run any database migrations. |
getIsCriticalUpdateAvailable() | Returns whether a critical update is available. |
getIsPluginUpdatePending() | Returns whether a plugin needs to run a database update. |
getIsUpdateInfoCached() | Returns whether the update info is cached. |
getIsUpdatePending() | Returns whether any Craft or plugin updates are pending. |
getPendingMigrationHandles() | Returns a list of things with updated schema versions. |
getTotalAvailableUpdates() | |
getUpdates() | |
getWasCraftBreakpointSkipped() | Returns true if the version stored in craft_info is less than the minimum required version on the file system. |
hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. |
hasMethod() | Returns a value indicating whether a method is defined. |
hasProperty() | Returns a value indicating whether a property is defined for this component. |
init() | Initializes the object. |
off() | Detaches an existing event handler from this component. |
on() | Attaches an event handler to an event. |
runMigrations() | Runs the pending migrations for the given list of handles. |
setNewPluginInfo() | |
trigger() | Triggers an event. |
updateCraftVersionInfo() | Updates the Craft version info in the craft_info table. |
cacheUpdates()
​
- Since
- 3.3.16
Caches new update info.
Arguments ​
$updateData
(array)
Returns ​
getAreMigrationsPending()
​
- Since
- 3.5.15
Returns whether there are any pending migrations.
Arguments ​
$includeContent
(boolean) – Whether pending content migrations should be considered
Returns ​
getHasCraftVersionChanged()
​
Returns whether a different Craft version has been uploaded.
Returns ​
getIsCraftSchemaVersionCompatible()
​
Returns whether the uploaded DB schema is equal to or greater than the installed schema.
Returns ​
getIsCraftUpdatePending()
​
- Since
- 4.0.0
Returns whether Craft needs to run any database migrations.
Returns ​
getIsCriticalUpdateAvailable()
​
Returns whether a critical update is available.
Arguments ​
$check
(boolean) – Whether to check for updates if they aren't cached already
Returns ​
getIsPluginUpdatePending()
​
- Since
- 4.0.0
Returns whether a plugin needs to run a database update.
Returns ​
getIsUpdateInfoCached()
​
Returns whether the update info is cached.
Returns ​
getIsUpdatePending()
​
- Since
- 3.6.15
Returns whether any Craft or plugin updates are pending.
Returns ​
getPendingMigrationHandles()
​
Returns a list of things with updated schema versions.
Craft CMS will be represented as "craft", plugins will be represented by their handles, and content will be represented as "content".
See also runMigrations()View source
Arguments ​
$includeContent
(boolean) – Whether pending content migrations should be considered
Returns ​
string[]
getTotalAvailableUpdates()
​
Arguments ​
$check
(boolean) – Whether to check for updates if they aren't cached already
Returns ​
getUpdates()
​
Arguments ​
$refresh
(boolean)
Returns ​
getWasCraftBreakpointSkipped()
​
Returns true if the version stored in craft_info is less than the minimum required version on the file system.
This effectively makes sure that a user cannot manually update past a manual breakpoint.
Returns ​
runMigrations()
​
Runs the pending migrations for the given list of handles.
See also getPendingMigrationHandles()View source
Arguments ​
$handles
(string[]) – The list of handles to run migrations for
Throws ​
setNewPluginInfo()
​
DEPRECATED
Deprecated in 3.7.13. Use craft\services\Plugins::updatePluginVersionInfo() instead.
Arguments ​
$plugin
(craft\base\PluginInterface)
Returns ​
updateCraftVersionInfo()
​
Updates the Craft version info in the craft_info table.