Skip to content

Commit

Permalink
Merge pull request #13 from yeskn-studio/2.0-dev
Browse files Browse the repository at this point in the history
3.0 dev
  • Loading branch information
Jaggle authored Mar 31, 2019
2 parents 74b7678 + f12a918 commit 17813eb
Show file tree
Hide file tree
Showing 42 changed files with 1,608 additions and 973 deletions.
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

36 changes: 16 additions & 20 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# 安装手册

cd /path/to/webroot/path
> 以下文档中 `webuser`均指运行的web server的用户,如果不用`sudo -u <webuser>`执行命令的话,
> 会导致某些runtime目录的权限不对,导致网页打不开。
>
> 在vmoex的根目录下,执行`php bin/console` 命令时建议都带上`sudo -u <webuser>` 前缀
cd /path/to/webroot/path
git clone [email protected]:yeskn-studio/vmoex-framework.git && cd vmoex-framework

**或者指定版本,比如:**

git clone --branch v2.1.1 [email protected]:yeskn-studio/vmoex-framework.git && cd vmoex-framework

**修改runtime目录权限**

chown -R [webuser] var (各类日志缓存存放目录)
Expand All @@ -17,39 +17,36 @@
**修改配置文件**

vim app/config/parameters.yml.dist

请按照文件中的注释修改成自己服务器的配置。

**安装php依赖**

