mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-24 15:18:40 +00:00
More task fixes and implementation
This commit is contained in:
parent
482d6166cd
commit
70170f0691
|
|
@ -379,14 +379,14 @@ class Repository
|
|||
/**
|
||||
* Get active Branch.
|
||||
*
|
||||
* @return string
|
||||
* @return Branch
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getActiveBranch() : string
|
||||
public function getActiveBranch() : Branch
|
||||
{
|
||||
if (!isset($branch)) {
|
||||
if (!isset($this->branch)) {
|
||||
$branches = $this->getBranches();
|
||||
$active = preg_grep('/^\*/', $branches);
|
||||
reset($active);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Utils\TaskSchedule;
|
|||
* Array utils.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Utils
|
||||
* @package phpOMS\Utils\TaskSchedule
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -64,4 +64,9 @@ class Cron implements ScheduleInterface
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public function run(string $cmd)
|
||||
{
|
||||
// TODO: Implement run() method.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,39 +19,25 @@ namespace phpOMS\Utils\TaskSchedule;
|
|||
* Array utils.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Utils
|
||||
* @package phpOMS\Utils\TaskSchedule
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class CronJob implements TaskInterface
|
||||
class CronJob extends TaskAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* Interval.
|
||||
*
|
||||
* @var Interval
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $interval = null;
|
||||
private $command = '';
|
||||
|
||||
public function __construct(Interval $interval = null, $cmd = '')
|
||||
{
|
||||
$this->interval = $interval;
|
||||
$this->command = $cmd;
|
||||
}
|
||||
if (!isset($interval)) {
|
||||
$this->interval = new Interval();
|
||||
} else {
|
||||
$this->interval = $interval;
|
||||
}
|
||||
|
||||
public function setInterval(Interval $interval)
|
||||
{
|
||||
$this->interval = $interval;
|
||||
}
|
||||
|
||||
public function setCommand(string $command)
|
||||
{
|
||||
$this->command = $command;
|
||||
$this->command = $cmd;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
namespace phpOMS\Utils\TaskSchedule;
|
||||
|
||||
/**
|
||||
* Array utils.
|
||||
* Interval class for tasks.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Utils
|
||||
* @package phpOMS\Utils\TaskSchedule
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -29,8 +29,20 @@ namespace phpOMS\Utils\TaskSchedule;
|
|||
class Interval
|
||||
{
|
||||
|
||||
/**
|
||||
* Start.
|
||||
*
|
||||
* @var \DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $start = null;
|
||||
|
||||
/**
|
||||
* End.
|
||||
*
|
||||
* @var \DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $end = null;
|
||||
|
||||
/**
|
||||
|
|
@ -208,21 +220,57 @@ class Interval
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set start.
|
||||
*
|
||||
* @param \DateTime $start Start date
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setStart(\DateTime $start)
|
||||
{
|
||||
$this->start = $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get start.
|
||||
*
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getStart() : \DateTime
|
||||
{
|
||||
return $this->start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get end.
|
||||
*
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getEnd()
|
||||
{
|
||||
return $this->end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set end.
|
||||
*
|
||||
* @param \DateTime $end End date
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setEnd(\DateTime $end)
|
||||
{
|
||||
$this->end = $end;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace phpOMS\Utils\TaskSchedule;
|
|||
* Performing operations on the file system
|
||||
*
|
||||
* @category System
|
||||
* @package Framework
|
||||
* @package phpOMS\Utils\TaskSchedule
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
|
|||
|
|
@ -19,38 +19,26 @@ namespace phpOMS\Utils\TaskSchedule;
|
|||
* Array utils.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Utils
|
||||
* @package phpOMS\Utils\TaskSchedule
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Schedule implements TaskInterface
|
||||
class Schedule extends TaskAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* Interval.
|
||||
*
|
||||
* @var Interval
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $interval = null;
|
||||
private $command = '';
|
||||
private $name = '';
|
||||
|
||||
public function __construct(Interval $interval = null, $cmd = '')
|
||||
{
|
||||
if (!isset($interval)) {
|
||||
$this->interval = new Interval();
|
||||
} else {
|
||||
$this->interval = $interval;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function setInterval(Interval $interval)
|
||||
{
|
||||
$this->interval = $interval;
|
||||
}
|
||||
|
||||
public function setCommand(string $command)
|
||||
{
|
||||
$this->command = $command;
|
||||
$this->command = $cmd;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Utils\TaskSchedule;
|
|||
* Array utils.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Utils
|
||||
* @package phpOMS\Utils\TaskSchedule
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -39,4 +39,6 @@ interface ScheduleInterface
|
|||
public function set(TaskInterface $task);
|
||||
|
||||
public function save();
|
||||
|
||||
public function run(string $cmd);
|
||||
}
|
||||
|
|
|
|||
102
Utils/TaskSchedule/TaskAbstract.php
Normal file
102
Utils/TaskSchedule/TaskAbstract.php
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @copyright 2013 Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace phpOMS\Utils\TaskSchedule;
|
||||
|
||||
/**
|
||||
* Abstract task class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\Utils\TaskSchedule
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract class TaskAbstract
|
||||
{
|
||||
/**
|
||||
* Interval.
|
||||
*
|
||||
* @var Interval
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $interval = null;
|
||||
|
||||
/**
|
||||
* Command.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $command = '';
|
||||
|
||||
/**
|
||||
* Set interval.
|
||||
*
|
||||
* @param Interval $interval Interval
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setInterval(Interval $interval)
|
||||
{
|
||||
$this->interval = $interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get interval.
|
||||
*
|
||||
* @return Interval
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getInterval() : Interval
|
||||
{
|
||||
return $this->interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set command.
|
||||
*
|
||||
* @param string $command Command
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setCommand(string $command)
|
||||
{
|
||||
$this->command = $command;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get command.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getCommand() : string
|
||||
{
|
||||
return $this->command;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @copyright 2013 Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace phpOMS\Utils\TaskSchedule;
|
||||
|
||||
/**
|
||||
* Array utils.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Utils
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
interface TaskInterface
|
||||
{
|
||||
public function setInterval(Interval $interval);
|
||||
|
||||
public function setCommand(string $command);
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ namespace phpOMS\Utils\TaskSchedule;
|
|||
* Array utils.
|
||||
*
|
||||
* @category Framework
|
||||
* @package Utils
|
||||
* @package phpOMS\Utils\TaskSchedule
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
|
|
@ -62,4 +62,9 @@ class TaskScheduler implements ScheduleInterface
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public function run(string $cmd)
|
||||
{
|
||||
// TODO: Implement run() method.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user