Example #1
0
 /**
  * This command echoes what you have entered as the message.
  *
  * @param string $message the message to be echoed.
  */
 public function actionIndex()
 {
     echo "Running batch...\n";
     $config = $this->getYiiConfiguration();
     $config['id'] = 'temp';
     // create models
     foreach ($this->tables as $table) {
         #var_dump($this->tableNameMap, $table);exit;
         $params = ['interactive' => $this->interactive, 'template' => 'default', 'ns' => $this->modelNamespace, 'db' => $this->modelDb, 'tableName' => $table, 'tablePrefix' => $this->tablePrefix, 'generateModelClass' => $this->extendedModels, 'modelClass' => isset($this->tableNameMap[$table]) ? $this->tableNameMap[$table] : Inflector::camelize($table), 'baseClass' => $this->modelBaseClass, 'tableNameMap' => $this->tableNameMap];
         $route = 'gii/giix-model';
         $app = \Yii::$app;
         $temp = new \yii\console\Application($config);
         $temp->runAction(ltrim($route, '/'), $params);
         unset($temp);
         \Yii::$app = $app;
     }
     // create CRUDs
     $providers = ArrayHelper::merge($this->crudProviders, Generator::getCoreProviders());
     foreach ($this->tables as $table) {
         $table = str_replace($this->tablePrefix, '', $table);
         $name = isset($this->tableNameMap[$table]) ? $this->tableNameMap[$table] : Inflector::camelize($table);
         $params = ['interactive' => $this->interactive, 'overwrite' => $this->overwrite, 'template' => 'default', 'modelClass' => $this->modelNamespace . '\\' . $name, 'searchModelClass' => $this->modelNamespace . '\\search\\' . $name . 'Search', 'controllerClass' => $this->crudControllerNamespace . '\\' . $name . 'Controller', 'viewPath' => $this->crudViewPath, 'pathPrefix' => $this->crudPathPrefix, 'actionButtonClass' => 'yii\\grid\\ActionColumn', 'baseControllerClass' => $this->crudBaseControllerClass, 'providerList' => implode(',', $providers)];
         $route = 'gii/giix-crud';
         $app = \Yii::$app;
         $temp = new \yii\console\Application($config);
         $temp->runAction(ltrim($route, '/'), $params);
         unset($temp);
         \Yii::$app = $app;
     }
 }
Example #2
0
 public function runConsole()
 {
     defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
     defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w'));
     defined('STDERR') or define('STDERR', fopen('php://stderr', 'w'));
     if (!is_array($this->appConfig)) {
         echo "You must load your Console configure file in ./cmd";
         exit;
     }
     $application = new yii\console\Application($this->appConfig);
     $exitCode = $application->run();
     exit($exitCode);
 }
Example #3
0
 /**
  * Run batch process to generate CRUDs all given tables
  * @throws \yii\console\Exception
  */
 public function actionCruds()
 {
     // create CRUDs
     $providers = ArrayHelper::merge($this->crudProviders, Generator::getCoreProviders());
     // create folders
     $this->createDirectoryFromNamespace($this->crudControllerNamespace);
     $this->createDirectoryFromNamespace($this->crudSearchModelNamespace);
     foreach ($this->tables as $table) {
         $table = str_replace($this->tablePrefix, '', $table);
         $name = isset($this->tableNameMap[$table]) ? $this->tableNameMap[$table] : $this->modelGenerator->generateClassName($table);
         $params = ['interactive' => $this->interactive, 'overwrite' => $this->overwrite, 'template' => $this->template, 'modelClass' => $this->modelNamespace . '\\' . $name, 'searchModelClass' => $this->crudSearchModelNamespace . '\\' . $name . $this->crudSearchModelSuffix, 'controllerNs' => $this->crudControllerNamespace, 'controllerClass' => $this->crudControllerNamespace . '\\' . $name . 'Controller', 'viewPath' => $this->crudViewPath, 'pathPrefix' => $this->crudPathPrefix, 'tablePrefix' => $this->tablePrefix, 'enableI18N' => $this->enableI18N, 'singularEntities' => $this->singularEntities, 'messageCategory' => $this->messageCategory, 'actionButtonClass' => 'yii\\grid\\ActionColumn', 'baseControllerClass' => $this->crudBaseControllerClass, 'providerList' => $providers, 'skipRelations' => $this->crudSkipRelations, 'accessFilter' => $this->crudAccessFilter, 'tidyOutput' => $this->crudTidyOutput];
         $route = 'gii/giiant-crud';
         $app = \Yii::$app;
         $temp = new \yii\console\Application($this->appConfig);
         $temp->runAction(ltrim($route, '/'), $params);
         unset($temp);
         \Yii::$app = $app;
         \Yii::$app->log->logger->flush(true);
     }
 }
