ApplicationTrait

Type
Trait
Namespace
craft\base
Implemented by
craft\console\Application, craft\web\Application
Since
3.0

ApplicationTrait

View source

Public Properties

PropertyDescription
$envstring, null – The environment ID Craft is currently running in.
$minVersionRequiredstring, null – The minimum Craft build number required to update to this build.
$schemaVersionstring, null – Craft’s schema version number.

$env

Type
string, null

The environment ID Craft is currently running in.

View source

Signature

public string, null $env = null

$minVersionRequired

Type
string, null

The minimum Craft build number required to update to this build.

View source

Signature

public string, null $minVersionRequired = null

$schemaVersion

Type
string, null

Craft’s schema version number.

View source

Signature

public string, null $schemaVersion = null

Public Methods

MethodDescription
disableMaintenanceMode()Disables Maintenance Mode.
enableMaintenanceMode()Enables Maintenance Mode.
getApi()Returns the API service.
getAssetIndexer()Returns the asset indexing service.
getAssetTransforms()Returns the asset transforms service.
getAssets()Returns the assets service.
getCanTestEditions()Returns whether Craft is running on a domain that is eligible to test out the editions.
getCanUpgradeEdition()Returns whether Craft is eligible to be upgraded to a different edition.
getCategories()Returns the categories service.
getComposer()Returns the Composer service.
getConfig()Returns the config service.
getContent()Returns the content service.
getContentMigrator()Returns the content migration manager.
getDashboard()Returns the dashboard service.
getDeprecator()Returns the deprecator service.
getEdition()Returns the Craft edition.
getEditionName()Returns the name of the Craft edition.
getElementIndexes()Returns the element indexes service.
getElements()Returns the elements service.
getEntries()Returns the entries service.
getEntryRevisions()Returns the entry revisions service.
getFeeds()Returns the feeds service.
getFields()Returns the fields service.
getGlobals()Returns the globals service.
getHasWrongEdition()Returns whether Craft is running with the wrong edition.
getImages()Returns the images service.
getInfo()Returns the info model, or just a particular attribute.
getIsDbConnectionValid()Returns whether the DB connection settings are valid.
getIsInMaintenanceMode()Returns whether someone is currently performing a system update.
getIsInitialized()Returns whether Craft has been fully initialized.
getIsInstalled()Returns whether Craft is installed.
getIsMultiSite()Returns whether this Craft install has multiple sites.
getIsSystemOn()Returns whether the front end is accepting HTTP requests.
getLicensedEdition()Returns the edition Craft is actually licensed to run in.
getLicensedEditionName()Returns the name of the edition Craft is actually licensed to run in.
getLocale()Returns a Locale object for the target language.
getMailer()Returns the current mailer.
getMatrix()Returns the matrix service.
getMigrator()Returns the application’s migration manager.
getMutex()Returns the application’s mutex service.
getPath()Returns the path service.
getPluginStore()Returns the plugin store service.
getPlugins()Returns the plugins service.
getQueue()Returns the queue service.
getRelations()Returns the relations service.
getRoutes()Returns the routes service.
getSearch()Returns the search service.
getSections()Returns the sections service.
getSites()Returns the sites service.
getStructures()Returns the structures service.
getSystemMessages()Returns the system email messages service.
getSystemSettings()Returns the system settings service.
getSystemUid()Returns the system's UID.
getTags()Returns the tags service.
getTargetLanguage()Returns the target app language.
getTemplateCaches()Returns the template cache service.
getTokens()Returns the tokens service.
getUpdates()Returns the updates service.
getUserGroups()Returns the user groups service.
getUserPermissions()Returns the user permissions service.
getUsers()Returns the users service.
getUtilities()Returns the utilities service.
getVolumes()Returns the volumes service.
getYiiVersion()Returns the Yii framework version.
requireEdition()Requires that Craft is running an equal or better edition than what's passed in
saveInfo()Updates the info row.
setEdition()Sets the Craft edition.
setIsInstalled()Sets Craft's record of whether it's installed
updateTargetLanguage()Sets the target application language.

disableMaintenanceMode()

Signature

public boolean disableMaintenanceMode ( )

enableMaintenanceMode()

Signature

public boolean enableMaintenanceMode ( )

getApi()

Returns the API service.

View source

Returns

craft\services\Api – The API service

Signature

public craft\services\Api getApi ( )

getAssetIndexer()

Returns the asset indexing service.

View source

Returns

craft\services\AssetIndexer – The asset indexing service

Signature

public craft\services\AssetIndexer getAssetIndexer ( )

getAssetTransforms()

Returns the asset transforms service.

View source

Returns

craft\services\AssetTransforms – The asset transforms service

Signature

public craft\services\AssetTransforms getAssetTransforms ( )

getAssets()

Returns the assets service.

View source

Returns

craft\services\Assets – The assets service

Signature

public craft\services\Assets getAssets ( )

getCanTestEditions()

Returns whether Craft is running on a domain that is eligible to test out the editions.

View source

Returns

boolean

Signature

