Skip to content

Commit

Permalink
Merge branch 'hotfix/travis-memcached' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoust committed Sep 17, 2013
2 parents 427c373 + f38c516 commit 315af43
Show file tree
Hide file tree
Showing 236 changed files with 3,772 additions and 753 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ Thumbs.db

# composer itself is not needed
composer.phar

# Mac DS_Store Files
.DS_Store
14 changes: 12 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@ php:
- 5.4
- 5.5

env:
- CUBRID_VERSION=9.1.0

services:
- redis-server
- memcached

before_script:
- composer self-update && composer --version
- composer require satooshi/php-coveralls 0.6.*
- mysql -e 'CREATE DATABASE yiitest;';
- psql -U postgres -c 'CREATE DATABASE yiitest;';
- tests/unit/data/travis/apc-setup.sh
- tests/unit/data/travis/memcache-setup.sh
- tests/unit/data/travis/cubrid-setup.sh

script:
- phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml
- phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata

after_script:
- php vendor/bin/coveralls
- php vendor/bin/coveralls
2 changes: 2 additions & 0 deletions apps/advanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ You can then install the application using the following command:
php composer.phar create-project --stability=dev yiisoft/yii2-app-advanced yii-advanced
~~~

Note that in order to install some dependencies you must have `php_openssl` extension enabled.


### Install from an Archive File

Expand Down
8 changes: 7 additions & 1 deletion apps/advanced/backend/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,26 @@
'modules' => array(
),
'components' => array(
'request' => array(
'enableCsrfValidation' => true,
),
'db' => $params['components.db'],
'cache' => $params['components.cache'],
'user' => array(
'class' => 'yii\web\User',
'identityClass' => 'common\models\User',
),
'log' => array(
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => array(
array(
'class' => 'yii\log\FileTarget',
'levels' => array('error', 'warning'),
),
),
),
'errorHandler' => array(
'errorAction' => 'site/error',
),
),
'params' => $params,
);
30 changes: 30 additions & 0 deletions apps/advanced/backend/controllers/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,36 @@

