本文整理汇总了PHP中Yii::getVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP Yii::getVersion方法的具体用法?PHP Yii::getVersion怎么用?PHP Yii::getVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yii
的用法示例。
在下文中一共展示了Yii::getVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* 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;
}
示例2: startTool
/**
* @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;
}
示例3: beforeAction
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;
}
示例4: run
/**
* 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";
}
示例5: getServiceInfo
/**
* 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;
}
示例6: beforeAction
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);
}
示例7: getViewFile
/**
* 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';
}
}
示例8: addPrimaryKey
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);
}
}
示例9: getDbConnection
/**
* @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);
}
}
示例10: beforeAction
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);
}
示例11: actionIndex
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;
}
示例12: save
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'),
),
);
}
示例13: getVersionInfo
/**
* 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;
}
示例14: getInfo
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;
}
示例15: beforeAction
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);
}