本文整理匯總了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();
}