Skip to content

Commit

Permalink
Merge branch 'master' into fix-pjax-automatic-id
Browse files Browse the repository at this point in the history
  • Loading branch information
dynasource authored Dec 9, 2016
2 parents fec8ae2 + bd85b7c commit 475d18c
Show file tree
Hide file tree
Showing 100 changed files with 4,857 additions and 425 deletions.
6 changes: 2 additions & 4 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
engines:
duplication:
enabled: true
Expand All @@ -12,9 +11,8 @@ engines:
enabled: true
phpmd:
enabled: true
checks:
CleanCode/StaticAccess:
enabled: false
config:
rulesets: "codesize,design,unusedcode,tests/data/codeclimate/phpmd_ruleset.xml"
ratings:
paths:
- "**.js"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ phpunit.phar
# ignore sub directory for dev installed apps and extensions
/apps
/extensions

# NPM packages
/node_modules
64 changes: 48 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#
# Travis Setup
#

# use ubuntu trusty for newer version of nodejs, used for JS testing
dist: trusty

# faster builds on new travis setup not using sudo
sudo: false


#
# Test Matrix
#

language: php

php:
Expand All @@ -19,20 +32,23 @@ matrix:
dist: trusty
group: edge # Use edge image until the next travis CI image update
addons:
code_climate:
repo_token: 2935307212620b0e2228ab67eadd92c9f5501ddb60549d0d86007a354d56915b
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
services:
- mysql
env: CUBRID_VERSION=9.3.0/CUBRID-9.3.0.0206 CUBRID_PDO_VERSION=9.3.0.0001
# test against the latest HHVM version by using a newer image
- php: hhvm
sudo: true
dist: trusty
group: edge # Use edge image until the next travis CI image update
addons:
code_climate:
repo_token: 2935307212620b0e2228ab67eadd92c9f5501ddb60549d0d86007a354d56915b
postgresql: "9.3"
apt:
packages:
Expand All @@ -42,26 +58,48 @@ matrix:
services:
- mysql
- postgresql
env: CUBRID_VERSION=9.3.0/CUBRID-9.3.0.0206 CUBRID_PDO_VERSION=9.3.0.0001
# have a separate branch for javascript tests
- language: node_js
node_js: 6
dist: trusty
# overwrite php related settings
php:
services:
addons:
install:
- travis_retry npm install
# disable xdebug for performance in composer
- phpenv config-rm xdebug.ini || echo "xdebug is not installed"
- travis_retry composer self-update && composer --version
- travis_retry composer global require "fxp/composer-asset-plugin:^1.2.0" --no-plugins
- travis_retry composer update --prefer-dist --no-interaction
before_script:
- node --version
- npm --version
- php --version
- composer --version
script: npm test
after_script:

allow_failures:
- php: nightly

env:
- CUBRID_VERSION=9.3.0/CUBRID-9.3.0.0206 CUBRID_PDO_VERSION=9.3.0.0001

services:
- memcached

# cache vendor dirs
cache:
directories:
# - cubrid/9.3.0
- vendor
- $HOME/.composer/cache
- $HOME/.npm

# try running against postgres 9.3
addons:
postgresql: "9.3"
code_climate:
repo_token: 2935307212620b0e2228ab67eadd92c9f5501ddb60549d0d86007a354d56915b

install:
- |
Expand All @@ -70,7 +108,7 @@ install:
phpenv config-rm xdebug.ini || echo "xdebug is not installed"
fi
- travis_retry composer self-update && composer --version
- travis_retry composer global require "fxp/composer-asset-plugin:^1.2.0"
- travis_retry composer global require "fxp/composer-asset-plugin:^1.2.0" --no-plugins
- export PATH="$HOME/.composer/vendor/bin:$PATH"
# core framework:
- travis_retry composer update --prefer-dist --no-interaction
Expand All @@ -86,18 +124,12 @@ before_script:
- psql --version

# initialize databases
- |
if [[ $TRAVIS_PHP_VERSION != hhv* ]]; then
mysql -e 'CREATE DATABASE `yiitest`;'
fi
- |
if [[ $TRAVIS_PHP_VERSION = hhv* ]]; then
mysql -u root -e 'CREATE DATABASE yiitest;';
mysql -u root -e 'CREATE USER 'travis'@'localhost' IDENTIFIED WITH mysql_native_password;'
mysql -u root -e 'GRANT ALL PRIVILEGES ON *.* TO 'travis'@'localhost' WITH GRANT OPTION;'
fi
- mysql -e 'CREATE DATABASE `yiitest`;';
- mysql -e "CREATE USER 'travis'@'localhost' IDENTIFIED WITH mysql_native_password;";
- mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'travis'@'localhost' WITH GRANT OPTION;";
- psql -U postgres -c 'CREATE DATABASE yiitest;';

# enable code coverage on PHP 5.6, only one PHP version needs to generate coverage data
- |
if [ $TRAVIS_PHP_VERSION = '5.6' ]; then
PHPUNIT_FLAGS="--coverage-clover=coverage.clover"
Expand Down
58 changes: 58 additions & 0 deletions contrib/completion/bash/yii
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This file implements bash completion for the ./yii command file.
# It completes the commands available by the ./yii command.
# See also:
# - https://debian-administration.org/article/317/An_introduction_to_bash_completion_part_2 on how this works.
# - https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html
# - http://www.yiiframework.com/doc-2.0/guide-tutorial-console.html#bash-completion
#
# Usage:
# Temporarily you can source this file in you bash by typing: source yii
# For permanent availability, copy or link this file to /etc/bash_completion.d/
#