public boolean getCanTestEditions ( )

getCanUpgradeEdition()

Returns whether Craft is eligible to be upgraded to a different edition.

View source

Returns

boolean

Signature

public boolean getCanUpgradeEdition ( )

getCategories()

Returns the categories service.

View source

Returns

craft\services\Categories – The categories service

Signature

public craft\services\Categories getCategories ( )

getComposer()

Returns the Composer service.

View source

Returns

craft\services\Composer – The Composer service

Signature

public craft\services\Composer getComposer ( )

getConfig()

Returns the config service.

View source

Returns

craft\services\Config – The config service

Signature

public craft\services\Config getConfig ( )

getContent()

Returns the content service.

View source

Returns

craft\services\Content – The content service

Signature

public craft\services\Content getContent ( )

getContentMigrator()

Returns the content migration manager.

View source

Returns

craft\db\MigrationManager – The content migration manager

Signature

public craft\db\MigrationManager getContentMigrator ( )

getDashboard()

Returns the dashboard service.

View source

Returns

craft\services\Dashboard – The dashboard service

Signature

public craft\services\Dashboard getDashboard ( )

getDeprecator()

Returns the deprecator service.

View source

Returns

craft\services\Deprecator – The deprecator service

Signature

public craft\services\Deprecator getDeprecator ( )

getEdition()

Returns the Craft edition.

View source

Returns

integer

Signature

public integer getEdition ( )

getEditionName()

Returns the name of the Craft edition.

View source

Returns

string

Signature

public string getEditionName ( )

getElementIndexes()

Returns the element indexes service.

View source

Returns

craft\services\ElementIndexes – The element indexes service

Signature

public craft\services\ElementIndexes getElementIndexes ( )

getElements()

Returns the elements service.

View source

Returns

craft\services\Elements – The elements service

Signature

public craft\services\Elements getElements ( )

getEntries()

Returns the entries service.

View source

Returns

craft\services\Entries – The entries service

Signature

public craft\services\Entries getEntries ( )

getEntryRevisions()

Returns the entry revisions service.

View source

Returns

craft\services\EntryRevisions – The entry revisions service

Signature

public craft\services\EntryRevisions getEntryRevisions ( )

getFeeds()

Returns the feeds service.

View source

Returns

craft\feeds\Feeds – The feeds service

Signature

public craft\feeds\Feeds getFeeds ( )

getFields()

Returns the fields service.

View source

Returns

craft\services\Fields – The fields service

Signature

public craft\services\Fields getFields ( )

getGlobals()

Returns the globals service.

View source

Returns

craft\services\Globals – The globals service

Signature

public craft\services\Globals getGlobals ( )

getHasWrongEdition()

Returns whether Craft is running with the wrong edition.

View source

Returns

boolean

Signature

public boolean getHasWrongEdition ( )

getImages()

Returns the images service.

View source

Returns

\craft\services\Images – The images service

Signature

public \craft\services\Images getImages ( )

getInfo()

Returns the info model, or just a particular attribute.

View source

Returns

craft\models\Info

Throws

Signature

public craft\models\Info getInfo ( )

getIsDbConnectionValid()

Returns whether the DB connection settings are valid.

View source

Returns

boolean

Signature

public boolean getIsDbConnectionValid ( )

getIsInMaintenanceMode()

Returns whether someone is currently performing a system update.

See also:

View source

Returns

boolean

Signature

public boolean getIsInMaintenanceMode ( )

getIsInitialized()

Returns whether Craft has been fully initialized.

View source

Returns

boolean

Signature

public boolean getIsInitialized ( )

getIsInstalled()

Returns whether Craft is installed.

View source

Returns

boolean

Signature

public boolean getIsInstalled ( )

getIsMultiSite()

Returns whether this Craft install has multiple sites.

View source

Returns

boolean

Signature

public boolean getIsMultiSite ( )

getIsSystemOn()

Returns whether the front end is accepting HTTP requests.

View source

Returns

boolean

Signature

public boolean getIsSystemOn ( )

getLicensedEdition()

Returns the edition Craft is actually licensed to run in.

View source

Returns

integer, null

Signature

public integer, null getLicensedEdition ( )

getLicensedEditionName()

Returns the name of the edition Craft is actually licensed to run in.

View source

Returns

string, null

Signature

public string, null getLicensedEditionName ( )

getLocale()

Returns a Locale object for the target language.

View source

Returns

craft\i18n\Locale – The Locale object for the target language

Signature

public craft\i18n\Locale getLocale ( )

getMailer()

Returns the current mailer.

View source

Returns

craft\mail\Mailer – The mailer component

Signature

public craft\mail\Mailer getMailer ( )

getMatrix()

Returns the matrix service.

View source

Returns

craft\services\Matrix – The matrix service

Signature

public craft\services\Matrix getMatrix ( )

getMigrator()

Returns the application’s migration manager.

View source

Returns

craft\db\MigrationManager – The application’s migration manager

Signature

public craft\db\MigrationManager getMigrator ( )

getMutex()

Returns the application’s mutex service.

