本文整理汇总了PHP中Pagekit\Application::version方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::version方法的具体用法?PHP Application::version怎么用?PHP Application::version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagekit\Application
的用法示例。
在下文中一共展示了Application::version方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: migrateAction
/**
* @Request({"redirect": "string"}, csrf=true)
*/
public function migrateAction($redirect = null)
{
if ($updates = $this->scripts->hasUpdates()) {
$this->scripts->update();
$message = __('Your Pagekit database has been updated successfully.');
} else {
$message = __('Your database is up to date.');
}
App::config('system')->set('version', App::version());
if ($redirect) {
App::message()->success($message);
return App::redirect($redirect);
}
return App::response()->json(compact('status', 'message'));
}
示例2: migrateAction
/**
* @Request({"redirect": "string"}, csrf=true)
*/
public function migrateAction($redirect = null)
{
$config = App::config('system');
$manager = new PackageManager();
$scripts = $manager->loadScripts(null, __DIR__ . '/../../scripts.php');
if (isset($scripts['updates'])) {
$updates = $manager->filterUpdates($scripts['updates'], $config->get('version'));
$manager->execute($updates);
}
$config->set('version', App::version());
$message = __('Your Pagekit database has been updated successfully.');
if ($redirect) {
App::message()->success($message);
return App::redirect($redirect);
}
return App::response()->json(compact('status', 'message'));
}
示例3: get
/**
* Method to get the system information
*
* @return string[]
*/
public function get()
{
$server = new ServerBag($GLOBALS['_SERVER']);
$info = [];
$info['php'] = php_uname();
if ($pdo = App::db()->getWrappedConnection() and $pdo instanceof PDOConnection) {
$info['dbdriver'] = $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
$info['dbversion'] = $pdo->getAttribute(\PDO::ATTR_SERVER_VERSION);
$info['dbclient'] = $pdo->getAttribute(\PDO::ATTR_CLIENT_VERSION);
}
$info['phpversion'] = phpversion();
$info['server'] = $server->get('SERVER_SOFTWARE', getenv('SERVER_SOFTWARE'));
$info['sapi_name'] = php_sapi_name();
$info['version'] = App::version();
$info['useragent'] = $server->get('HTTP_USER_AGENT');
$info['extensions'] = implode(", ", get_loaded_extensions());
$info['directories'] = $this->getDirectories();
return $info;
}
示例4: App
<?php
use Pagekit\Application as App;
use Pagekit\Application\Console\Application as Console;
use Pagekit\Module\Loader\AutoLoader;
use Pagekit\Module\Loader\ConfigLoader;
$loader = (require $path . '/autoload.php');
$app = new App($config);
$app['autoloader'] = $loader;
$app['module']->register(['packages/*/*/index.php', 'app/modules/*/index.php', 'app/installer/index.php', 'app/system/index.php', 'app/console/index.php'], $path);
$app['module']->addLoader(new AutoLoader($app['autoloader']));
$app['module']->addLoader(new ConfigLoader(require $path . '/app/system/config.php'));
if ($app['config.file']) {
$app['module']->addLoader(new ConfigLoader(require $app['config.file']));
$app['module']->load('system');
}
$app['module']->load('console');
$console = new Console($app, 'Rimbo', $app->version());
$console->run();
示例5: indexAction
/**
* @Route("/", methods="GET")
*/
public function indexAction()
{
return ['$view' => ['title' => __('Dashboard'), 'name' => 'system/dashboard:views/index.php'], '$data' => ['widgets' => array_values($this->dashboard->getWidgets()), 'api' => App::get('system.api'), 'version' => App::version(), 'channel' => 'stable']];
}
示例6: indexAction
public function indexAction()
{
return ['$view' => ['title' => __('Update'), 'name' => 'installer:views/update.php'], '$data' => ['api' => App::get('system.api'), 'version' => App::version(), 'channel' => 'stable']];
}
示例7: installAction
/**
* @Request({"config": "array", "option": "array", "user": "array"})
*/
public function installAction($config = [], $option = [], $user = [])
{
$status = $this->checkAction($config);
$message = $status['message'];
$status = $status['status'];
try {
if ('no-connection' == $status) {
App::abort(400, __('No database connection.'));
}
if ('tables-exist' == $status) {
App::abort(400, $message);
}
$scripts = new PackageScripts(App::path() . '/app/system/scripts.php');
$scripts->install();
App::db()->insert('@system_user', ['name' => $user['username'], 'username' => $user['username'], 'password' => App::get('auth.password')->hash($user['password']), 'status' => 1, 'email' => $user['email'], 'registered' => date('Y-m-d H:i:s'), 'roles' => '2,3']);
$option['system']['version'] = App::version();
$option['system']['extensions'] = ['blog'];
$option['system']['site']['theme'] = 'theme-one';
foreach ($option as $name => $values) {
App::config()->set($name, App::config($name)->merge($values));
}
if ($this->packages) {
$installer = new PackageManager(new NullOutput());
$installer->install($this->packages);
}
if (file_exists(__DIR__ . '/../../install.php')) {
require_once __DIR__ . '/../../install.php';
}
if (!$this->config) {
$configuration = new Config();
$configuration->set('application.debug', false);
foreach ($config as $key => $value) {
$configuration->set($key, $value);
}
$configuration->set('system.secret', App::get('auth.random')->generateString(64));
if (!file_put_contents($this->configFile, $configuration->dump())) {
$status = 'write-failed';
App::abort(400, __('Can\'t write config.'));
}
}
App::module('system/cache')->clearCache();
$status = 'success';
} catch (DBALException $e) {
$status = 'db-sql-failed';
$message = __('Database error: %error%', ['%error%' => $e->getMessage()]);
} catch (\Exception $e) {
$message = $e->getMessage();
}
return ['status' => $status, 'message' => $message];
}