Example #4
0
<?php

/**
 * Скрипт принимает и обрабатывает уведомления от PayQR
 */
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../common/config/bootstrap.php';
require __DIR__ . '/../console/config/bootstrap.php';
$config = yii\helpers\ArrayHelper::merge(require __DIR__ . '/../common/config/main.php', require __DIR__ . '/../common/config/main-local.php', require __DIR__ . '/../console/config/main.php', require __DIR__ . '/../console/config/main-local.php');
$application = new yii\console\Application($config);
$exitCode = $application->run();
require_once __DIR__ . "/PayqrConfig.php";
// подключаем основной класс
//инициализируем данными нашу библиотеку
if (PayqrConfig::init()) {
    exit("Error init PayQR market!");
}
try {
    $receiver = new PayqrReceiver();
    $receiver->handle();
} catch (PayqrExeption $e) {
    echo $e->response;
}
exit($exitCode);
#!/usr/bin/env php
<?php 
define('ROOT', realpath(__DIR__ . DIRECTORY_SEPARATOR . '..'));
require_once ROOT . '/vendor/autoload.php';
require ROOT . '/vendor/yiisoft/yii2/Yii.php';
$app = new \yii\console\Application(require "config.php");
$app->run();
Example #6
0
 /**
  * Run batch process to generate CRUDs all given tables
  * @throws \yii\console\Exception
  */
 public function actionCruds()
 {
     // create CRUDs
     $providers = ArrayHelper::merge($this->crudProviders, Generator::getCoreProviders());
     foreach ($this->tables as $table) {
         $table = str_replace($this->tablePrefix, '', $table);
         $name = isset($this->tableNameMap[$table]) ? $this->tableNameMap[$table] : Inflector::camelize($table);
         $params = ['interactive' => $this->interactive, 'overwrite' => $this->overwrite, 'template' => $this->template, 'modelClass' => $this->modelNamespace . '\\' . $name, 'searchModelClass' => $this->crudSearchModelNamespace . '\\' . $name, 'controllerClass' => $this->crudControllerNamespace . '\\' . $name . 'Controller', 'viewPath' => $this->crudViewPath, 'pathPrefix' => $this->crudPathPrefix, 'tablePrefix' => $this->tablePrefix, 'enableI18N' => $this->enableI18N, 'messageCategory' => $this->messageCategory, 'actionButtonClass' => 'yii\\grid\\ActionColumn', 'baseControllerClass' => $this->crudBaseControllerClass, 'providerList' => implode(',', $providers), 'skipRelations' => $this->crudSkipRelations];
         $route = 'gii/giiant-crud';
         $app = \Yii::$app;
         $temp = new \yii\console\Application($this->appConfig);
         $temp->runAction(ltrim($route, '/'), $params);
         unset($temp);
         \Yii::$app = $app;
     }
 }
Example #7
0
#!/usr/bin/env php
<?php 
/**
 * Yii console bootstrap file.
 */
require __DIR__ . '/vendor/autoload.php';
$env = new \xapon\YiiEnvironment\Environment(null, __DIR__ . '/config');
$env->setup();
$app = new yii\console\Application($env->configConsole);
$exitCode = $app->run();
exit($exitCode);
 /**
  * Generate Giiant Model and Giiant CRUD using physical table
  * @param integer $id
  * @throws HttpException
  */
 public function actionGenerate($id)
 {
     $table = $this->findModel($id);
     $setting = Setting::find()->where(["id" => 1])->one();
     //Generate Model
     $params = ['interactive' => false, 'overwrite' => true, 'template' => "default", 'ns' => $setting->model_namespace, 'db' => "db", 'tableName' => $table->slug_name, 'tablePrefix' => "", 'enableI18N' => false, 'singularEntities' => true, 'messageCategory' => "app", 'generateModelClass' => false, 'baseClassSuffix' => "", 'modelClass' => Inflector::camelize($table->slug_name), 'baseClass' => "yii\\db\\ActiveRecord", 'baseTraits' => null, 'tableNameMap' => [], 'generateQuery' => false, 'queryNs' => 'app\\models\\query', 'queryBaseClass' => 'yii\\db\\ActiveQuery'];
     $route = 'gii/giiant-model';
     $app = \Yii::$app;
     $config = $GLOBALS['config'];
     unset($config["components"]["errorHandler"]);
     unset($config["components"]["user"]);
     $temp = new \yii\console\Application($config);
     $temp->runAction(ltrim($route, '/'), $params);
     unset($temp);
     \Yii::$app = $app;
     $table->model_class = $setting->model_namespace . "\\" . Inflector::camelize($table->slug_name);
     $table->model_base_class = $setting->model_namespace . "\\base\\" . Inflector::camelize($table->slug_name);
     $table->save();
     //Generate CRUD
     $this->createDirectoryFromNamespace($setting->controller_namespace);
     $this->createDirectoryFromNamespace($setting->model_namespace . "\\search");
     $name = Inflector::camelize($table->slug_name);
     $params = ['interactive' => false, 'overwrite' => true, 'template' => "default", 'modelClass' => $setting->model_namespace . '\\' . $name, 'searchModelClass' => $setting->model_namespace . '\\search\\' . $name, 'controllerNs' => $setting->controller_namespace, 'controllerClass' => $setting->controller_namespace . '\\' . $name . 'Controller', 'viewPath' => $setting->view_path, 'pathPrefix' => "", 'tablePrefix' => "", 'enableI18N' => false, 'singularEntities' => true, 'messageCategory' => "app", 'actionButtonClass' => "yii\\grid\\ActionColumn", 'baseControllerClass' => "yii\\web\\Controller", 'providerList' => [], 'skipRelations' => [], 'accessFilter' => true, 'tidyOutput' => true];
     $route = 'gii/giiant-crud';
     $app = \Yii::$app;
     $temp = new \yii\console\Application($config);
     $temp->runAction(ltrim($route, '/'), $params);
     unset($temp);
     \Yii::$app = $app;
     \Yii::$app->log->logger->flush(true);
     $table->controller_class = $setting->controller_namespace . '\\' . $name . 'Controller';
     $table->view_path = $setting->view_path . "/" . Util::slugify($table->slug_name);
     $table->save();
     \Yii::$app->session->addFlash("success", "Generate Success.");
     $this->redirect(["table/index"]);
 }
