Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added cron job admin page; eliminated cronjobs table
- Loading branch information
1 parent
9eca2a7
commit 8488fcc
Showing
7 changed files
with
122 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
namespace Controllers\Cron; | ||
|
||
use Controllers\BaseController; | ||
use Utils\Uri\Uri; | ||
|
||
class CronAdminController extends BaseController | ||
{ | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
public function isCallableFromRouter($actionName) | ||
{ | ||
// all public methods can be called by router | ||
return true; | ||
} | ||
|
||
public function index() | ||
{ | ||
if (!$this->isUserLogged() || !$this->loggedUser->hasSysAdminRole()) { | ||
$this->view->redirect('/'); | ||
exit(); | ||
} | ||
if (isset($_GET['action'])) { | ||
if ($_GET['action'] == 'run') { | ||
if (isset($_GET['job'])) { | ||
$this->runJob($_GET['job']); | ||
} | ||
} | ||
} | ||
$this->showCronAdmin(); | ||
} | ||
|
||
private function showCronAdmin() | ||
{ | ||
$cronJobs = new CronJobsController(); | ||
$this->view->setVar('jobs', $cronJobs->getScheduleStatus()); | ||
|
||
$currentUriExploded = explode('?', Uri::getCurrentUri()); | ||
$this->view->setVar('runJobUri', $currentUriExploded[0] . '?action=run&job='); | ||
|
||
$this->view->setTemplate('cron/cronAdmin'); | ||
$this->view->buildView(); | ||
} | ||
|
||
private function runJob($jobName) | ||
{ | ||
$cronJobs = new CronJobsController($jobName); | ||
$cronJobs->index(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
use Utils\Text\Formatter; | ||
?> | ||
<div class="content2-container"> | ||
<div class="content2-pagetitle"> | ||
<img src="tpl/stdstyle/images/blue/clock.png" class="icon32" alt=""> {{admin_cron_title}} | ||
</div> | ||
<table class="table table-striped full-width"> | ||
<tr> | ||
<th>{{admin_cron_lbl_job}}</th> | ||
<th>{{admin_cron_lbl_schedule}}</th> | ||
<th>{{admin_cron_lbl_lastrun}}</th> | ||
<th>{{action}}</th> | ||
</tr> | ||
<?php foreach ($view->jobs as $jobName => $jobData) { ?> | ||
<tr> | ||
<td><?= $jobData['shortName'] ?></td> | ||
<td><?= $jobData['schedule'] ?></td> | ||
<td> | ||
<?= substr($jobData['lastRun'], 0, 10) ?> | ||
<?= substr($jobData['lastRun'], 11, 8) ?> | ||
</td> | ||
<td> | ||
<a href="<?= $view->runJobUri . $jobName ?>">{{admin_cron_run_now}}</a> | ||
</td> | ||
</tr> | ||
<?php } ?> | ||
</table> | ||
</div> |