composer install (期间会提示配置,检查无误可一路回车)
composer install (期间会提示配置,检查无误可一路回车,可能耗时比较长,请耐心等待,如果失败,建议修改composer的源

**安装前端依赖**

yarn install
yarn install (耐心等待...)

**创建数据库**

php bin/console doctrine:database:create (如果你已经手动创建了数据库,可跳过)
sudo -u [webuser] php bin/console doctrine:database:create (如果你已经手动创建了数据库,可跳过)

**导入数据**

php bin/console doctrine:database:init

**载入翻译数据**

php bin/console translation:persist
sudo -u [webuser] php bin/console doctrine:database:init

**修改管理员密码**

php bin/console change-password -u admin -p [password]
sudo -u [webuser] php bin/console change-password -u admin -p [password]

**清理缓存**

chown -R [webuser] var (上面已经执行过,这里再执行一次)
sudo -u [webuser] php bin/console cache:clear --env=dev

**创建静态资源文件**

php bin/console assetic:dump --env=dev
sudo -u [webuser] php bin/console assetic:dump --env=dev

**启动websocket**

Expand Down Expand Up @@ -99,14 +96,13 @@ server {

**清理prod模式下的缓存**

chown -R [webuser] var
sudo -u [webuser] php bin/console cache:clear --env=prod

**生成prod模式下的静态资源文件**

php bin/console assetic:dump --env=prod
sudo -u [webuser] php bin/console assetic:dump --env=prod

## 注意!!

app/config/parameters.yml.dist并不是真正生效的配置文件,真正生效的是自动生成的app/config/parameters.yml,
需修改配置时请修改此文件,修改完后,需要重新清理缓存或者生成静态资源文件
**app/config/parameters.yml.dist**并不是真正生效的配置文件,真正生效的是自动生成的**app/config/parameters.yml**
需修改配置时请修改此文件,修改完后,**需要重新清理缓存**或者生成静态资源文件
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
<a href="LICENSE" target="_blank">
<img alt="Software License" src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square">
</a>
<a href="https://travis-ci.org/yeskn-studio/vmoex-framework">
<img src="https://travis-ci.org/yeskn-studio/vmoex-framework.svg?branch=master">
</a>
<a href="https://codecov.io/gh/yeskn-studio/vmoex-framework">
<img src="https://codecov.io/gh/yeskn-studio/vmoex-framework/branch/master/graph/badge.svg" />
</a>
</p>

<p align="center">
Expand Down
79 changes: 79 additions & 0 deletions UPGRADE-3.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# UPGRADE FROM 2.X to 3.0

此文档用于提供向2.x升级到3.0的向导。


> 以下文档中 `webuser`均指运行的web server的用户,如果不用`sudo -u <webuser>`执行命令的话,
> 会导致某些runtime目录的权限不对,导致网页打不开。
>
> 在vmoex的根目录下,执行`php bin/console` 命令时建议都带上`sudo -u <webuser>` 前缀
## 清理缓存

任何时候,都应当清理缓存:

```bash
sudo -u <webuser> php bin/console cache:clear --env=prod
```

> 大多数情况下,如果你遇到了问题,不妨执行以上命令。
## 拉取代码

如果你修改或者增加过翻译词条,请直接看如下的**翻译文件**,如果没有,直接执行如下命令即可:

```
git pull origin master
```

## 翻译文件

> 如果你修改过翻译文件,用 `git statsu`命令会发现 `app/Resources/translations`目录下有修改的文件,这时`git pull`可能会失败,
这时,需要使用 `git stash`命令暂存起来,再执行`git pull origin master`,然后执行`git stash pop`将暂存的修改拿出来合并到新增的词条中。

将新增的翻译载入到数据库中:

```
sudo -u <webuser> php bin/console translation:persist
```

## 前端更新

由于bower已经不再维护了,因此vmoex也由bower切换到目前比较流行的前端包管理工具**yarn**,安装yarn:

```
npm install yarn -g
```

yarn的使用方式也类似:

```bash
yarn install
```

即可。

## 生成资源文件

```
sudo -u <webuser> php bin/console assetic:dump --env=prod
```


## 数据库结构更新

由于vmoex使用了redis的查询缓存,因此需要先执行如下命令去掉缓存:

```bash
sudo -u <webuser> php bin/console doctrine:cache:clear-metadata --env=prod
```

再更新数据库结构:

```bash
php bin/console doctrine:schema:update --dump-sql --force --env=prod
```

以上命令在更新数据库的同时也会显示执行了哪些sql。


7 changes: 7 additions & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ public function getCacheDir()
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
}

protected function getKernelParameters()
{
$params = parent::getKernelParameters();
$params['kernel.config_dir'] = $this->getRootDir() . '/config';
return $params;
}

public function getLogDir()
{
return dirname(__DIR__).'/var/logs';
Expand Down
1 change: 1 addition & 0 deletions app/Resources/translations/messages.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,4 @@ no_enough_gold: 'Shortage of gold coins'
comment_not_exist: 'Comments do not exist'
cant_modify_current_user_in_admin: 'cant modify current user in admin'
hours: h
access_denied: 'access denied'
1 change: 1 addition & 0 deletions app/Resources/translations/messages.jp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,4 @@ no_enough_gold: 金貨が足りない
comment_not_exist: コメントは存在しません
cant_modify_current_user_in_admin: null
hours: 時間
access_denied: 访问被拒绝
1 change: 1 addition & 0 deletions app/Resources/translations/messages.zh_CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,4 @@ cant_modify_current_user_in_admin: 不能在管理端修改当前个人信息,
user_not_exist: 用户不存在
locale_invalid: 非法的语言
hours: 小时
access_denied: 访问被拒绝
1 change: 1 addition & 0 deletions app/Resources/translations/messages.zh_TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,4 @@ no_enough_gold: 金幣不足
comment_not_exist: 評論不存在
cant_modify_current_user_in_admin: null
hours: 小時
access_denied: 访问被拒绝
3 changes: 0 additions & 3 deletions app/Resources/views/form/image-input-filed-type.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
</div>
{% endif %}
{{ form_widget(form, {attr: {class: 'form-control'}}) }}
{% if attr['help'] is defined %}
<span class="help-block small-font">{{ attr['help'] }}</span>
{% endif %}
{{ form_errors(form) }}
{% endfilter %}
{% endblock image_input_widget %}
14 changes: 14 additions & 0 deletions app/Resources/views/form/vertical-search-field.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% block form_row %}
{% filter spaceless %}
<div class="form-group" style="width: 33.3%">
{{ form_label(form, '', {label_attr: {class: 'col-sm-3'}}) }}
<div class="col-sm-9">
{{ form_widget(form) }}
{% if attr['help'] is defined %}
<span class="help-block small-font">{{ attr['help'] }}</span>
{% endif %}
</div>
{{ form_errors(form) }}
</div>
{% endfilter %}
{% endblock form_row %}
2 changes: 1 addition & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ framework:
secret: '%secret%'
translator: { fallbacks: ["%locale%"] }
router:
resource: '%kernel.project_dir%/app/config/routing.yml'
resource: '%kernel.config_dir%/routing.yml'
strict_requirements: ~
form: ~
csrf_protection: ~
Expand Down
2 changes: 1 addition & 1 deletion app/config/config_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ imports:

framework:
router:
resource: '%kernel.project_dir%/app/config/routing_dev.yml'
resource: '%kernel.config_dir%/routing_dev.yml'
strict_requirements: true
profiler: { only_exceptions: false }

Expand Down
1 change: 1 addition & 0 deletions app/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ services:
- { name: kernel.event_listener, event: kernel.response }

Symfony\Bridge\Twig\Extension\AssetExtension: "@twig.extension.assets"
Symfony\Bundle\SecurityBundle\Security\FirewallMap: "@security.firewall.map"
5 changes: 0 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
"app/AppCache.php"
]
},
"autoload-dev": {
"files": [
"vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
]
},
"require": {
"php": ">=5.5.9",
"doctrine/doctrine-bundle": "^1.6",
Expand Down
Loading

0 comments on commit 17813eb

Please sign in to comment.