/**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     \Yii::setAlias('@cornernote/dashboard', __DIR__);
     if ($app->has('i18n')) {
         $app->i18n->translations['dashboard'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'en', 'basePath' => '@cornernote/dashboard/messages'];
     }
 }
Exemple #2
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if (!$app instanceof \yii\web\Application) {
         return;
     }
     if (!$app->has('backend')) {
         $app->set('backend', static::className());
     }
     if ($app->get('backend') instanceof Component) {
         $app->on(\yii\web\Application::EVENT_BEFORE_ACTION, [self::className(), 'detectBackend']);
     }
 }
 /**
  * Bootstrap method to be called during application bootstrap stage.
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     $app->i18n->translations['admin/export'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@yz/admin/export/common/messages', 'sourceLanguage' => 'en-US'];
     if ($app instanceof \yii\console\Application) {
         if ($app->has('schedule')) {
             /** @var omnilight\scheduling\Schedule $schedule */
             $schedule = $app->get('schedule');
             // Place all your shedule command below
             $schedule->command('admin-export/export/process');
         }
     }
 }
 /**
  * Get workbench compoment
  * @param yii\base\Application $app
  * @return \johnitvn\workbench\Workbench|null return Workbench or null if working directory is not exist
  */
 public static function getInstance(Application $app)
 {
     if (!$app->has("workbench")) {
         $workbench = new Workbench();
     } else {
         $workbench = $app->get("workbench");
     }
     if ($workbench->workingDir === null) {
         $workbench->workingDir = dirname(dirname(dirname(__DIR__))) . '/workbench';
     }
     // If workbench workspace not exist. return null
     if (!file_exists($workbench->workingDir)) {
         return null;
     }
     return $workbench;
 }
Exemple #5
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     // Make sure to register the base folder as alias as well or things like assets won't work anymore
     \Yii::setAlias('@bedezign/yii2/audit', __DIR__);
     if ($app instanceof \yii\console\Application) {
         $app->controllerMap['audit'] = 'bedezign\\yii2\\audit\\commands\\AuditController';
     }
     $moduleName = Audit::findModuleIdentifier();
     if ($moduleName) {
         // The module was added in the configuration, make sure to add it to the application bootstrap so it gets loaded
         $app->bootstrap[] = $moduleName;
         $app->bootstrap = array_unique($app->bootstrap, SORT_REGULAR);
     }
     if ($app->has('i18n')) {
         $app->i18n->translations['audit'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'en', 'basePath' => '@bedezign/yii2/audit/messages'];
     }
 }
Exemple #6
0
 public function _before(TestInterface $test)
 {
     $entryUrl = $this->config['entryUrl'];
     $entryFile = $this->config['entryScript'] ?: basename($entryUrl);
     $entryScript = $this->config['entryScript'] ?: parse_url($entryUrl, PHP_URL_PATH);
     $this->client = new Yii2Connector();
     $this->client->defaultServerVars = ['SCRIPT_FILENAME' => $entryFile, 'SCRIPT_NAME' => $entryScript, 'SERVER_NAME' => parse_url($entryUrl, PHP_URL_HOST), 'SERVER_PORT' => parse_url($entryUrl, PHP_URL_PORT) ?: '80'];
     $this->client->defaultServerVars['HTTPS'] = parse_url($entryUrl, PHP_URL_SCHEME) === 'https';
     $this->client->restoreServerVars();
     $this->client->configFile = Configuration::projectDir() . $this->config['configFile'];
     $this->app = $this->client->getApplication();
     if ($this->config['cleanup'] && $this->app->has('db')) {
         $this->transaction = $this->app->db->beginTransaction();
     }
 }