fix getting app version

This commit is contained in:
printempw 2016-08-28 21:48:15 +08:00
parent 15154eda7f
commit b7dc5e395e
8 changed files with 15 additions and 8 deletions

View File

@ -15,7 +15,7 @@ class Option
if (!is_null($default_value)) {
return $default_value;
} else {
$options = require BASE_DIR."/setup/options.php";
$options = require BASE_DIR."/config/options.php";
if (array_key_exists($key, $options)) {
self::add($key, $options[$key]);

View File

@ -52,6 +52,13 @@ class Updater
{
$this->current_version = $current_version;
$this->update_sources = require BASE_DIR."/config/update.php";
$source = \Option::get('update_source');
if (!isset($this->update_sources[$source])) {
Option::set('update_source', config('options.update_source'));
}
$this->current_source = $this->update_sources[\Option::get('update_source')];
}

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-07-29 11:53:11
* @Last Modified by: printempw
* @Last Modified time: 2016-08-19 23:11:29
* @Last Modified time: 2016-08-28 21:40:27
*/
return [
@ -31,7 +31,7 @@ return [
'avatar_query_string' => '0',
'version' => '',
'check_update' => '1',
'update_source' => 'github',
'update_source' => 'nyavm',
'copyright_text' => '<strong>Copyright &copy; 2016 <a href="{site_url}">{site_name}</a>.</strong> All rights reserved.',
'auto_del_invalid_texture' => '0'
];

View File

@ -21,7 +21,7 @@
<h3 class="box-title">下载更新</h3>
</div><!-- /.box-header -->
<div class="box-body"> <?php
$updater = new Updater(App::version());
$updater = new Updater(config('app.version'));
if ($updater->newVersionAvailable()) {
$zip_path = $updater->downloadUpdate(false);

View File

@ -21,7 +21,7 @@
</h1>
</section>
<?php $updater = new Updater(App::version()); ?>
<?php $updater = new Updater(config('app.version')); ?>
<!-- Main content -->
<section class="content">
<div class="row">

View File

@ -3,7 +3,7 @@
@section('content')
<h1>升级成功</h1>
<p>数据库升级成功,欢迎使用 Blessing Skin Server {{ App::version() }}</p>
<p>数据库升级成功,欢迎使用 Blessing Skin Server {{ config('app.version') }}</p>
<p class="step">
<a href="../" class="button button-large">首页</a>

View File

@ -3,7 +3,7 @@
@section('content')
<h1>还差一小步</h1>
<p>欢迎升级至 Blessing Skin Server {{ App::version() }}</p>
<p>欢迎升级至 Blessing Skin Server {{ config('app.version') }}</p>
<p>我们需要升级您的数据库,点击下一步以继续。</p>
<p class="step">

View File

@ -56,7 +56,7 @@ switch ($step) {
App\Services\Database\Migration::creatTables($db_config['prefix']);
// import options
$options = require "options.php";
$options = require BASE_DIR."/config/options.php";
$options['site_name'] = $_POST['sitename'];
$options['site_url'] = Http::getBaseUrl();
$options['version'] = config('app.version');