Example #9
0
<?php

defined('APP_CACHE_PREFIX') or define('APP_CACHE_PREFIX', 'JB-9939-COM_');
//缓存前缀
defined('CACHE_AD_TIME') or define('CACHE_AD_TIME', 24 * 3600);
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'dev');
defined('YII_ENV_DEV') or define('YII_ENV_DEV', YII_ENV === 'dev');
if (YII_ENV_DEV) {
    defined('YII_DB_ENV') or define('YII_DB_ENV', '-local');
    defined('YII_LIB_PATH') or define('YII_LIB_PATH', '/data/lib/lib-yii2-framework/');
    defined('PROJECT_PATH') or define('PROJECT_PATH', '/data/www/develop/code/trunk/admin-9939-com/frontend/web/');
    //defined('YII_LIB_PATH') or define('YII_LIB_PATH','E:/web/php/develop/code/trunk/lib-yii2-framework/');
    //defined('PROJECT_PATH') or define('PROJECT_PATH', 'E:/web/php/develop/code/trunk/admin-9939-com/frontend/web/');
} else {
    defined('YII_DB_ENV') or define('YII_DB_ENV', '');
    defined('YII_LIB_PATH') or define('YII_LIB_PATH', '/data/web/framework/lib-yii2-framework/');
    defined('PROJECT_PATH') or define('PROJECT_PATH', '/data/web/jb-9939-com/frontend/web/');
}
require YII_LIB_PATH . '/autoload.php';
require YII_LIB_PATH . '/yiisoft/yii2/Yii.php';
require __DIR__ . '/../config/bootstrap.php';
$config = yii\helpers\ArrayHelper::merge(require __DIR__ . '/../../common/config/db/db_jbv2' . YII_DB_ENV . '.php', require __DIR__ . '/../../common/config/db/db_portal' . YII_DB_ENV . '.php', require __DIR__ . '/../../common/config/db/db_v2' . YII_DB_ENV . '.php', require __DIR__ . '/../../common/config/db/db_v2sns' . YII_DB_ENV . '.php', require __DIR__ . '/../../common/config/db/db_all' . YII_DB_ENV . '.php', require __DIR__ . '/../config/main' . YII_DB_ENV . '.php');
$application = new yii\console\Application($config);
$application->run();
<?php

// ensure we get report on all possible php errors
error_reporting(-1);
define('YII_ENABLE_ERROR_HANDLER', false);
define('YII_DEBUG', true);
$_SERVER['SCRIPT_NAME'] = '/' . __DIR__;
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
// require composer autoloader if available
$vendor = __DIR__ . '/../vendor';
require_once $vendor . '/autoload.php';
require_once $vendor . '/yiisoft/yii2/Yii.php';
require_once __DIR__ . '/TestCase.php';
$count = count(glob(__DIR__ . '/migrations/*.php'));
$config = (require __DIR__ . '/_config.php');
$app = new \yii\console\Application($config);
$app->runAction('migrate/down', [$count, 'interactive' => 0, 'migrationPath' => '@app/tests/migrations']);
$app->runAction('migrate', ['interactive' => 0, 'migrationPath' => '@app/tests/migrations']);
$app = null;