/** * Execute the action. * @param array $args command line parameters specific for this command * @return integer non zero application exit code after printing help */ public function run($args) { $runner = $this->getCommandRunner(); $commands = $runner->commands; if (isset($args[0])) { $name = strtolower($args[0]); } if (!isset($args[0]) || !isset($commands[$name])) { if (!empty($commands)) { echo "Yii command runner (based on Yii v" . Yii::getVersion() . ")\n"; echo "Usage: " . $runner->getScriptName() . " <command-name> [parameters...]\n"; echo "\nThe following commands are available:\n"; $commandNames = array_keys($commands); sort($commandNames); echo ' - ' . implode("\n - ", $commandNames); echo "\n\nTo see individual command help, use the following:\n"; echo " " . $runner->getScriptName() . " help <command-name>\n"; } else { echo "No available commands.\n"; echo "Please define them under the following directory:\n"; echo "\t" . Yii::app()->getCommandPath() . "\n"; } } else { echo $runner->createCommand($name)->getHelp(); } return 1; }
/** * @return $this */ public function startTool() { $this->stdoutN('Yii2 (' . \Yii::getVersion() . ')'); $this->stdoutN(\Yii::$app->cms->moduleCms()->getDescriptor()->toString()); $this->stdoutN('App:' . \Yii::$app->id); $this->hr(); return $this; }
public function beforeAction($action, $params) { $path = Yii::getPathOfAlias($this->migrationPath); if ($path === false || !is_dir($path)) { die('Error: The migration directory does not exist: ' . $this->migrationPath . "\n"); } $this->migrationPath = $path; $yiiVersion = Yii::getVersion(); echo "\nYii Migration Tool v1.0 (based on Yii v{$yiiVersion})\n\n"; return true; }
/** * Execute the action. * @param array $args command line parameters specific for this command */ public function run($args) { if (is_file($composerAutoload = __DIR__ . '/../../vendor/autoload.php')) { require $composerAutoload; } $options = array('fileTypes' => array('php'), 'exclude' => array('.gitignore', '/yiilite.php', '/yiit.php', '/cli', '/i18n/data', '/messages', '/vendors', '/views', '/web/js', '/web/widgets/views', '/utils/mimeTypes.php', '/gii/assets', '/gii/components', '/gii/controllers', '/gii/generators', '/gii/models', '/gii/views')); if (!isset($args[0])) { $this->usageError('the output directory is not specified.'); } if ($args[0] == 'check') { $checkFiles = CFileHelper::findFiles(YII_PATH, $options); $model = new ApiModel(); $model->check($checkFiles); exit; } if (!is_dir($docPath = $args[0])) { $this->usageError("the output directory {$docPath} does not exist."); } $offline = true; if (isset($args[1]) && $args[1] === 'online') { $offline = false; } $this->version = Yii::getVersion(); /* * development version - link to master * release version link to tags */ if (substr($this->version, -3) == 'dev') { $this->baseSourceUrl .= '/master/framework'; } else { $this->baseSourceUrl .= '/' . $this->version . '/framework'; } $this->pageTitle = 'Yii Framework Class Reference'; $themePath = dirname(__FILE__) . '/api'; echo "\nBuilding.. : " . $this->pageTitle . "\n"; echo "Type...... : " . ($offline ? "offline" : "online") . "\n"; echo "Version... : " . $this->version . "\n"; echo "Source URL : " . $this->baseSourceUrl . "\n\n"; echo "Building model...\n"; $model = $this->buildModel(YII_PATH, $options); $this->classes = $model->classes; $this->packages = $model->packages; echo "Building pages...\n"; if ($offline) { $this->buildOfflinePages($docPath . DIRECTORY_SEPARATOR . 'api', $themePath); } else { $this->buildOnlinePages($docPath . DIRECTORY_SEPARATOR . 'api', $themePath); $this->buildKeywords($docPath); $this->buildPackages($docPath); } echo "Done.\n\n"; }
/** * Returns basic service info, such as uptime, Yii version, etc. Uses * cache to store that information for a minute. * * @return string[] Server and software information in :title => :value * format. * @since 0.1.0 */ public function getServiceInfo() { $cache = \Yii::app()->cacheHelper->get('serviceStatus'); if (!$cache) { $cache = array('yiiVersion' => \Yii::getVersion(), 'twigVersion' => $this->getTwigVersion(), 'phpVersion' => PHP_VERSION, 'os' => php_uname(), 'uptime' => $this->getUptime(), 'serverTime' => date('Y-m-d H:i')); \Yii::app()->cacheHelper->set('serviceStatus', $cache, 60); } foreach ($cache as $key => $value) { unset($cache[$key]); $cache[\Yii::t('templates', 'status.' . $key)] = $value; } return $cache; }
public function beforeAction($action, $params) { $yiiVersion = Yii::getVersion(); echo "\nData Patch Migration Tool v1.0 (based on Yii v{$yiiVersion} Migration Tool)\n\n"; echo 'Data Patch Migration Table : ' . self::migrationTable . "\n\n"; echo 'Data Patch Path : ' . $this->dataPatchPath . "\n\n"; $path = $this->dataPatchPath; if ($path === false || !is_dir($path)) { echo 'Error: The migration directory does not exist: ' . $this->dataPatchPath . "\n"; exit(1); } return parent::beforeAction($action, $params); }
/** * Generates the resulting view file path. * @param string source view file path * @return string resulting view file path */ protected function getViewFile($file) { if ($this->useRuntimePath) { $crc = sprintf('%x', crc32(get_class($this) . Yii::getVersion() . dirname($file))); $viewFile = Yii::app()->getRuntimePath() . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $crc . DIRECTORY_SEPARATOR . basename($file); if (!is_file($viewFile)) { @mkdir(dirname($viewFile), $this->filePermission, true); } return $viewFile; } else { return $file . 'c'; } }
public function addPrimaryKey($name, $table, $columns) { $info = explode('.', Yii::getVersion()); if ($info[0] == 1 && $info[1] == 1 && $info[2] <= 12) { $result = $this->execute("ALTER TABLE {$table} ADD CONSTRAINT {$name} PRIMARY KEY ({$columns})"); if ($result) { return true; } else { return false; } } else { return parent::addPrimaryKey($name, $table, $columns); } }
/** * @return CDbConnection the DB connection instance * @throws CException if {@link connectionID} does not point to a valid application component. */ protected function getDbConnection() { if ($this->_db !== null) { return $this->_db; } elseif (($id = $this->connectionID) !== null) { if (($this->_db = Yii::app()->getComponent($id)) instanceof CDbConnection) { return $this->_db; } else { throw new CException(Yii::t('yii', 'CDbLogRoute.connectionID "{id}" does not point to a valid CDbConnection application component.', array('{id}' => $id))); } } else { $dbFile = Yii::app()->getRuntimePath() . DIRECTORY_SEPARATOR . 'log-' . Yii::getVersion() . '.db'; return $this->_db = new CDbConnection('sqlite:' . $dbFile); } }
public function beforeAction($action, $params) { $tablePrefix = Yii::app()->getDb()->tablePrefix; if ($tablePrefix != '') { $this->migrationTable = $tablePrefix . $this->migrationTable; } $path = Yii::getPathOfAlias($this->migrationPath); if ($path === false || !is_dir($path)) { echo 'Error: The migration directory does not exist: ' . $this->migrationPath . "\n"; exit(1); } $this->migrationPath = $path; $yiiVersion = Yii::getVersion(); echo "\nYii Migration Tool v1.0 (based on Yii v{$yiiVersion})\n\n"; return parent::beforeAction($action, $params); }
public function actionIndex() { Yii::import("application.extensions.payment.alipayNotify", true); $alipaySubmit = new alipayNotify(); $html_text = $alipaySubmit->buildRequestHttp(aaa); $this->render('/test/index'); exit; echo "<pre>"; $list = ProductAttributes::model()->findAllByAttributes(array('id' => 2)); User::find()->where('status=:status', [':status' => User::STATUS_ACTIVATED])->indexBy('id')->all(); $zine_ids = array(1, 2, 3); $list = Yii::app()->byguitar->createCommand()->select('*')->from('bg_zine')->where('id in (' . implode(',', $zine_ids) . ')')->queryAll(); print_r($list); exit; echo "this is a test page <br>"; echo Yii::getVersion(); exit; }
public function save() { return array( 'phpVersion' => PHP_VERSION, 'yiiVersion' => Yii::getVersion(), 'application' => array( 'yii' => Yii::getVersion(), 'name' => Yii::app()->name, 'timezone' => Yii::app()->getTimeZone(), 'debug' => YII_DEBUG, ), 'php' => array( 'version' => PHP_VERSION, 'xdebug' => extension_loaded('xdebug'), 'apc' => extension_loaded('apc'), 'memcache' => extension_loaded('memcache'), ), ); }
/** * Returns server version information. * If the application is in production mode, empty string is returned. * @return string server version information. Empty if in production mode. */ protected function getVersionInfo() { if (YII_DEBUG) { $version = '<a href="http://www.yiiframework.com/">Yii Framework</a>/' . Yii::getVersion(); if (isset($_SERVER['SERVER_SOFTWARE'])) { $version = $_SERVER['SERVER_SOFTWARE'] . ' ' . $version; } } else { $version = ''; } return $version; }
public static function getInfo($data, $config = null) { parent::getInfo($data, $config); $result = array(); $result['title'] = 'Yii ver: ' . Yii::getVersion(); $result['headinfo'] = self::getHeadInfo(); $result['panelTitle'] = 'Configuration'; $result['content'] = self::formatArrayAsHtml('globals', self::globalsAsArray(), true); $result['content'] .= self::formatArrayAsHtml('session', self::sessionAsArray(), true); $result['content'] .= self::formatArrayAsHtml('php', self::phpInfoAsArray(), true); $result['content'] .= self::formatArrayAsHtml('request', self::requestAsArray(), true); $result['content'] .= self::formatArrayAsHtml('Yii::app()', self::YiiAppAsArray(), true); $result['content'] .= self::formatArrayAsHtml('WebdebugToolbar', self::$_config, true); return $result; }
public function beforeAction($action, $params) { $path = Yii::getPathOfAlias($this->migrationPath); if ($path === false || !is_dir($path)) { echo 'Error: The migration directory does not exist: ' . $this->migrationPath . "\n"; exit(1); } $this->migrationPath = $path; $yiiVersion = Yii::getVersion(); echo "\nYii Migration Tool for MongoYii v1.0 (based on Yii v{$yiiVersion})\n\n"; return CConsoleCommand::beforeAction($action, $params); }
<?php /** * footer.php * * @author Spyros Soldatos <*****@*****.**> * @link http://code.google.com/p/srbac/ */ /** * Srbac sample header * * @author Spyros Soldatos <*****@*****.**> * @package srbac.views.authitem.header * @since 1.1.0 */ ?> <div class="row"> <p align="right"> Yii Version <?php echo Yii::getVersion(); ?> , Srbac Version <?php echo $this->module->getVersion(); ?> - Copyright © 2009-2010 by <?php echo SHtml::link("Spyros", "http://www.yiiframework.com/forum/index.php?/user/1089-spyros/", array("target" => "_BLANK")); ?> </div>
public function registerAssets() { $booster = Booster::getBooster(); if ($this->type == 'date' || $this->type == 'combodate') { /** * @var $widget TbDatePicker */ $widget = Yii::app()->widgetFactory->createWidget($this->getOwner(), 'booster.widgets.TbDatePicker', array('options' => isset($this->options['datepicker']) ? $this->options['datepicker'] : array())); $widget->registerLanguageScript(); } elseif ($this->type == 'datetime') { $booster->registerPackage('datetimepicker'); /** * @var $widget TbDateTimePicker */ $widget = Yii::app()->widgetFactory->createWidget($this->getOwner(), 'booster.widgets.TbDateTimePicker', array('options' => $this->options['datetimepicker'])); $widget->registerLanguageScript(); } if ($this->type == 'combodate') { // include moment.js if needed $booster->registerPackage('moment'); } elseif ($this->type == 'select2') { // include select2 if needed $booster->registerPackage('select2'); } $booster->registerPackage('x-editable'); return; /* TODO original */ $am = Yii::app()->getAssetManager(); $cs = Yii::app()->getClientScript(); $form = yii::app()->editable->form; $mode = $this->mode ? $this->mode : yii::app()->editable->defaults['mode']; // bootstrap if ($form === EditableConfig::FORM_BOOTSTRAP) { if ($bootstrap = yii::app()->getComponent('bootstrap')) { $bootstrap->registerCoreCss(); $bootstrap->registerCoreScripts(); } else { throw new CException('You need to setup Yii-bootstrap extension first.'); } $assetsUrl = $am->publish(Yii::getPathOfAlias('editable.assets.bootstrap-editable')); $js = 'bootstrap-editable.js'; $css = 'bootstrap-editable.css'; // jqueryui } elseif ($form === EditableConfig::FORM_JQUERYUI) { if ($mode === EditableConfig::POPUP && Yii::getVersion() < '1.1.13') { throw new CException('jQuery UI editable popup supported from Yii 1.1.13+'); } // register jquery ui $this->registerJQueryUI(); $assetsUrl = $am->publish(Yii::getPathOfAlias('editable.assets.jqueryui-editable')); $js = 'jqueryui-editable.js'; $css = 'jqueryui-editable.css'; // plain jQuery } else { $assetsUrl = $am->publish(Yii::getPathOfAlias('editable.assets.jquery-editable')); $js = 'jquery-editable-poshytip.js'; $css = 'jquery-editable.css'; // publish & register poshytip for popup version if ($mode === EditableConfig::POPUP) { $poshytipUrl = $am->publish(Yii::getPathOfAlias('editable.assets.poshytip')); $cs->registerScriptFile($poshytipUrl . '/jquery.poshytip.js'); $cs->registerCssFile($poshytipUrl . '/tip-yellowsimple/tip-yellowsimple.css'); } // register jquery ui for datepicker if ($this->type == 'date' || $this->type == 'dateui') { $this->registerJQueryUI(); } } // register assets $cs->registerCssFile($assetsUrl . '/css/' . $css); $cs->registerScriptFile($assetsUrl . '/js/' . $js, CClientScript::POS_END); // include moment.js for combodate if ($this->type == 'combodate') { $momentUrl = $am->publish(Yii::getPathOfAlias('editable.assets.moment')); $cs->registerScriptFile($momentUrl . '/moment.min.js'); } // include select2 lib for select2 type if ($this->type == 'select2') { $select2Url = $am->publish(Yii::getPathOfAlias('editable.assets.select2')); $cs->registerScriptFile($select2Url . '/select2.min.js'); $cs->registerCssFile($select2Url . '/select2.css'); } // include bootstrap-datetimepicker if ($this->type == 'datetime') { $url = $am->publish(Yii::getPathOfAlias('editable.assets.bootstrap-datetimepicker')); $cs->registerScriptFile($url . '/js/bootstrap-datetimepicker.js'); $cs->registerCssFile($url . '/css/datetimepicker.css'); } // TODO: include locale for datepicker // may be do it manually? /* * if ($this->type == 'date' && $this->language && substr($this->language, 0, 2) != 'en') { * //todo: check compare dp locale name with yii's * $localesUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.editable.assets.js.locales')); * Yii::app()->clientScript->registerScriptFile($localesUrl . '/bootstrap-datepicker.'. str_replace('_', '-', $this->language).'.js', CClientScript::POS_END); * } */ }
/** * Generate a CRC32 hash for the directory path. Collisions are higher * than MD5 but generates a much smaller hash string. * @param string $path string to be hashed. * @return string hashed string. */ protected function hash($path) { return sprintf('%x', crc32($path . Yii::getVersion())); }
/** * @return string the file path that stores the sticky attribute values. */ public function getStickyFile() { $parentId = ''; $parentModule = Yii::app()->controller->getModule('gii')->parentModule; if ($parentModule) { $parentId = Yii::app()->controller->getModule('gii')->parentModule->id; return Yii::app()->runtimePath . '/gii-' . Yii::getVersion() . '/' . get_class($this) . '/' . ucfirst($parentId) . '.php'; } return Yii::app()->runtimePath . '/gii-' . Yii::getVersion() . '/' . get_class($this) . '.php'; }
if (APP_TYPE == 'console') { $config->appendFiles([SKEEKS_CONFIG_DIR . '/main-console.php']); //добавлены пути к конфигам cms } } $modulesConfigFiles = []; if (file_exists(AUTO_GENERATED_MODULES_FILE)) { $modulesConfigFiles = (include AUTO_GENERATED_MODULES_FILE); if (isset($modulesConfigFiles[APP_TYPE])) { $modulesConfigFiles = $modulesConfigFiles[APP_TYPE]; } } $config->appendFiles($modulesConfigFiles); //добавлены пути к конфигам всех файлов } $config->appendFiles([COMMON_CONFIG_DIR . '/main.php', COMMON_ENV_CONFIG_DIR . '/main.php', APP_CONFIG_DIR . '/main.php', APP_ENV_CONFIG_DIR . '/main.php']); $config->cacheDir = APP_RUNTIME_DIR; $config->cache = CONFIG_CACHE; $config->name = 'config_' . APP_TYPE; $config->appendDependency(Yii::getVersion()); $config->appendDependency(YII_ENV); $config->appendDependency(PHP_VERSION); //кэш будет сбрасываться при редактировании файла с общим конфигом $config->appendDependency(filemtime(COMMON_CONFIG_DIR . '/main.php')); //кэш будет сбрасываться при редактировании файла с общим конфигом $config->appendDependency(filemtime(APP_CONFIG_DIR . '/main.php')); //кэш будет сбрасываться при редактировании файла с общим конфигом $config->appendDependency(filemtime(COMMON_CONFIG_DIR . '/db.php')); //кэш будет сбрасываться при включении и отключении модульных конфигов //$config->appendDependency((int) ENABLE_MODULES_CONF); //кэш будет сбрасываться при включении и отключении модульных конфигов return $config;
$this->widget('zii.widgets.CMenu',array( 'items'=>array( array('label'=>'Главная', 'url'=>array('/site/index'),'visible'=>Yii::app()->user->isGuest), array('label'=>'Счета', 'url'=>array('exp/admin'),'visible'=>((!Yii::app()->user->isGuest)&&($this->permit>0))), array('label'=>'Платежи', 'url'=>array('pay/admin'),'visible'=>((!Yii::app()->user->isGuest)&&($this->permit>1))), array('label'=>'Отгрузки', 'url'=>array('inv/admin'),'visible'=>((!Yii::app()->user->isGuest)&&($this->permit>0))), array('label'=>'Выход ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest) ), )); ?> </div><!-- mainmenu --> <?php if(isset($this->breadcrumbs)):?> <?php $this->widget('zii.widgets.CBreadcrumbs', array( 'links'=>$this->breadcrumbs, )); ?><!-- breadcrumbs --> <?php endif?> </div> <?php echo $content; ?> <div class="noprintarea"> <div class="clear"></div> <div id="footer"> Copyright © <?php echo date('Y'); ?> by EMIS.DB on Yii.<?php echo Yii::getVersion(); ?><br/> </div><!-- footer --> </div> </div><!-- page --> </body> </html>
/** * @return CDbConnection the DB connection instance * @throws CException if {@link connectionID} does not point to a valid application component. */ protected function getDbConnection() { if ($this->_db !== null) { return $this->_db; } elseif (($id = $this->connectionID) !== null) { if (($this->_db = Yii::app()->getComponent($id)) instanceof CDbConnection) { return $this->_db; } else { throw new CException(Yii::t('yii', 'CDbHttpSession.connectionID "{id}" is invalid. Please make sure it refers to the ID of a CDbConnection application component.', array('{id}' => $id))); } } else { $dbFile = Yii::app()->getRuntimePath() . DIRECTORY_SEPARATOR . 'session-' . Yii::getVersion() . '.db'; return $this->_db = new CDbConnection('sqlite:' . $dbFile); } }
/** * Checks if a given version is supported by the current running Yii version * @param String $checkVersion * @return boolean True if the given version is supportedby the running Yii * version */ public static function checkYiiVersion($checkVersion) { //remove dev builds $version = preg_replace("/[a-z]/", "", Yii::getVersion()); $yiiVersionNoBuilds = explode("-", $version); $checkVersion = explode(".", $checkVersion); $yiiVersion = explode(".", $yiiVersionNoBuilds[0]); $yiiVersion[2] = isset($yiiVersion[2]) ? $yiiVersion[2] : "0"; if ($yiiVersion[0] > $checkVersion[0]) { return true; } else { if ($yiiVersion[0] < $checkVersion[0]) { return false; } else { if ($yiiVersion[1] > $checkVersion[1]) { return true; } else { if ($yiiVersion[1] < $checkVersion[1]) { return false; } else { if ($yiiVersion[2] > $checkVersion[2]) { return true; } else { if ($yiiVersion[2] == $checkVersion[2]) { return true; } else { return false; } } } } } } return false; }
/** * Execute the action. * @param array $args command line parameters specific for this command */ public function run($args) { if (!isset($args[0])) { $args[0] = 'index.php'; } $entryScript = isset($args[0]) ? $args[0] : 'index.php'; if (($entryScript = realpath($args[0])) === false || !is_file($entryScript)) { $this->usageError("{$args[0]} does not exist or is not an entry script file."); } // fake the web server setting $cwd = getcwd(); chdir(dirname($entryScript)); $_SERVER['SCRIPT_NAME'] = '/' . basename($entryScript); $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; $_SERVER['SCRIPT_FILENAME'] = $entryScript; $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['SERVER_NAME'] = 'localhost'; $_SERVER['SERVER_PORT'] = 80; // reset context to run the web application restore_error_handler(); restore_exception_handler(); Yii::setApplication(null); Yii::setPathOfAlias('application', null); ob_start(); $config = (require $entryScript); ob_end_clean(); // oops, the entry script turns out to be a config file if (is_array($config)) { chdir($cwd); $_SERVER['SCRIPT_NAME'] = '/index.php'; $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; $_SERVER['SCRIPT_FILENAME'] = $cwd . DIRECTORY_SEPARATOR . 'index.php'; Yii::createWebApplication($config); } restore_error_handler(); restore_exception_handler(); $yiiVersion = Yii::getVersion(); echo <<<EOD Yii Interactive Tool v1.1 (based on Yii v{$yiiVersion}) Please type 'help' for help. Type 'exit' to quit. EOD; $this->runShell(); }
<?php echo Helper::translate("srbac", "Yii version") . " :"; ?> </td> <?php if (Helper::checkYiiVersion(Helper::findModule("srbac")->getSupportedYiiVersion())) { ?> <td><?php echo Yii::getVersion(); ?> </td> <?php } else { ?> <td style="color:red;font-weight:bold"><?php echo Yii::getVersion() . " <br /> " . Helper::translate("srbac", "Wrong Yii version, lower required version is") . " " . Helper::findModule("srbac")->getSupportedYiiVersion(); ?> </td> <?php $error = true; } ?> </tr> </table> </div> <div> <?php if ($error) { ?> <div> <?php
/** * @return string the file path that stores the sticky attribute values. */ public function getStickyFile() { return Yii::app()->runtimePath . '/gii-' . Yii::getVersion() . '/' . get_class($this) . '.php'; }
/** * Displays all available commands. */ protected function getDefaultHelp() { $commands = $this->getCommandDescriptions(); $this->stdout("\nThis is Yii version " . \Yii::getVersion() . ".\n"); if (!empty($commands)) { $this->stdout("\nThe following commands are available:\n\n", Console::BOLD); $len = 0; foreach ($commands as $command => $description) { $result = Yii::$app->createController($command); if ($result !== false) { /** @var $controller Controller */ list($controller, $actionID) = $result; $actions = $this->getActions($controller); if (!empty($actions)) { $prefix = $controller->getUniqueId(); foreach ($actions as $action) { $string = $prefix . '/' . $action; if ($action === $controller->defaultAction) { $string .= ' (default)'; } if (($l = strlen($string)) > $len) { $len = $l; } } } } elseif (($l = strlen($command)) > $len) { $len = $l; } } foreach ($commands as $command => $description) { $this->stdout('- ' . $this->ansiFormat($command, Console::FG_YELLOW)); $this->stdout(str_repeat(' ', $len + 4 - strlen($command))); $this->stdout(Console::wrapText($description, $len + 4 + 2), Console::BOLD); $this->stdout("\n"); $result = Yii::$app->createController($command); if ($result !== false) { list($controller, $actionID) = $result; $actions = $this->getActions($controller); if (!empty($actions)) { $prefix = $controller->getUniqueId(); foreach ($actions as $action) { $string = ' ' . $prefix . '/' . $action; $this->stdout(' ' . $this->ansiFormat($string, Console::FG_GREEN)); if ($action === $controller->defaultAction) { $string .= ' (default)'; $this->stdout(' (default)', Console::FG_YELLOW); } $summary = $controller->getActionHelpSummary($controller->createAction($action)); if ($summary !== '') { $this->stdout(str_repeat(' ', $len + 4 - strlen($string))); $this->stdout(Console::wrapText($summary, $len + 4 + 2)); } $this->stdout("\n"); } } $this->stdout("\n"); } } $scriptName = $this->getScriptName(); $this->stdout("\nTo see the help of each command, enter:\n", Console::BOLD); $this->stdout("\n {$scriptName} " . $this->ansiFormat('help', Console::FG_YELLOW) . ' ' . $this->ansiFormat('<command-name>', Console::FG_CYAN) . "\n\n"); } else { $this->stdout("\nNo commands are found.\n\n", Console::BOLD); } }
/** * Returns the Yii framework version. * * @return mixed */ public function getYiiVersion() { return \Yii::getVersion(); }
/** * Explicit, attention-grabbing error message w/o bug reporter. * * This is intended for errors that are NOT bugs, but that arise from server * malconfiguration and/or missing requirements for running X2Engine, as a * last-ditch effort to fail gracefully. * @param type $message */ public function error500($message) { $app = Yii::app(); $email = Yii::app()->params->adminEmail; $inAction = $this->action instanceof CAction; if ($app->params->hasProperty('admin')) { if ($app->params->admin->hasProperty('emailFromAddr')) { $email = $app->params->admin->emailFromAddr; } } else { if ($app->hasProperty('settings')) { if ($app->settings->hasProperty('emailFromAddr')) { $email = $app->settings->emailFromAddr; } } } $inAction = @is_subclass_of($this->action, 'CAction'); if ($inAction) { $data = array('scenario' => 'error', 'message' => Yii::t('admin', "Cannot run {action}.", array('{action}' => $this->action->id)), 'longMessage' => str_replace("\n", "<br />", $message)); $this->render('updater', $data); Yii::app()->end(); } else { $data = array('time' => time(), 'admin' => $email, 'version' => Yii::getVersion(), 'message' => $message); header("HTTP/1.1 500 Internal Server Error"); $this->renderPartial('system.views.error500', array('data' => $data)); } Yii::app()->end(); }
/** * Since 1.1.16 all static methods in CActiveRecord returns 'static' type. * @return bool */ public static function haveReturnStaticDoc() { return version_compare(Yii::getVersion(), '1.1.16') >= 0; }