Merge branch 'feature-production-fixes'

This commit is contained in:
Dmitry Khomutov 2017-04-16 22:15:33 +07:00
commit 7be61d1658
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
11 changed files with 70 additions and 18 deletions

View file

@ -33,9 +33,8 @@ test:
php_docblock_checker:
allow_failures: true
failure:
email:
committer: false
security_checker:
allow_failures: true
complete:
email:

View file

@ -1,4 +1,4 @@
[![PHPCensor](http://phpci.corpsee.com/build-status/image/9?branch=master&label=PHPCensor&style=flat-square)](http://phpci.corpsee.com/build-status/view/9?branch=master)
[![PHPCensor](http://php-censor.corpsee.com/build-status/image/6?branch=master&label=PHPCensor&style=flat-square)](http://php-censor.corpsee.com/build-status/view/6?branch=master)
[![TravisCI](https://img.shields.io/travis/corpsee/php-censor/master.svg?label=TravisCI&style=flat-square)](https://travis-ci.org/corpsee/php-censor?branch=master)
[![Latest Version](https://img.shields.io/packagist/v/corpsee/php-censor.svg?label=Version&style=flat-square)](https://packagist.org/packages/corpsee/php-censor)
[![Total downloads](https://img.shields.io/packagist/dt/corpsee/php-censor.svg?label=Downloads&style=flat-square)](https://packagist.org/packages/corpsee/php-censor)

View file

@ -585,7 +585,8 @@ h6,
}
.bg-gray {
color: #666;
background-color: #8aa4af !important;
color: #fff !important;
}
.timeline > .time-label > span {

View file

@ -39,7 +39,7 @@ abstract class Controller
public function __construct(Config $config, Request $request, Response $response)
{
$this->config = $config;
$this->config = $config;
$this->request = $request;
$this->response = $response;
}

View file

@ -10,6 +10,20 @@ class Database extends \PDO
protected static $details = [];
protected static $lastUsed = ['read' => null, 'write' => null];
/**
* @param string $table
*
* @return string
*/
public function lastInsertIdExtended($table = null)
{
if ($table && $this->getAttribute(self::ATTR_DRIVER_NAME) == 'pgsql') {
return parent::lastInsertId($table . '_id_seq');
}
return parent::lastInsertId();
}
protected static function init()
{
$config = Config::getInstance();

View file

@ -251,26 +251,28 @@ abstract class Store
public function saveByInsert(Model $obj, $saveAllColumns = false)
{
$rtn = null;
$data = $obj->getDataArray();
$rtn = null;
$data = $obj->getDataArray();
$modified = ($saveAllColumns) ? array_keys($data) : $obj->getModified();
$cols = [];
$values = [];
$qParams = [];
foreach ($modified as $key) {
$cols[] = $key;
$values[] = ':' . $key;
$cols[] = $key;
$values[] = ':' . $key;
$qParams[':' . $key] = $data[$key];
}
if (count($cols)) {
$qs = 'INSERT INTO {{' . $this->tableName . '}} (' . implode(', ', $cols) . ') VALUES (' . implode(', ',
$values) . ')';
$qs = 'INSERT INTO {{' . $this->tableName . '}} (' . implode(', ', $cols) . ') VALUES (' . implode(', ', $values) . ')';
$q = Database::getConnection('write')->prepareCommon($qs);
if ($q->execute($qParams)) {
$id = !empty($data[$this->primaryKey]) ? $data[$this->primaryKey] : Database::getConnection('write')->lastInsertId();
$id = !empty($data[$this->primaryKey])
? $data[$this->primaryKey]
: Database::getConnection('write')->lastInsertIdExtended($obj->getTableName());
$rtn = $this->getByPrimaryKey($id, 'write');
}
}

View file

@ -156,6 +156,7 @@ class ProjectController extends PHPCensor\Controller
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', APP_URL.'build/view/' . $build->getId());
return $response;
}

View file

@ -0,0 +1,28 @@
<?php
use Phinx\Migration\AbstractMigration;
class FixedEnvironments extends AbstractMigration
{
public function up()
{
$table = $this->table('build');
if ($table->hasColumn('environment')) {
$table
->changeColumn('environment', 'string', ['limit' => 250, 'null' => true])
->save();
}
}
public function down()
{
$table = $this->table('build');
if ($table->hasColumn('environment')) {
$table
->changeColumn('environment', 'string', ['limit' => 250, 'null' => false])
->save();
}
}
}

View file

@ -3,7 +3,7 @@ use PHPCensor\Helper\Lang;
$statuses = [];
$failures = 0;
$subcls = 'grey';
$subcls = 'gray';
$cls = '';
$success = null;
$failure = null;
@ -103,7 +103,7 @@ if ($buildCount > 0) {
<?php for ($idx=0; $idx < 5; $idx++) {
if (empty($builds[$idx])) {
echo '<span class="small-box-footer-build small-box-footer bg-grey"><i class="fa fa-minus"></i></span>';
echo '<span class="small-box-footer-build small-box-footer bg-gray"><i class="fa fa-minus"></i></span>';
} else {
$build = $builds[$idx];
$link = APP_URL . 'build/view/' . $build->id;

View file

@ -4,7 +4,7 @@ use PHPCensor\Helper\Lang;
foreach($projects as $project):
$statuses = [];
$failures = 0;
$subcls = 'grey';
$subcls = 'gray';
$cls = '';
$success = null;
$failure = null;
@ -104,7 +104,7 @@ foreach($projects as $project):
<?php for ($idx=0; $idx < 5; $idx++) {
if (empty($builds[$project->getId()][$idx])) {
echo '<span class="small-box-footer-build small-box-footer bg-grey"><i class="fa fa-minus"></i></span>';
echo '<span class="small-box-footer-build small-box-footer bg-gray"><i class="fa fa-minus"></i></span>';
} else {
$build = $builds[$project->getId()][$idx];
$link = APP_URL . 'build/view/' . $build->id;

View file

@ -3,7 +3,14 @@
<h2 class="box-title">Sorry, there was a problem</h2>
</div>
<?php
/** @var $exception \Exception */
?>
<div class="box-body">
<?php print $exception->getMessage(); ?>
<strong>Message</strong>: <?= $exception->getMessage(); ?><br />
<strong>File</strong>: <?= $exception->getFile(); ?><br />
<strong>Line</strong>: <?= $exception->getLine(); ?><br />
<strong>Trace</strong>:
<pre style="white-space: pre-wrap"><?= $exception->getTraceAsString(); ?></pre>
</div>
</div>