View source

Returns

yii\mutex\Mutex – The application’s mutex service

Signature

public yii\mutex\Mutex getMutex ( )

getPath()

Returns the path service.

View source

Returns

craft\services\Path – The path service

Signature

public craft\services\Path getPath ( )

getPluginStore()

Returns the plugin store service.

View source

Returns

craft\services\PluginStore – The plugin store service

Signature

public craft\services\PluginStore getPluginStore ( )

getPlugins()

Returns the plugins service.

View source

Returns

craft\services\Plugins – The plugins service

Signature

public craft\services\Plugins getPlugins ( )

getQueue()

Returns the queue service.

View source

Returns

yii\queue\db\Queue, craft\queue\QueueInterface – The queue service

Signature

public yii\queue\db\Queue, craft\queue\QueueInterface getQueue ( )

getRelations()

Returns the relations service.

View source

Returns

craft\services\Relations – The relations service

Signature

public craft\services\Relations getRelations ( )

getRoutes()

Returns the routes service.

View source

Returns

craft\services\Routes – The routes service

Signature

public craft\services\Routes getRoutes ( )

getSearch()

Returns the search service.

View source

Returns

craft\services\Search – The search service

Signature

public craft\services\Search getSearch ( )

getSections()

Returns the sections service.

View source

Returns

craft\services\Sections – The sections service

Signature

public craft\services\Sections getSections ( )

getSites()

Returns the sites service.

View source

Returns

craft\services\Sites – The sites service

Signature

public craft\services\Sites getSites ( )

getStructures()

Returns the structures service.

View source

Returns

craft\services\Structures – The structures service

Signature

public craft\services\Structures getStructures ( )

getSystemMessages()

Returns the system email messages service.

View source

Returns

craft\services\SystemMessages – The system email messages service

Signature

public craft\services\SystemMessages getSystemMessages ( )

getSystemSettings()

Returns the system settings service.

View source

Returns

craft\services\SystemSettings – The system settings service

Signature

public craft\services\SystemSettings getSystemSettings ( )

getSystemUid()

Returns the system's UID.

View source

Returns

string, null

Signature

public string, null getSystemUid ( )

getTags()

Returns the tags service.

View source

Returns

craft\services\Tags – The tags service

Signature

public craft\services\Tags getTags ( )

getTargetLanguage()

Returns the target app language.

View source

Arguments

  • $useUserLanguage (boolean) – Whether the user's preferred language should be used.

Returns

string

Signature

public string getTargetLanguage ( \craft\base\bool $useUserLanguage = true )

getTemplateCaches()

Returns the template cache service.

View source

Returns

craft\services\TemplateCaches – The template caches service

Signature

public craft\services\TemplateCaches getTemplateCaches ( )

getTokens()

Returns the tokens service.

View source

Returns

craft\services\Tokens – The tokens service

Signature

public craft\services\Tokens getTokens ( )

getUpdates()

Returns the updates service.

View source

Returns

craft\services\Updates – The updates service

Signature

public craft\services\Updates getUpdates ( )

getUserGroups()

Returns the user groups service.

View source

Returns

craft\services\UserGroups – The user groups service

Signature

public craft\services\UserGroups getUserGroups ( )

getUserPermissions()

Returns the user permissions service.

View source

Returns

craft\services\UserPermissions – The user permissions service

Signature

public craft\services\UserPermissions getUserPermissions ( )

getUsers()

Returns the users service.

View source

Returns

craft\services\Users – The users service

Signature

public craft\services\Users getUsers ( )

getUtilities()

Returns the utilities service.

View source

Returns

craft\services\Utilities – The utilities service

Signature

public craft\services\Utilities getUtilities ( )

getVolumes()

Returns the volumes service.

View source

Returns

craft\services\Volumes – The volumes service

Signature

public craft\services\Volumes getVolumes ( )

getYiiVersion()

Returns the Yii framework version.

View source

Returns

string

Signature

public string getYiiVersion ( )

requireEdition()

Requires that Craft is running an equal or better edition than what's passed in

View source

Arguments

  • $edition (integer) – The Craft edition to require.
  • $orBetter (boolean) – If true, makes $edition the minimum edition required.

Throws

Signature

public void requireEdition ( \craft\base\int $edition, \craft\base\bool $orBetter = true )

saveInfo()

Updates the info row.

View source

Arguments

Returns

boolean

Signature

public boolean saveInfo ( craft\models\Info $info )

setEdition()

Sets the Craft edition.

View source

Arguments

  • $edition (integer) – The edition to set.

Returns

boolean

Signature

public boolean setEdition ( \craft\base\int $edition )

setIsInstalled()

Sets Craft's record of whether it's installed

View source

Arguments

Signature

public void setIsInstalled ( $value = true )

updateTargetLanguage()

Sets the target application language.

View source

Arguments

  • $useUserLanguage (boolean, null) – Whether the user's preferred language should be used. If null, it will be based on whether it's a CP or console request.

Signature

public void updateTargetLanguage ( \craft\base\bool $useUserLanguage = null )