本文整理汇总了PHP中yii\console\Controller::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::init方法的具体用法?PHP Controller::init怎么用?PHP Controller::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\console\Controller
的用法示例。
在下文中一共展示了Controller::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
$this->token = (require __DIR__ . '/token.php');
$this->datePath = __DIR__ . "/dateLastQuery.txt";
$this->dateLastQuery = $this->getDateLastQuery();
}
示例2: init
public function init()
{
if (strncmp($this->filename, './', 2) == 0) {
$this->filename = Yii::$app->getBasePath() . substr($this->filename, 1);
}
parent::init();
}
示例3: init
public function init()
{
parent::init();
if (empty(Yii::$app->params['hook_secret'])) {
throw new Exception('Config param "hook_secret" is not configured!');
}
}
示例4: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
foreach ($this->generators as $id => $config) {
$this->generators[$id] = Yii::createObject($config);
}
}
示例5: init
public function init()
{
parent::init();
$this->gman_worker = new \GearmanWorker();
$this->gman_worker->addServers($this->module->gman_server);
$this->gman_client = new \GearmanClient();
$this->gman_client->addServers($this->module->gman_server);
}
示例6: init
/**
* @inheritdoc
*/
public function init()
{
// allow console requests only
if (!Yii::$app->request->isConsoleRequest) {
throw new HttpException(404, 'The requested page does not exist.');
}
parent::init();
}
示例7: init
public function init()
{
parent::init();
$this->api = Module::getInstance()->api;
foreach ($this->allowedApiOptions as $option) {
$this->{$option} = null;
}
}
示例8: init
public function init()
{
if (!\Yii::$app instanceof ConsoleApplication) {
throw new Exception('Yii::$app is not an instance of ConsoleApplication.');
return Controller::EXIT_CODE_ERROR;
}
parent::init();
}
示例9: init
/**
* Init
*/
public function init()
{
parent::init();
// Support cyrillic on windows
if ($this->isWindows()) {
system("chcp 65001");
}
}
示例10: init
public function init()
{
pcntl_signal(SIGTERM, [$this, 'signalHandler']);
pcntl_signal_dispatch();
parent::init();
if (self::$queue === null) {
self::$queue = Yii::$app->{$this->queueObjectName};
}
}
示例11: init
public function init()
{
if (\Yii::$app->has($this->schedule)) {
$this->schedule = Instance::ensure($this->schedule, Schedule::className());
} else {
$this->schedule = \Yii::createObject(Schedule::className());
}
parent::init();
}
示例12: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->db = Instance::ensure($this->db, Connection::class);
if (empty($this->db_driver)) {
$this->db_driver = $this->db->driverName;
}
$this->prepareCredentials();
}
示例13: init
public function init()
{
parent::init();
$this->token = (require __DIR__ . '/token.php');
$this->datePath = __DIR__ . "/dateLastQuery.txt";
$this->dateLastQuery = $this->getDateLastQuery();
set_time_limit(0);
//0表示没有限制
ini_set('memory_limit', '500M');
}
示例14: init
/**
* Init function
*/
public function init()
{
parent::init();
//set PCNTL signal handlers
pcntl_signal(SIGTERM, ['vyants\\daemon\\DaemonController', 'signalHandler']);
pcntl_signal(SIGHUP, ['vyants\\daemon\\DaemonController', 'signalHandler']);
pcntl_signal(SIGUSR1, ['vyants\\daemon\\DaemonController', 'signalHandler']);
pcntl_signal(SIGCHLD, ['vyants\\daemon\\DaemonController', 'signalHandler']);
$this->shortName = $this->shortClassName();
}
示例15: init
/**
* {@inheritDoc}
*/
public function init()
{
try {
if (!isset(Yii::$app->getI18n()->translations['udokmeci.beanstalkd'])) {
Yii::$app->getI18n()->translations['udokmeci.beanstalkd'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@app/messages', 'sourceLanguage' => 'en', 'fileMap' => []];
}
} catch (\Pheanstalk\Exception\ConnectionException $e) {
Yii::error($e);
}
return parent::init();
}