From b7dc5e395e9452dc9ecb166c372461e0576fc1dd Mon Sep 17 00:00:00 2001 From: printempw Date: Sun, 28 Aug 2016 21:48:15 +0800 Subject: [PATCH] fix getting app version --- app/Services/Option.php | 2 +- app/Services/Updater.php | 7 +++++++ {setup => config}/options.php | 4 ++-- resources/views/admin/download.tpl | 2 +- resources/views/admin/update.tpl | 2 +- resources/views/setup/updates/success.tpl | 2 +- resources/views/setup/updates/welcome.tpl | 2 +- setup/index.php | 2 +- 8 files changed, 15 insertions(+), 8 deletions(-) rename {setup => config}/options.php (93%) diff --git a/app/Services/Option.php b/app/Services/Option.php index 060856be..f664ca3d 100644 --- a/app/Services/Option.php +++ b/app/Services/Option.php @@ -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]); diff --git a/app/Services/Updater.php b/app/Services/Updater.php index 3cfe8755..9c91c146 100644 --- a/app/Services/Updater.php +++ b/app/Services/Updater.php @@ -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')]; } diff --git a/setup/options.php b/config/options.php similarity index 93% rename from setup/options.php rename to config/options.php index 4ed57e8a..cf70c226 100644 --- a/setup/options.php +++ b/config/options.php @@ -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' => 'Copyright © 2016 {site_name}. All rights reserved.', 'auto_del_invalid_texture' => '0' ]; diff --git a/resources/views/admin/download.tpl b/resources/views/admin/download.tpl index 4dc842df..1139bb4d 100644 --- a/resources/views/admin/download.tpl +++ b/resources/views/admin/download.tpl @@ -21,7 +21,7 @@

下载更新

newVersionAvailable()) { $zip_path = $updater->downloadUpdate(false); diff --git a/resources/views/admin/update.tpl b/resources/views/admin/update.tpl index 68380518..3babe30f 100644 --- a/resources/views/admin/update.tpl +++ b/resources/views/admin/update.tpl @@ -21,7 +21,7 @@ - +
diff --git a/resources/views/setup/updates/success.tpl b/resources/views/setup/updates/success.tpl index afb15e51..8a1f6903 100644 --- a/resources/views/setup/updates/success.tpl +++ b/resources/views/setup/updates/success.tpl @@ -3,7 +3,7 @@ @section('content')

升级成功

-

数据库升级成功,欢迎使用 Blessing Skin Server {{ App::version() }}!

+

数据库升级成功,欢迎使用 Blessing Skin Server {{ config('app.version') }}!

首页 diff --git a/resources/views/setup/updates/welcome.tpl b/resources/views/setup/updates/welcome.tpl index 1bfd75f8..ad98a266 100644 --- a/resources/views/setup/updates/welcome.tpl +++ b/resources/views/setup/updates/welcome.tpl @@ -3,7 +3,7 @@ @section('content')

还差一小步

-

欢迎升级至 Blessing Skin Server {{ App::version() }}!

+

欢迎升级至 Blessing Skin Server {{ config('app.version') }}!

我们需要升级您的数据库,点击下一步以继续。

diff --git a/setup/index.php b/setup/index.php index 43eea247..a9d95e20 100644 --- a/setup/index.php +++ b/setup/index.php @@ -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');