-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17476dd
commit cc5ce62
Showing
7 changed files
with
100 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
# impeng_backupdash | ||
Perch Runway dashboard widget that shows status of latest backups | ||
# Perch Runway Backup Status Dashboard Widget | ||
|
||
|
||
Perch Runway dashboard widget that shows status of latest backups. Not applicable to non-Runway Perch sites. | ||
|
||
![Screenshot](images/impeng_backupdash-screenshot1.png) | ||
|
||
Application name: impeng_backupdash | ||
|
||
## Installation | ||
|
||
copy the impeng_backupdash folder into the folder perch/addons/apps/ | ||
No other actions are needed. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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,6 @@ | ||
<?php | ||
if ($CurrentUser->logged_in()) { | ||
$this->register_app('impeng_backupdash', 'Backups Widget', 1, 'Dashboard Widget to show staus of recent Runway Backups', '1', true); | ||
$this->require_version('impeng_backupdash', '0.1'); | ||
} | ||
?> |
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,74 @@ | ||
<?php | ||
$API = new PerchAPI(1.0, 'impeng_backupdash'); | ||
$HTML = $API->get('HTML'); | ||
$Lang = $API->get('Lang'); | ||
$DB = PerchDB::fetch(); | ||
|
||
// Change the number of backup results that are displayed | ||
$numRunsDisplayed = 5; | ||
?> | ||
<div class="widget"> | ||
<div class="dash-content"> | ||
<header> | ||
<h2> | ||
<?php echo $Lang->get('Backup Status'); ?> | ||
</h2> | ||
</header> | ||
<div class="body"> | ||
<?php | ||
$sql = 'SELECT * FROM '.PERCH_DB_PREFIX.'backup_plans'; | ||
$result = $DB->get_count($sql); | ||
if (($result) == 0) { | ||
echo $Lang->get('No backup plans exist'); | ||
return; | ||
} | ||
?> | ||
<ul class="dash-list"> | ||
<?php | ||
$sql = 'SELECT * FROM '.PERCH_DB_PREFIX.'backup_runs'; | ||
$result = $DB->get_count($sql); | ||
if ( $result == 0) { | ||
echo $Lang->get('No backup runs'); | ||
} else { | ||
$sql = 'SELECT * | ||
FROM '.PERCH_DB_PREFIX.'backup_runs | ||
ORDER BY runDateTime DESC | ||
LIMIT '.$numRunsDisplayed ; | ||
$result = $DB->get_rows($sql); | ||
foreach ($result as $run) { | ||
$sql = 'SELECT planTitle | ||
FROM '.PERCH_DB_PREFIX.'backup_plans | ||
WHERE planID='.$run['planID'].' | ||
LIMIT 1 '; | ||
$planName = $DB->get_rows($sql)[0]['planTitle']; | ||
echo "<li>"; | ||
switch($run['runResult']) { | ||
case 'OK': | ||
echo PerchUI::icon('core/circle-check', 16, null, 'icon-status-success'); | ||
break; | ||
|
||
case 'FAILED': | ||
echo PerchUI::icon('core/circle-delete', 16, null, 'icon-status-alert'); | ||
break; | ||
|
||
case 'WARNING': | ||
echo PerchUI::icon('core/alert', 16, null, 'icon-status-warning'); | ||
break; | ||
|
||
default: | ||
echo PerchUI::icon('core/info-alt', 16, null, 'icon-status-info'); | ||
break; | ||
} | ||
$link = $HTML->encode(PERCH_LOGINPATH.'/core/settings/backup/?id='.($run['planID'])); | ||
echo '<a href="'.$link.'">'.$planName.'</a>'; | ||
echo '<span class="note">'.strftime(PERCH_DATE_SHORT .' @ '.PERCH_TIME_SHORT, strtotime($run['runDateTime'])).'</span>'; | ||
echo "</li>"; | ||
} | ||
} | ||
?> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
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,7 @@ | ||
{ | ||
"lang": "en-gb", | ||
"Backups Widget": "Backups Widget", | ||
"Backup Status": "Backup Status", | ||
"No backup runs": "No backup runs", | ||
"No backup plans exist": "No backup plans exist" | ||
} |