Merge branch 'feature-production-fixes'
This commit is contained in:
commit
7be61d1658
11 changed files with 70 additions and 18 deletions
|
|
@ -33,9 +33,8 @@ test:
|
|||
php_docblock_checker:
|
||||
allow_failures: true
|
||||
|
||||
failure:
|
||||
email:
|
||||
committer: false
|
||||
security_checker:
|
||||
allow_failures: true
|
||||
|
||||
complete:
|
||||
email:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[](http://phpci.corpsee.com/build-status/view/9?branch=master)
|
||||
[](http://php-censor.corpsee.com/build-status/view/6?branch=master)
|
||||
[](https://travis-ci.org/corpsee/php-censor?branch=master)
|
||||
[](https://packagist.org/packages/corpsee/php-censor)
|
||||
[](https://packagist.org/packages/corpsee/php-censor)
|
||||
|
|
|
|||
|
|
@ -585,7 +585,8 @@ h6,
|
|||
}
|
||||
|
||||
.bg-gray {
|
||||
color: #666;
|
||||
background-color: #8aa4af !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.timeline > .time-label > span {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue