Docblocks
This commit is contained in:
parent
a008358056
commit
e61ce203a3
|
@ -28,11 +28,17 @@ class GroupController extends Controller
|
||||||
*/
|
*/
|
||||||
protected $groupStore;
|
protected $groupStore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up this controller.
|
||||||
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->groupStore = b8\Store\Factory::getStore('ProjectGroup');
|
$this->groupStore = b8\Store\Factory::getStore('ProjectGroup');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List project groups.
|
||||||
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->requireAdmin();
|
$this->requireAdmin();
|
||||||
|
@ -53,6 +59,11 @@ class GroupController extends Controller
|
||||||
$this->view->groups = $groups;
|
$this->view->groups = $groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or edit a project group.
|
||||||
|
* @param null $groupId
|
||||||
|
* @return void|b8\Http\Response\RedirectResponse
|
||||||
|
*/
|
||||||
public function edit($groupId = null)
|
public function edit($groupId = null)
|
||||||
{
|
{
|
||||||
$this->requireAdmin();
|
$this->requireAdmin();
|
||||||
|
@ -91,6 +102,11 @@ class GroupController extends Controller
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a project group.
|
||||||
|
* @param $groupId
|
||||||
|
* @return b8\Http\Response\RedirectResponse
|
||||||
|
*/
|
||||||
public function delete($groupId)
|
public function delete($groupId)
|
||||||
{
|
{
|
||||||
$this->requireAdmin();
|
$this->requireAdmin();
|
||||||
|
|
|
@ -144,6 +144,10 @@ class HomeController extends \PHPCI\Controller
|
||||||
return $view->render();
|
return $view->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a summary of the project groups we have, and what projects they have in them.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getGroupInfo()
|
protected function getGroupInfo()
|
||||||
{
|
{
|
||||||
$rtn = array();
|
$rtn = array();
|
||||||
|
|
|
@ -20,11 +20,18 @@ class BuildMetaStoreBase extends Store
|
||||||
protected $modelName = '\PHPCI\Model\BuildMeta';
|
protected $modelName = '\PHPCI\Model\BuildMeta';
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a BuildMeta by primary key (Id)
|
||||||
|
*/
|
||||||
public function getByPrimaryKey($value, $useConnection = 'read')
|
public function getByPrimaryKey($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
return $this->getById($value, $useConnection);
|
return $this->getById($value, $useConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a single BuildMeta by Id.
|
||||||
|
* @return null|BuildMeta
|
||||||
|
*/
|
||||||
public function getById($value, $useConnection = 'read')
|
public function getById($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
@ -44,6 +51,10 @@ class BuildMetaStoreBase extends Store
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get multiple BuildMeta by ProjectId.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getByProjectId($value, $limit = 1000, $useConnection = 'read')
|
public function getByProjectId($value, $limit = 1000, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
@ -72,6 +83,10 @@ class BuildMetaStoreBase extends Store
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get multiple BuildMeta by BuildId.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getByBuildId($value, $limit = 1000, $useConnection = 'read')
|
public function getByBuildId($value, $limit = 1000, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
|
|
@ -20,11 +20,18 @@ class BuildStoreBase extends Store
|
||||||
protected $modelName = '\PHPCI\Model\Build';
|
protected $modelName = '\PHPCI\Model\Build';
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Build by primary key (Id)
|
||||||
|
*/
|
||||||
public function getByPrimaryKey($value, $useConnection = 'read')
|
public function getByPrimaryKey($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
return $this->getById($value, $useConnection);
|
return $this->getById($value, $useConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a single Build by Id.
|
||||||
|
* @return null|Build
|
||||||
|
*/
|
||||||
public function getById($value, $useConnection = 'read')
|
public function getById($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
@ -44,6 +51,10 @@ class BuildStoreBase extends Store
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get multiple Build by ProjectId.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getByProjectId($value, $limit = 1000, $useConnection = 'read')
|
public function getByProjectId($value, $limit = 1000, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
@ -72,6 +83,10 @@ class BuildStoreBase extends Store
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get multiple Build by Status.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getByStatus($value, $limit = 1000, $useConnection = 'read')
|
public function getByStatus($value, $limit = 1000, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
|
|
@ -20,11 +20,18 @@ class ProjectGroupStoreBase extends Store
|
||||||
protected $modelName = '\PHPCI\Model\ProjectGroup';
|
protected $modelName = '\PHPCI\Model\ProjectGroup';
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a ProjectGroup by primary key (Id)
|
||||||
|
*/
|
||||||
public function getByPrimaryKey($value, $useConnection = 'read')
|
public function getByPrimaryKey($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
return $this->getById($value, $useConnection);
|
return $this->getById($value, $useConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a single ProjectGroup by Id.
|
||||||
|
* @return null|ProjectGroup
|
||||||
|
*/
|
||||||
public function getById($value, $useConnection = 'read')
|
public function getById($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
|
|
@ -20,11 +20,18 @@ class ProjectStoreBase extends Store
|
||||||
protected $modelName = '\PHPCI\Model\Project';
|
protected $modelName = '\PHPCI\Model\Project';
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Project by primary key (Id)
|
||||||
|
*/
|
||||||
public function getByPrimaryKey($value, $useConnection = 'read')
|
public function getByPrimaryKey($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
return $this->getById($value, $useConnection);
|
return $this->getById($value, $useConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a single Project by Id.
|
||||||
|
* @return null|Project
|
||||||
|
*/
|
||||||
public function getById($value, $useConnection = 'read')
|
public function getById($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
@ -44,6 +51,10 @@ class ProjectStoreBase extends Store
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get multiple Project by Title.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getByTitle($value, $limit = 1000, $useConnection = 'read')
|
public function getByTitle($value, $limit = 1000, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
@ -72,6 +83,10 @@ class ProjectStoreBase extends Store
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get multiple Project by GroupId.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getByGroupId($value, $limit = 1000, $useConnection = 'read')
|
public function getByGroupId($value, $limit = 1000, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
|
|
@ -20,11 +20,18 @@ class UserStoreBase extends Store
|
||||||
protected $modelName = '\PHPCI\Model\User';
|
protected $modelName = '\PHPCI\Model\User';
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a User by primary key (Id)
|
||||||
|
*/
|
||||||
public function getByPrimaryKey($value, $useConnection = 'read')
|
public function getByPrimaryKey($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
return $this->getById($value, $useConnection);
|
return $this->getById($value, $useConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a single User by Id.
|
||||||
|
* @return null|User
|
||||||
|
*/
|
||||||
public function getById($value, $useConnection = 'read')
|
public function getById($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
@ -44,6 +51,10 @@ class UserStoreBase extends Store
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a single User by Email.
|
||||||
|
* @return null|User
|
||||||
|
*/
|
||||||
public function getByEmail($value, $useConnection = 'read')
|
public function getByEmail($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
@ -63,6 +74,10 @@ class UserStoreBase extends Store
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a single User by Name.
|
||||||
|
* @return null|User
|
||||||
|
*/
|
||||||
public function getByName($value, $useConnection = 'read')
|
public function getByName($value, $useConnection = 'read')
|
||||||
{
|
{
|
||||||
if (is_null($value)) {
|
if (is_null($value)) {
|
||||||
|
|
|
@ -171,6 +171,10 @@ class BuildWorker
|
||||||
$this->run = false;
|
$this->run = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if this worker has done the amount of jobs it is allowed to do, and if so tells it to stop
|
||||||
|
* after this job completes.
|
||||||
|
*/
|
||||||
protected function checkJobLimit()
|
protected function checkJobLimit()
|
||||||
{
|
{
|
||||||
// Make sure we don't run more than maxJobs jobs on this worker:
|
// Make sure we don't run more than maxJobs jobs on this worker:
|
||||||
|
@ -181,11 +185,17 @@ class BuildWorker
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks that the job received is actually from PHPCI, and has a valid type.
|
||||||
|
* @param Job $job
|
||||||
|
* @param $jobData
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
protected function verifyJob(Job $job, $jobData)
|
protected function verifyJob(Job $job, $jobData)
|
||||||
{
|
{
|
||||||
if (empty($jobData) || !is_array($jobData)) {
|
if (empty($jobData) || !is_array($jobData)) {
|
||||||
// Probably not from PHPCI.
|
// Probably not from PHPCI.
|
||||||
$this->pheanstalk->release($job);
|
$this->pheanstalk->delete($job);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue