Code style fixes (camelCased variables).
This commit is contained in:
parent
4013fc76ff
commit
8d9c4824c7
|
@ -221,8 +221,8 @@ class Application
|
|||
$groups[] = $thisGroup;
|
||||
}
|
||||
|
||||
$archived_projects = Factory::getStore('Project')->getAll(true);
|
||||
$layout->archived_projects = $archived_projects['items'];
|
||||
$archivedProjects = Factory::getStore('Project')->getAll(true);
|
||||
$layout->archived_projects = $archivedProjects['items'];
|
||||
$layout->groups = $groups;
|
||||
}
|
||||
|
||||
|
|
|
@ -195,12 +195,11 @@ class Builder implements LoggerAwareInterface
|
|||
$this->build->sendStatusPostback();
|
||||
$success = true;
|
||||
|
||||
$previous_build = $this->build->getProject()->getPreviousBuild($this->build->getBranch());
|
||||
$previousBuild = $this->build->getProject()->getPreviousBuild($this->build->getBranch());
|
||||
$previousState = Build::STATUS_PENDING;
|
||||
|
||||
$previous_state = Build::STATUS_PENDING;
|
||||
|
||||
if ($previous_build) {
|
||||
$previous_state = $previous_build->getStatus();
|
||||
if ($previousBuild) {
|
||||
$previousState = $previousBuild->getStatus();
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -232,13 +231,13 @@ class Builder implements LoggerAwareInterface
|
|||
if ($success) {
|
||||
$this->pluginExecutor->executePlugins($this->config, Build::STAGE_SUCCESS);
|
||||
|
||||
if ($previous_state == Build::STATUS_FAILED) {
|
||||
if ($previousState == Build::STATUS_FAILED) {
|
||||
$this->pluginExecutor->executePlugins($this->config, Build::STAGE_FIXED);
|
||||
}
|
||||
} else {
|
||||
$this->pluginExecutor->executePlugins($this->config, Build::STAGE_FAILURE);
|
||||
|
||||
if ($previous_state == Build::STATUS_SUCCESS || $previous_state == Build::STATUS_PENDING) {
|
||||
if ($previousState == Build::STATUS_SUCCESS || $previousState == Build::STATUS_PENDING) {
|
||||
$this->pluginExecutor->executePlugins($this->config, Build::STAGE_BROKEN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ class Config
|
|||
$keyParts = explode('.', $key);
|
||||
$selected = $this->config;
|
||||
|
||||
$i = -1;
|
||||
$last_part = count($keyParts) - 1;
|
||||
$i = -1;
|
||||
$lastPart = count($keyParts) - 1;
|
||||
while ($part = array_shift($keyParts)) {
|
||||
$i++;
|
||||
|
||||
|
@ -80,7 +80,7 @@ class Config
|
|||
return $default;
|
||||
}
|
||||
|
||||
if ($i === $last_part) {
|
||||
if ($i === $lastPart) {
|
||||
return $selected[$part];
|
||||
} else {
|
||||
$selected = $selected[$part];
|
||||
|
@ -177,25 +177,25 @@ class Config
|
|||
return;
|
||||
}
|
||||
|
||||
foreach ($target as $target_key => $target_value) {
|
||||
if (isset($source[$target_key])) {
|
||||
if (!is_array($source[$target_key]) && !is_array($target_value)) {
|
||||
foreach ($target as $targetKey => $targetValue) {
|
||||
if (isset($source[$targetKey])) {
|
||||
if (!is_array($source[$targetKey]) && !is_array($targetValue)) {
|
||||
// Neither value is an array, overwrite
|
||||
$source[$target_key] = $target_value;
|
||||
} elseif (is_array($source[$target_key]) && is_array($target_value)) {
|
||||
$source[$targetKey] = $targetValue;
|
||||
} elseif (is_array($source[$targetKey]) && is_array($targetValue)) {
|
||||
// Both are arrays, deep merge them
|
||||
self::deepMerge($source[$target_key], $target_value);
|
||||
} elseif (is_array($source[$target_key])) {
|
||||
self::deepMerge($source[$targetKey], $targetValue);
|
||||
} elseif (is_array($source[$targetKey])) {
|
||||
// Source is the array, push target value
|
||||
$source[$target_key][] = $target_value;
|
||||
$source[$targetKey][] = $targetValue;
|
||||
} else {
|
||||
// Target is the array, push source value and copy back
|
||||
$target_value[] = $source[$target_key];
|
||||
$source[$target_key] = $target_value;
|
||||
$targetValue[] = $source[$targetKey];
|
||||
$source[$targetKey] = $targetValue;
|
||||
}
|
||||
} else {
|
||||
// No merge required, just set the value
|
||||
$source[$target_key] = $target_value;
|
||||
$source[$targetKey] = $targetValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,10 +45,10 @@ class GroupController extends Controller
|
|||
'title' => $group->getTitle(),
|
||||
'id' => $group->getId(),
|
||||
];
|
||||
$projects_active = Factory::getStore('Project')->getByGroupId($group->getId(), false);
|
||||
$projects_archived = Factory::getStore('Project')->getByGroupId($group->getId(), true);
|
||||
$projectsActive = Factory::getStore('Project')->getByGroupId($group->getId(), false);
|
||||
$projectsArchived = Factory::getStore('Project')->getByGroupId($group->getId(), true);
|
||||
|
||||
$thisGroup['projects'] = array_merge($projects_active['items'], $projects_archived['items']);
|
||||
$thisGroup['projects'] = array_merge($projectsActive['items'], $projectsArchived['items']);
|
||||
$groups[] = $thisGroup;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,12 +192,12 @@ class Database extends \PDO
|
|||
|
||||
/**
|
||||
* @param string $statement
|
||||
* @param array $driver_options
|
||||
* @param array $driverOptions
|
||||
*
|
||||
* @return \PDOStatement
|
||||
*/
|
||||
public function prepareCommon($statement, array $driver_options = [])
|
||||
public function prepareCommon($statement, array $driverOptions = [])
|
||||
{
|
||||
return parent::prepare($this->quoteNames($statement), $driver_options);
|
||||
return parent::prepare($this->quoteNames($statement), $driverOptions);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -756,27 +756,27 @@ class Build extends Model
|
|||
*/
|
||||
protected function handleConfig(Builder $builder, $buildPath)
|
||||
{
|
||||
$build_config = $this->getProject()->getBuildConfig();
|
||||
$buildConfig = $this->getProject()->getBuildConfig();
|
||||
|
||||
if (empty($build_config)) {
|
||||
if (empty($buildConfig)) {
|
||||
if (file_exists($buildPath . '/.php-censor.yml')) {
|
||||
$build_config = file_get_contents($buildPath . '/.php-censor.yml');
|
||||
$buildConfig = file_get_contents($buildPath . '/.php-censor.yml');
|
||||
} elseif (file_exists($buildPath . '/.phpci.yml')) {
|
||||
$build_config = file_get_contents($buildPath . '/.phpci.yml');
|
||||
$buildConfig = file_get_contents($buildPath . '/.phpci.yml');
|
||||
} elseif (file_exists($buildPath . '/phpci.yml')) {
|
||||
$build_config = file_get_contents($buildPath . '/phpci.yml');
|
||||
$buildConfig = file_get_contents($buildPath . '/phpci.yml');
|
||||
} else {
|
||||
$build_config = $this->getZeroConfigPlugins($builder);
|
||||
$buildConfig = $this->getZeroConfigPlugins($builder);
|
||||
}
|
||||
}
|
||||
|
||||
// for YAML configs from files/DB
|
||||
if (is_string($build_config)) {
|
||||
if (is_string($buildConfig)) {
|
||||
$yamlParser = new YamlParser();
|
||||
$build_config = $yamlParser->parse($build_config);
|
||||
$buildConfig = $yamlParser->parse($buildConfig);
|
||||
}
|
||||
|
||||
$builder->setConfigArray($build_config);
|
||||
$builder->setConfigArray($buildConfig);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -989,11 +989,11 @@ class Build extends Model
|
|||
$end = new \DateTime();
|
||||
}
|
||||
|
||||
$diff = date_diff($start, $end);
|
||||
$diff = date_diff($start, $end);
|
||||
$parts = [];
|
||||
foreach (['y', 'm', 'd', 'h', 'i', 's'] as $time_part) {
|
||||
if ($diff->{$time_part} != 0) {
|
||||
$parts[] = $diff->{$time_part} . ($time_part == 'i' ? 'm' : $time_part);
|
||||
foreach (['y', 'm', 'd', 'h', 'i', 's'] as $timePart) {
|
||||
if ($diff->{$timePart} != 0) {
|
||||
$parts[] = $diff->{$timePart} . ($timePart == 'i' ? 'm' : $timePart);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -702,14 +702,14 @@ class Project extends Model
|
|||
*/
|
||||
public function getEnvironmentsNames()
|
||||
{
|
||||
$environments = $this->getEnvironmentsObjects();
|
||||
$environments_names = [];
|
||||
$environments = $this->getEnvironmentsObjects();
|
||||
$environmentsNames = [];
|
||||
foreach($environments['items'] as $environment) {
|
||||
/** @var Environment $environment */
|
||||
$environments_names[] = $environment->getName();
|
||||
$environmentsNames[] = $environment->getName();
|
||||
}
|
||||
|
||||
return $environments_names;
|
||||
return $environmentsNames;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -719,15 +719,15 @@ class Project extends Model
|
|||
*/
|
||||
public function getEnvironments()
|
||||
{
|
||||
$environments = $this->getEnvironmentsObjects();
|
||||
$environments_config = [];
|
||||
$environments = $this->getEnvironmentsObjects();
|
||||
$environmentsConfig = [];
|
||||
foreach($environments['items'] as $environment) {
|
||||
/** @var Environment $environment */
|
||||
$environments_config[$environment->getName()] = $environment->getBranches();
|
||||
$environmentsConfig[$environment->getName()] = $environment->getBranches();
|
||||
}
|
||||
|
||||
$yaml_dumper = new YamlDumper();
|
||||
$value = $yaml_dumper->dump($environments_config, 10, 0, true, false);
|
||||
$yamlDumper = new YamlDumper();
|
||||
$value = $yamlDumper->dump($environmentsConfig, 10, 0, true, false);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
@ -739,18 +739,18 @@ class Project extends Model
|
|||
*/
|
||||
public function setEnvironments($value)
|
||||
{
|
||||
$yaml_parser = new YamlParser();
|
||||
$environments_config = $yaml_parser->parse($value);
|
||||
$environments_names = !empty($environments_config) ? array_keys($environments_config) : [];
|
||||
$current_environments = $this->getEnvironmentsObjects();
|
||||
$store = $this->getEnvironmentStore();
|
||||
foreach ($current_environments['items'] as $environment) {
|
||||
$yamlParser = new YamlParser();
|
||||
$environmentsConfig = $yamlParser->parse($value);
|
||||
$environmentsNames = !empty($environmentsConfig) ? array_keys($environmentsConfig) : [];
|
||||
$currentEnvironments = $this->getEnvironmentsObjects();
|
||||
$store = $this->getEnvironmentStore();
|
||||
foreach ($currentEnvironments['items'] as $environment) {
|
||||
/** @var Environment $environment */
|
||||
$key = array_search($environment->getName(), $environments_names);
|
||||
$key = array_search($environment->getName(), $environmentsNames);
|
||||
if ($key !== false) {
|
||||
// already exist
|
||||
unset($environments_names[$key]);
|
||||
$environment->setBranches(!empty($environments_config[$environment->getName()]) ? $environments_config[$environment->getName()] : []);
|
||||
unset($environmentsNames[$key]);
|
||||
$environment->setBranches(!empty($environmentsConfig[$environment->getName()]) ? $environmentsConfig[$environment->getName()] : []);
|
||||
$store->save($environment);
|
||||
} else {
|
||||
// remove
|
||||
|
@ -758,13 +758,13 @@ class Project extends Model
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($environments_names)) {
|
||||
if (!empty($environmentsNames)) {
|
||||
// add
|
||||
foreach ($environments_names as $environment_name) {
|
||||
foreach ($environmentsNames as $environmentName) {
|
||||
$environment = new Environment();
|
||||
$environment->setProjectId($this->getId());
|
||||
$environment->setName($environment_name);
|
||||
$environment->setBranches(!empty($environments_config[$environment->getName()]) ? $environments_config[$environment->getName()] : []);
|
||||
$environment->setName($environmentName);
|
||||
$environment->setBranches(!empty($environmentsConfig[$environment->getName()]) ? $environmentsConfig[$environment->getName()] : []);
|
||||
$store->save($environment);
|
||||
}
|
||||
}
|
||||
|
@ -777,31 +777,31 @@ class Project extends Model
|
|||
*/
|
||||
public function getEnvironmentsNamesByBranch($branch)
|
||||
{
|
||||
$environments_names = [];
|
||||
$environments = $this->getEnvironmentsObjects();
|
||||
$default_branch = ($branch == $this->getBranch());
|
||||
$environmentsNames = [];
|
||||
$environments = $this->getEnvironmentsObjects();
|
||||
$defaultBranch = ($branch == $this->getBranch());
|
||||
foreach($environments['items'] as $environment) {
|
||||
/** @var Environment $environment */
|
||||
if ($default_branch || in_array($branch, $environment->getBranches())) {
|
||||
$environments_names[] = $environment->getName();
|
||||
if ($defaultBranch || in_array($branch, $environment->getBranches())) {
|
||||
$environmentsNames[] = $environment->getName();
|
||||
}
|
||||
}
|
||||
|
||||
return $environments_names;
|
||||
return $environmentsNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $environment_name
|
||||
* @param string $environmentName
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getBranchesByEnvironment($environment_name)
|
||||
public function getBranchesByEnvironment($environmentName)
|
||||
{
|
||||
$branches = [];
|
||||
$environments = $this->getEnvironmentsObjects();
|
||||
foreach($environments['items'] as $environment) {
|
||||
/** @var Environment $environment */
|
||||
if ($environment_name == $environment->getName()) {
|
||||
if ($environmentName == $environment->getName()) {
|
||||
return $environment->getBranches();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use PHPCensor\Plugin;
|
|||
|
||||
/**
|
||||
* Behat BDD Plugin
|
||||
*
|
||||
*
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
*/
|
||||
class Behat extends Plugin
|
||||
|
@ -50,7 +50,7 @@ class Behat extends Plugin
|
|||
*/
|
||||
public function execute()
|
||||
{
|
||||
$current_dir = getcwd();
|
||||
$currentDir = getcwd();
|
||||
chdir($this->builder->buildPath);
|
||||
|
||||
$behat = $this->executable;
|
||||
|
@ -62,7 +62,7 @@ class Behat extends Plugin
|
|||
}
|
||||
|
||||
$success = $this->builder->executeCommand($behat . ' %s', $this->features);
|
||||
chdir($current_dir);
|
||||
chdir($currentDir);
|
||||
|
||||
list($errorCount, $data) = $this->parseBehatOutput();
|
||||
|
||||
|
|
|
@ -130,26 +130,26 @@ class Mysql extends Plugin
|
|||
/**
|
||||
* Builds the MySQL import command required to import/execute the specified file
|
||||
*
|
||||
* @param string $import_file Path to file, relative to the build root
|
||||
* @param string $database If specified, this database is selected before execution
|
||||
* @param string $importFile Path to file, relative to the build root
|
||||
* @param string $database If specified, this database is selected before execution
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getImportCommand($import_file, $database = null)
|
||||
protected function getImportCommand($importFile, $database = null)
|
||||
{
|
||||
$decompression = [
|
||||
'bz2' => '| bzip2 --decompress',
|
||||
'gz' => '| gzip --decompress',
|
||||
];
|
||||
|
||||
$extension = strtolower(pathinfo($import_file, PATHINFO_EXTENSION));
|
||||
$extension = strtolower(pathinfo($importFile, PATHINFO_EXTENSION));
|
||||
$decompressionCmd = '';
|
||||
if (array_key_exists($extension, $decompression)) {
|
||||
$decompressionCmd = $decompression[$extension];
|
||||
}
|
||||
|
||||
$args = [
|
||||
':import_file' => escapeshellarg($import_file),
|
||||
':import_file' => escapeshellarg($importFile),
|
||||
':decomp_cmd' => $decompressionCmd,
|
||||
':host' => escapeshellarg($this->host),
|
||||
':user' => escapeshellarg($this->user),
|
||||
|
|
|
@ -97,8 +97,8 @@ class PhpSpec extends Plugin
|
|||
$error['message'] = (String)$attr['message'];
|
||||
}
|
||||
|
||||
foreach ($child->xpath('system-err') as $system_err) {
|
||||
$error['raw'] = (String)$system_err;
|
||||
foreach ($child->xpath('system-err') as $systemError) {
|
||||
$error['raw'] = (String)$systemError;
|
||||
}
|
||||
|
||||
$case['error'] = $error;
|
||||
|
|
|
@ -35,12 +35,12 @@ class PhpTalLint extends Plugin
|
|||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $allowed_warnings;
|
||||
protected $allowedWarnings;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $allowed_errors;
|
||||
protected $allowedErrors;
|
||||
|
||||
/**
|
||||
* @var array The results of the lint scan
|
||||
|
@ -58,8 +58,8 @@ class PhpTalLint extends Plugin
|
|||
$this->suffixes = ['zpt'];
|
||||
$this->ignore = $this->builder->ignore;
|
||||
|
||||
$this->allowed_warnings = 0;
|
||||
$this->allowed_errors = 0;
|
||||
$this->allowedWarnings = 0;
|
||||
$this->allowedErrors = 0;
|
||||
|
||||
if (!empty($options['directory'])) {
|
||||
$this->directories = [$options['directory']];
|
||||
|
@ -102,11 +102,11 @@ class PhpTalLint extends Plugin
|
|||
|
||||
$success = true;
|
||||
|
||||
if ($this->allowed_warnings != -1 && $warnings > $this->allowed_warnings) {
|
||||
if ($this->allowedWarnings != -1 && $warnings > $this->allowedWarnings) {
|
||||
$success = false;
|
||||
}
|
||||
|
||||
if ($this->allowed_errors != -1 && $errors > $this->allowed_errors) {
|
||||
if ($this->allowedErrors != -1 && $errors > $this->allowedErrors) {
|
||||
$success = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,39 +39,39 @@ class Codeception implements ParserInterface
|
|||
$this->results = new \SimpleXMLElement($this->resultsXml);
|
||||
|
||||
// calculate total results
|
||||
foreach ($this->results->testsuite as $test_suite) {
|
||||
$this->totalTests += (int)$test_suite['tests'];
|
||||
$this->totalTimeTaken += (float)$test_suite['time'];
|
||||
$this->totalFailures += (int)$test_suite['failures'];
|
||||
$this->totalErrors += (int)$test_suite['errors'];
|
||||
foreach ($this->results->testsuite as $testSuite) {
|
||||
$this->totalTests += (int)$testSuite['tests'];
|
||||
$this->totalTimeTaken += (float)$testSuite['time'];
|
||||
$this->totalFailures += (int)$testSuite['failures'];
|
||||
$this->totalErrors += (int)$testSuite['errors'];
|
||||
|
||||
foreach ($test_suite->testcase as $test_case) {
|
||||
$test_result = [
|
||||
'suite' => (string)$test_suite['name'],
|
||||
'file' => str_replace($this->builder->buildPath, '/', (string) $test_case['file']),
|
||||
'name' => (string)$test_case['name'],
|
||||
'feature' => (string)$test_case['feature'],
|
||||
'assertions' => (int)$test_case['assertions'],
|
||||
'time' => (float)$test_case['time']
|
||||
foreach ($testSuite->testcase as $testCase) {
|
||||
$testResult = [
|
||||
'suite' => (string)$testSuite['name'],
|
||||
'file' => str_replace($this->builder->buildPath, '/', (string) $testCase['file']),
|
||||
'name' => (string)$testCase['name'],
|
||||
'feature' => (string)$testCase['feature'],
|
||||
'assertions' => (int)$testCase['assertions'],
|
||||
'time' => (float)$testCase['time']
|
||||
];
|
||||
|
||||
if (isset($test_case['class'])) {
|
||||
$test_result['class'] = (string) $test_case['class'];
|
||||
if (isset($testCase['class'])) {
|
||||
$testResult['class'] = (string) $testCase['class'];
|
||||
}
|
||||
|
||||
// PHPUnit testcases does not have feature field. Use class::method instead
|
||||
if (!$test_result['feature']) {
|
||||
$test_result['feature'] = sprintf('%s::%s', $test_result['class'], $test_result['name']);
|
||||
if (!$testResult['feature']) {
|
||||
$testResult['feature'] = sprintf('%s::%s', $testResult['class'], $testResult['name']);
|
||||
}
|
||||
|
||||
if (isset($test_case->failure) || isset($test_case->error)) {
|
||||
$test_result['pass'] = false;
|
||||
$test_result['message'] = isset($test_case->failure) ? (string)$test_case->failure : (string)$test_case->error;
|
||||
if (isset($testCase->failure) || isset($testCase->error)) {
|
||||
$testResult['pass'] = false;
|
||||
$testResult['message'] = isset($testCase->failure) ? (string)$testCase->failure : (string)$testCase->error;
|
||||
} else {
|
||||
$test_result['pass'] = true;
|
||||
$testResult['pass'] = true;
|
||||
}
|
||||
|
||||
$rtn[] = $test_result;
|
||||
$rtn[] = $testResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,10 +140,10 @@ class XMPP extends Plugin
|
|||
/*
|
||||
* Try to build conf file
|
||||
*/
|
||||
$config_file = $this->builder->buildPath . '/.sendxmpprc';
|
||||
$configFile = $this->builder->buildPath . '/.sendxmpprc';
|
||||
if (is_null($this->findConfigFile())) {
|
||||
file_put_contents($config_file, $this->getConfigFormat());
|
||||
chmod($config_file, 0600);
|
||||
file_put_contents($configFile, $this->getConfigFormat());
|
||||
chmod($configFile, 0600);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -154,8 +154,8 @@ class XMPP extends Plugin
|
|||
$tls = ' -t';
|
||||
}
|
||||
|
||||
$message_file = $this->builder->buildPath . '/' . uniqid('xmppmessage');
|
||||
if ($this->buildMessage($message_file) === false) {
|
||||
$messageFile = $this->builder->buildPath . '/' . uniqid('xmppmessage');
|
||||
if ($this->buildMessage($messageFile) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -165,23 +165,23 @@ class XMPP extends Plugin
|
|||
$cmd = $sendxmpp . "%s -f %s -m %s %s";
|
||||
$recipients = implode(' ', $this->recipients);
|
||||
|
||||
$success = $this->builder->executeCommand($cmd, $tls, $config_file, $message_file, $recipients);
|
||||
$success = $this->builder->executeCommand($cmd, $tls, $configFile, $messageFile, $recipients);
|
||||
|
||||
print $this->builder->getLastOutput();
|
||||
|
||||
/*
|
||||
* Remove temp message file
|
||||
*/
|
||||
$this->builder->executeCommand("rm -rf ".$message_file);
|
||||
$this->builder->executeCommand("rm -rf ".$messageFile);
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $message_file
|
||||
* @param $messageFile
|
||||
* @return int
|
||||
*/
|
||||
protected function buildMessage($message_file)
|
||||
protected function buildMessage($messageFile)
|
||||
{
|
||||
if ($this->build->isSuccessful()) {
|
||||
$message = "✔ [".$this->build->getProjectTitle()."] Build #" . $this->build->getId()." successful";
|
||||
|
@ -191,6 +191,6 @@ class XMPP extends Plugin
|
|||
|
||||
$message .= ' ('.strftime($this->dateFormat).')';
|
||||
|
||||
return file_put_contents($message_file, $message);
|
||||
return file_put_contents($messageFile, $message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,19 +144,19 @@ abstract class Store
|
|||
$data = $obj->getDataArray();
|
||||
$modified = ($saveAllColumns) ? array_keys($data) : $obj->getModified();
|
||||
|
||||
$updates = [];
|
||||
$update_params = [];
|
||||
$updates = [];
|
||||
$updateParams = [];
|
||||
foreach ($modified as $key) {
|
||||
$updates[] = $key . ' = :' . $key;
|
||||
$update_params[] = [$key, $data[$key]];
|
||||
$updates[] = $key . ' = :' . $key;
|
||||
$updateParams[] = [$key, $data[$key]];
|
||||
}
|
||||
|
||||
if (count($updates)) {
|
||||
$qs = 'UPDATE {{' . $this->tableName . '}} SET ' . implode(', ', $updates) . ' WHERE {{' . $this->primaryKey . '}} = :primaryKey';
|
||||
$q = Database::getConnection('write')->prepareCommon($qs);
|
||||
|
||||
foreach ($update_params as $update_param) {
|
||||
$q->bindValue(':' . $update_param[0], $update_param[1]);
|
||||
foreach ($updateParams as $updateParam) {
|
||||
$q->bindValue(':' . $updateParam[0], $updateParam[1]);
|
||||
}
|
||||
|
||||
$q->bindValue(':primaryKey', $data[$this->primaryKey]);
|
||||
|
|
|
@ -239,12 +239,12 @@ class BuildStore extends Store
|
|||
/**
|
||||
* Return an array of the latest builds for all projects.
|
||||
*
|
||||
* @param integer $limit_by_project
|
||||
* @param integer $limit_all
|
||||
* @param integer $limitByProject
|
||||
* @param integer $limitAll
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAllProjectsLatestBuilds($limit_by_project = 5, $limit_all = 10)
|
||||
public function getAllProjectsLatestBuilds($limitByProject = 5, $limitAll = 10)
|
||||
{
|
||||
// don't fetch log field - contain many data
|
||||
$query = '
|
||||
|
@ -275,40 +275,40 @@ class BuildStore extends Store
|
|||
$projects = [];
|
||||
$latest = [];
|
||||
foreach ($res as $item) {
|
||||
$project_id = $item['project_id'];
|
||||
$projectId = $item['project_id'];
|
||||
$environment = $item['environment'];
|
||||
if (empty($projects[$project_id])) {
|
||||
$projects[$project_id] = [];
|
||||
if (empty($projects[$projectId])) {
|
||||
$projects[$projectId] = [];
|
||||
}
|
||||
if (empty($projects[$project_id][$environment])) {
|
||||
$projects[$project_id][$environment] = [
|
||||
if (empty($projects[$projectId][$environment])) {
|
||||
$projects[$projectId][$environment] = [
|
||||
'latest' => [],
|
||||
'success' => null,
|
||||
'failed' => null,
|
||||
];
|
||||
}
|
||||
$build = null;
|
||||
if (count($projects[$project_id][$environment]['latest']) < $limit_by_project) {
|
||||
if (count($projects[$projectId][$environment]['latest']) < $limitByProject) {
|
||||
$build = new Build($item);
|
||||
$projects[$project_id][$environment]['latest'][] = $build;
|
||||
$projects[$projectId][$environment]['latest'][] = $build;
|
||||
}
|
||||
if (count($latest) < $limit_all) {
|
||||
if (count($latest) < $limitAll) {
|
||||
if (is_null($build)) {
|
||||
$build = new Build($item);
|
||||
}
|
||||
$latest[] = $build;
|
||||
}
|
||||
if (empty($projects[$project_id][$environment]['success']) && Build::STATUS_SUCCESS === $item['status']) {
|
||||
if (empty($projects[$projectId][$environment]['success']) && Build::STATUS_SUCCESS === $item['status']) {
|
||||
if (is_null($build)) {
|
||||
$build = new Build($item);
|
||||
}
|
||||
$projects[$project_id][$environment]['success'] = $build;
|
||||
$projects[$projectId][$environment]['success'] = $build;
|
||||
}
|
||||
if (empty($projects[$project_id][$environment]['failed']) && Build::STATUS_FAILED === $item['status']) {
|
||||
if (empty($projects[$projectId][$environment]['failed']) && Build::STATUS_FAILED === $item['status']) {
|
||||
if (is_null($build)) {
|
||||
$build = new Build($item);
|
||||
}
|
||||
$projects[$project_id][$environment]['failed'] = $build;
|
||||
$projects[$projectId][$environment]['failed'] = $build;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue