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 Updates service is globally accessible in Craft via Craft::$app->updates.

View source

Public Properties

cacheKey

Type
string

View source

hasCraftVersionChanged

Type
boolean
Access
Read-only

View source

isCraftDbMigrationNeeded

Type
boolean
Access
Read-only

View source

isCraftSchemaVersionCompatible

Type
boolean
Access
Read-only

View source

isCriticalUpdateAvailable

Type
boolean
Access
Read-only

View source

isPluginDbUpdateNeeded

Type
boolean
Access
Read-only

View source

isUpdateInfoCached

Type
boolean
Access
Read-only

View source

newPluginInfo

Type
craft\base\PluginInterface
Access
Write-only

View source

pendingMigrationHandles

Type
string[]
Access
Read-only

View source

totalAvailableUpdates

Type
integer
Access
Read-only

View source

updates

Type
craft\models\Updates
Access
Read-only

View source

wasCraftBreakpointSkipped

Type
boolean
Access
Read-only

View source

Public Methods

MethodDescription
__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 an object property.
__isset()Checks if a property is set, i.e. defined and not null.
__set()Sets value of an object property.
__unset()Sets an object property to 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.
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.
getBehavior()Returns the named behavior object.
getBehaviors()Returns all behaviors attached to this component.
getHasCraftVersionChanged()Returns whether a different Craft version has been uploaded.
getIsCraftDbMigrationNeeded()Returns whether Craft needs to run any database migrations.
getIsCraftSchemaVersionCompatible()Returns whether the uploaded DB schema is equal to or greater than the installed schema.
getIsCriticalUpdateAvailable()Returns whether a critical update is available.
getIsPluginDbUpdateNeeded()Returns whether a plugin needs to run a database update.
getIsUpdateInfoCached()Returns whether the update info is cached.
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. This This effectively makes sure that a user cannot manually update past a manual breakpoint.
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.
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.

getHasCraftVersionChanged()

Returns whether a different Craft version has been uploaded.

View source

Returns

boolean

getIsCraftDbMigrationNeeded()

Returns whether Craft needs to run any database migrations.

View source

Returns

boolean

getIsCraftSchemaVersionCompatible()

Returns whether the uploaded DB schema is equal to or greater than the installed schema.

View source

Returns

boolean

getIsCriticalUpdateAvailable()

Returns whether a critical update is available.

View source

Arguments

  • $check (boolean) – Whether to check for updates if they aren't cached already

Returns

boolean

getIsPluginDbUpdateNeeded()

Returns whether a plugin needs to run a database update.

View source

Returns

boolean

getIsUpdateInfoCached()

Returns whether the update info is cached.

View source

Returns

boolean

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()

View source

Arguments

  • $check (boolean) – Whether to check for updates if they aren't cached already

Returns

integer

getUpdates()

View source

Arguments

Returns

craft\models\Updates

getWasCraftBreakpointSkipped()

Returns true if the version stored in craft_info is less than the minimum required version on the file system. This This effectively makes sure that a user cannot manually update past a manual breakpoint.

View source

Returns

boolean

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()

View source

Arguments

Returns

boolean

updateCraftVersionInfo()

Updates the Craft version info in the craft_info table.

View source

Returns

boolean