_yii()
{
local cur opts yii command
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
yii="${COMP_WORDS[0]}"

# exit if ./yii does not exist
test -f $yii || return 0

# lookup for command
for word in ${COMP_WORDS[@]:1}; do
if [[ $word != -* ]]; then
command=$word
break
fi
done

[[ $cur == $command ]] && state="command"
[[ $cur != $command ]] && state="option"
[[ $cur = *=* ]] && state="value"

case $state in
command)
# complete command/route if not given
# fetch available commands from ./yii help/list command
opts=$($yii help/list 2> /dev/null)
;;
option)
# fetch available options from ./yii help/list-action-options command
opts=$($yii help/list-action-options $command 2> /dev/null | grep -o '^--[a-zA-Z0-9]*')
;;
value)
# TODO allow normal file completion after an option, e.g. --migrationPath=...
;;
esac

# generate completion suggestions
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0

}

# register completion for the ./yii command
# you may adjust this line if your command file is named differently
complete -F _yii ./yii yii
38 changes: 38 additions & 0 deletions contrib/completion/zsh/_yii
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#compdef yii

_yii() {
local state command lastArgument commands options executive
lastArgument=${words[${#words[@]}]}
executive=$words[1]

# lookup for command
for word in ${words[@]:1}; do
if [[ $word != -* ]]; then
command=$word
break
fi
done


[[ $lastArgument == $command ]] && state="command"
[[ $lastArgument != $command ]] && state="option"

case $state in
command)
commands=("${(@f)$(${executive} help/list 2>/dev/null)}")
_describe 'command' commands
;;
option)
options=("${(@f)$(${executive} help/usage ${command} 2>/dev/null)}")
_message -r "$options"

suboptions=("${(@f)$(${executive} help/list-action-options ${command} 2>/dev/null)}")
_describe -V -o -t suboption 'action options' suboptions
;;
*)
esac

}

compdef _yii yii

2 changes: 1 addition & 1 deletion docs/guide-es/security-authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class RbacController extends Controller
```

> Note: Si estas utilizando el template avanzado, necesitas poner tu `RbacController` dentro del directorio `console/controllers`
y cambiar el espacio de nombres a `console/controllers`.
y cambiar el espacio de nombres a `console\controllers`.

Después de ejecutar el comando `yii rbac/init`, obtendremos la siguiente jerarquía:

Expand Down
2 changes: 1 addition & 1 deletion docs/guide-fr/security-authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class RbacController extends Controller
}
```

> Note: si vous utilisez le modèle avancé, vous devez mettre votre `RbacController` dans le dossier `console/controllers` et changer l'espace de noms en `console/controllers`.
> Note: si vous utilisez le modèle avancé, vous devez mettre votre `RbacController` dans le dossier `console/controllers` et changer l'espace de noms en `console\controllers`.
Après avoir exécuté la commande `yii rbac/init` vous vous retrouverez avec la hiérarchie suivante :

Expand Down
2 changes: 1 addition & 1 deletion docs/guide-ja/security-authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class RbacController extends Controller
```

> Note: アドバンストテンプレートを使おうとするときは、`RbacController``console/controllers`
ディレクトリの中に置いて、名前空間を `console/controllers` に変更する必要があります。
ディレクトリの中に置いて、名前空間を `console\controllers` に変更する必要があります。

`yii rbac/init` によってコマンドを実行した後には、次の権限階層が得られます。

Expand Down
4 changes: 4 additions & 0 deletions docs/guide-ru/caching-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ if ($data === false) {
}
```

Начиная с версии 2.0.11 вы можете изменить значение по умолчанию (бесконечность) для длительности кеширования задав
[[yii\caching\Cache::$defaultDuration|defaultDuration]] в конфигурации компонента кеша. Таким образом, можно будет
не передавать значение `duration` в [[yii\caching\Cache::set()|set()]] каждый раз.

### Зависимости кэша <span id="cache-dependencies"></span>

В добавок к изменению срока действия ключа элемент может быть признан недействительным из-за *изменения зависимостей*. К примеру, [[yii\caching\FileDependency]] представляет собой зависимость от времени изменения файла. Когда это время изменяется, любые устаревшие данные, найденные в кэше, должны быть признаны недействительным, а [[yii\caching\Cache::get()|get()]] в этом случае должен вернуть `false`.
Expand Down
23 changes: 23 additions & 0 deletions docs/guide-ru/concept-configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,29 @@ $config = [
За более подробной документацией о настройках свойства `components` в конфигурации приложения обратитесь к главам
[приложения](structure-applications.md) и [Service Locator](concept-service-locator.md).

Начиная с версии 2.0.11, можно настраивать [контейнер зависимостей](concept-di-container.md) через конфигурацию
приложения. Для этого используется свойство `container`:

```php
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
'container' => [
'definitions' => [
'yii\widgets\LinkPager' => ['maxButtonCount' => 5]
],
'singletons' => [
// Конфигурация для единожды создающихся объектов
]
]
];
```

Чтобы узнать о возможных значениях `definitions` и `singletons`, а также о реальных примерах использования,
прочитайте подраздел [более сложное практическое применение](concept-di-container.md#advanced-practical-usage) раздела
[Dependency Injection Container](concept-di-container.md).


### Конфигурации виджетов <span id="widget-configurations"></span>

Expand Down
Loading

0 comments on commit 475d18c

Please sign in to comment.