class SiteController extends Controller
{
public function behaviors()
{
return array(
'access' => array(
'class' => \yii\web\AccessControl::className(),
'rules' => array(
array(
'actions' => array('login'),
'allow' => true,
'roles' => array('?'),
),
array(
'actions' => array('logout', 'index'),
'allow' => true,
'roles' => array('@'),
),
),
),
);
}

public function actions()
{
return array(
'error' => array(
'class' => 'yii\web\ErrorAction',
),
);
}

public function actionIndex()
{
return $this->render('index');
Expand Down
29 changes: 29 additions & 0 deletions apps/advanced/backend/views/site/error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

use yii\helpers\Html;

/**
* @var yii\base\View $this
* @var string $name
* @var string $message
* @var Exception $exception
*/

$this->title = $name;
?>
<div class="site-error">

<h1><?php echo Html::encode($this->title); ?></h1>

<div class="alert alert-danger">
<?php echo nl2br(Html::encode($message)); ?>
</div>

<p>
The above error occurred while the Web server was processing your request.
</p>
<p>
Please contact us if you think this is a server error. Thank you.
</p>

</div>
12 changes: 3 additions & 9 deletions apps/advanced/environments/dev/backend/config/main-local.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<?php
return array(
'preload' => array(
//'debug',
),
'modules' => array(
// 'debug' => array(
// 'class' => 'yii\debug\Module',
// ),
),
'components' => array(
'log' => array(
'targets' => array(
// array(
// 'class' => 'yii\log\DebugTarget',
// )
),
),
),
);
2 changes: 1 addition & 1 deletion apps/advanced/environments/dev/backend/web/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
// comment out the following line to disable debug mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
Expand Down
12 changes: 3 additions & 9 deletions apps/advanced/environments/dev/frontend/config/main-local.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<?php
return array(
'preload' => array(
//'debug',
),
'modules' => array(
// 'debug' => array(
// 'class' => 'yii\debug\Module',
// ),
),
'components' => array(
'log' => array(
'targets' => array(
// array(
// 'class' => 'yii\log\DebugTarget',
// )
),
),
),
);
3 changes: 1 addition & 2 deletions apps/advanced/environments/dev/frontend/web/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

// comment out the following line to disable debug mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
Expand Down
1 change: 1 addition & 0 deletions apps/advanced/environments/dev/yii
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

// fcgi doesn't have STDIN defined by default
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
Expand Down
2 changes: 1 addition & 1 deletion apps/advanced/environments/prod/backend/web/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
// comment out the following line to disable debug mode
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
Expand Down
3 changes: 1 addition & 2 deletions apps/advanced/environments/prod/frontend/web/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

// comment out the following line to disable debug mode
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
Expand Down
1 change: 1 addition & 0 deletions apps/advanced/environments/prod/yii
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

// fcgi doesn't have STDIN defined by default
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
Expand Down
9 changes: 8 additions & 1 deletion apps/advanced/frontend/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,29 @@
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'controllerNamespace' => 'frontend\controllers',
'modules' => array(
'gii' => 'yii\gii\Module'
),
'components' => array(
'request' => array(
'enableCsrfValidation' => true,
),
'db' => $params['components.db'],
'cache' => $params['components.cache'],
'user' => array(
'class' => 'yii\web\User',
'identityClass' => 'common\models\User',
),
'log' => array(
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => array(
array(
'class' => 'yii\log\FileTarget',
'levels' => array('error', 'warning'),
),
),
),
'errorHandler' => array(
'errorAction' => 'site/error',
),
),
'params' => $params,
);
26 changes: 26 additions & 0 deletions apps/advanced/frontend/controllers/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,37 @@

class SiteController extends Controller
{
public function behaviors()
{
return array(
'access' => array(
'class' => \yii\web\AccessControl::className(),
'only' => array('login', 'logout', 'signup'),
'rules' => array(
array(
'actions' => array('login', 'signup'),
'allow' => true,
'roles' => array('?'),
),
array(
'actions' => array('logout'),
'allow' => true,
'roles' => array('@'),
),
),
),
);
}

public function actions()
{
return array(
'error' => array(
'class' => 'yii\web\ErrorAction',
),
'captcha' => array(
'class' => 'yii\captcha\CaptchaAction',
'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
),
);
}
Expand Down
29 changes: 29 additions & 0 deletions apps/advanced/frontend/views/site/error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

use yii\helpers\Html;

/**
* @var yii\base\View $this
* @var string $name
* @var string $message
* @var Exception $exception
*/

$this->title = $name;
?>
<div class="site-error">

<h1><?php echo Html::encode($this->title); ?></h1>

<div class="alert alert-danger">
<?php echo nl2br(Html::encode($message)); ?>
</div>

<p>
The above error occurred while the Web server was processing your request.
</p>
<p>
Please contact us if you think this is a server error. Thank you.
</p>

</div>
2 changes: 2 additions & 0 deletions apps/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ php composer.phar create-project --stability=dev yiisoft/yii2-app-basic yii-basi
Now you should be able to access the application using the URL `http://localhost/yii-basic/web/`,
assuming `yii-basic` is directly under the document root of your Web server.

Note that in order to install some dependencies you must have `php_openssl` extension enabled.


### Install from an Archive File

Expand Down
7 changes: 5 additions & 2 deletions apps/basic/config/web.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?php

$params = require(__DIR__ . '/params.php');
$config = array(
'id' => 'bootstrap',
'basePath' => dirname(__DIR__),
'components' => array(
'request' => array(
'enableCsrfValidation' => true,
),
'cache' => array(
'class' => 'yii\caching\FileCache',
),
Expand All @@ -23,7 +26,7 @@
),
),
),
'params' => require(__DIR__ . '/params.php'),
'params' => $params,
);

if (YII_ENV_DEV) {
Expand Down
22 changes: 22 additions & 0 deletions apps/basic/controllers/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,28 @@

class SiteController extends Controller
{
public function behaviors()
{
return array(
'access' => array(
'class' => \yii\web\AccessControl::className(),
'only' => array('login', 'logout'),
'rules' => array(
array(
'actions' => array('login'),
'allow' => true,
'roles' => array('?'),
),
array(
'actions' => array('logout'),
'allow' => true,
'roles' => array('@'),
),
),
),
);
}

public function actions()
{
return array(
Expand Down
2 changes: 1 addition & 1 deletion apps/basic/views/layouts/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
array('label' => 'Contact', 'url' => array('/site/contact')),
Yii::$app->user->isGuest ?
array('label' => 'Login', 'url' => array('/site/login')) :
array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')),
array('label' => 'Logout (' . Html::encode(Yii::$app->user->identity->username) .')' , 'url' => array('/site/logout')),
),
));
NavBar::end();
Expand Down
Loading

0 comments on commit 315af43

Please sign in to comment.