Skip to content

ControllerTrait ​

Type
Trait
Namespace
craft\console
Implemented by
craft\console\Controller, craft\console\controllers\BackupController, craft\console\controllers\BaseSystemStatusController, craft\console\controllers\ClearCachesController, craft\console\controllers\ClearDeprecationsController, craft\console\controllers\DbController, craft\console\controllers\FixtureController, craft\console\controllers\GcController, craft\console\controllers\GraphqlController, craft\console\controllers\IndexAssetsController, craft\console\controllers\InstallController, craft\console\controllers\InvalidateTagsController, craft\console\controllers\MailerController, craft\console\controllers\MigrateController, craft\console\controllers\OffController, craft\console\controllers\OnController, craft\console\controllers\PluginController, craft\console\controllers\ProjectConfigController, craft\console\controllers\ResaveController, craft\console\controllers\RestoreController, craft\console\controllers\ServeController, craft\console\controllers\SetupController, craft\console\controllers\TestsController, craft\console\controllers\UpController, craft\console\controllers\UpdateController, craft\console\controllers\UsersController, craft\console\controllers\utils\AsciiFilenamesController, craft\console\controllers\utils\FixElementUidsController, craft\console\controllers\utils\PruneProvisionalDraftsController, craft\console\controllers\utils\PruneRevisionsController, craft\console\controllers\utils\RepairController, craft\console\controllers\utils\UpdateUsernamesController
Since
3.2.0

ConsoleControllerTrait implements the common methods and properties for console controllers.

View source

Protected Methods ​

MethodDescription
checkRootUser()Returns whether a command should be executed depending on whether it's being run as a root user, and whether they're OK with that.
checkTty()Sets yii\console\Controller::$interactive to false if this isn’t a TTY shell.
createAttributeValidator()Creates a function for the validator option of Controller::prompt.
outputCommand()

checkRootUser() ​

Since
3.7.0

Returns whether a command should be executed depending on whether it's being run as a root user, and whether they're OK with that.

View source

Returns ​

boolean

checkTty() ​

Since
3.6.1

Sets yii\console\Controller::$interactive to false if this isn’t a TTY shell.

View source

Returns ​

void

createAttributeValidator() ​

Since
3.7.0

Creates a function for the validator option of Controller::prompt.

View source

Arguments ​

Returns ​

callable

outputCommand() ​

View source

Arguments ​