Craft 3 Class Reference

Class craft\services\Updates

Inheritance
craft\services\Updates » yii\base\Component » yii\base\BaseObject
Implements
yii\base\Configurable
Available since version
3.0
Source Code
https://github.com/craftcms/cms/blob/master/src/services/Updates.php

Updates service.

An instance of the Updates service is globally accessible in Craft via Craft::$app->updates.

Public Properties
Property Type Description Defined By
$cacheKey string craft\services\Updates
Public Methods
Method Description Defined By
__call() Calls the named method which is not a class method. yii\base\BaseObject
__clone() This method is called after the object is created by cloning an existing one. yii\base\Component
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of an object property. yii\base\BaseObject
__isset() Checks if a property is set, i.e. defined and not null. yii\base\BaseObject
__set() Sets value of an object property. yii\base\BaseObject
__unset() Sets an object property to null. yii\base\BaseObject
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
behaviors() Returns a list of behaviors that this component should behave as. yii\base\Component
canGetProperty() Returns a value indicating whether a property can be read. yii\base\BaseObject
canSetProperty() Returns a value indicating whether a property can be set. yii\base\BaseObject
className() Returns the fully qualified name of this class. yii\base\BaseObject
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
getHasCraftVersionChanged() Returns whether a different Craft version has been uploaded. craft\services\Updates
getIsCraftDbMigrationNeeded() Returns whether Craft needs to run any database migrations. craft\services\Updates
getIsCraftSchemaVersionCompatible() Returns whether the uploaded DB schema is equal to or greater than the installed schema. craft\services\Updates
getIsCriticalUpdateAvailable() Returns whether a critical update is available. craft\services\Updates
getIsPluginDbUpdateNeeded() Returns whether a plugin needs to run a database update. craft\services\Updates
getIsUpdateInfoCached() Returns whether the update info is cached. craft\services\Updates
getPendingMigrationHandles() Returns a list of things with updated schema versions. craft\services\Updates
getTotalAvailableUpdates() craft\services\Updates
getUpdates() craft\services\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. craft\services\Updates
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMethod() Returns a value indicating whether a method is defined. yii\base\BaseObject
hasProperty() Returns a value indicating whether a property is defined. yii\base\BaseObject
init() Initializes the object. yii\base\BaseObject
off() Detaches an existing event handler from this component. yii\base\Component
on() Attaches an event handler to an event. yii\base\Component
runMigrations() Runs the pending migrations for the given list of handles. craft\services\Updates
setNewPluginInfo() craft\services\Updates
trigger() Triggers an event. yii\base\Component
updateCraftVersionInfo() Updates the Craft version info in the craft_info table. craft\services\Updates

Property Details

$cacheKey public property #

public string $cacheKey 'updates'

Method Details

getHasCraftVersionChanged() public method #

Returns whether a different Craft version has been uploaded.

public boolean getHasCraftVersionChanged ( )

getIsCraftDbMigrationNeeded() public method #

Returns whether Craft needs to run any database migrations.

public boolean getIsCraftDbMigrationNeeded ( )

getIsCraftSchemaVersionCompatible() public method #

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

public boolean getIsCraftSchemaVersionCompatible ( )

getIsCriticalUpdateAvailable() public method #

Returns whether a critical update is available.

public boolean getIsCriticalUpdateAvailable ( \craft\services\bool $check false )
$check boolean Whether to check for updates if they aren't cached already

getIsPluginDbUpdateNeeded() public method #

Returns whether a plugin needs to run a database update.

public boolean getIsPluginDbUpdateNeeded ( )

getIsUpdateInfoCached() public method #

Returns whether the update info is cached.

public boolean getIsUpdateInfoCached ( )

getPendingMigrationHandles() public method #

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

public string[] getPendingMigrationHandles ( $includeContent false )
$includeContent boolean Whether pending content migrations should be considered

getTotalAvailableUpdates() public method #

public integer getTotalAvailableUpdates ( \craft\services\bool $check false )
$check boolean Whether to check for updates if they aren't cached already

getUpdates() public method #

public craft\models\Updates getUpdates ( \craft\services\bool $refresh false )
$refresh boolean

getWasCraftBreakpointSkipped() public method #

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.

public boolean getWasCraftBreakpointSkipped ( )

runMigrations() public method #

Runs the pending migrations for the given list of handles.

See also getPendingMigrationHandles().

public void runMigrations ( array $handles )
$handles string[] The list of handles to run migrations for
throws craft\errors\MigrateException

setNewPluginInfo() public method #

public boolean setNewPluginInfo ( craft\base\PluginInterface $plugin )
$plugin craft\base\PluginInterface

updateCraftVersionInfo() public method #

Updates the Craft version info in the craft_info table.

public boolean updateCraftVersionInfo ( )