Skip to content

Commit

Permalink
combine changes from @spyngamerman into final package
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Oct 9, 2019
1 parent 1eae822 commit 8eae731
Show file tree
Hide file tree
Showing 45 changed files with 248 additions and 109 deletions.
6 changes: 3 additions & 3 deletions IncBackups/IncBackupsControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
pass
import threading as multi
from plogical.processUtilities import ProcessUtilities
from models import IncJob, JobSnapshots
from IncBackups.models import IncJob, JobSnapshots
from websiteFunctions.models import Websites
import plogical.randomPassword as randomPassword
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
Expand Down Expand Up @@ -316,7 +316,7 @@ def prettify(elem):
reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent=" ")

## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52/meta.xml -- metaPath
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018/meta.xml -- metaPath

metaPath = '/home/cyberpanel/%s' % (str(randint(1000, 9999)))

Expand Down Expand Up @@ -538,4 +538,4 @@ def createBackup(self):
except:
pass

logging.statusWriter(self.statusPath, 'Completed', 1)
logging.statusWriter(self.statusPath, 'Completed', 1)
2 changes: 1 addition & 1 deletion IncBackups/static/IncBackups/IncBackups.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,4 @@ app.controller('incrementalDestinations', function ($scope, $http) {
};


});
});
136 changes: 136 additions & 0 deletions IncBackups/templates/IncBackups/backupSchedule.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Schedule Back up - CyberPanel" %} {% endblock %}
{% block content %}

{% load static %}

{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->

<div class="container">
<div id="page-title">
<h2>{% trans "Schedule Back up" %} - <a target="_blank" href="http://go.cyberpanel.net/remote-backup"
style="height: 23px;line-height: 21px;"
class="btn btn-border btn-alt border-red btn-link font-red"
title=""><span>{% trans "Remote Backups" %}</span></a></h2>
<p>{% trans "On this page you can schedule Back ups to localhost or remote server (If you have added one)." %}</p>
</div>

<div ng-controller="scheduleBackup" class="panel">
<div class="panel-body">
<h3 class="title-hero">
{% trans "Schedule Back up" %} <img ng-hide="scheduleBackupLoading"
src="{% static 'images/loading.gif' %}">
</h3>
<div class="example-box-wrapper">


<form action="/" class="form-horizontal bordered-row">


<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Destination" %}</label>
<div class="col-sm-6">
<select ng-change="scheduleFreqView()" ng-model="backupDest" class="form-control">
{% for items in destinations %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>

<div ng-hide="scheduleFreq" class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Frequency" %}</label>
<div class="col-sm-6">
<select ng-change="scheduleBtnView()" ng-model="backupFreq" class="form-control">
<option>Daily</option>
<option>Weekly</option>
</select>
</div>
</div>

<div ng-hide="localPath" class="form-group">
<label class="col-sm-3 control-label">{% trans "Local Path" %}</label>
<div class="col-sm-6">
<input name="dom" type="text" class="form-control" ng-model="localPathValue"
placeholder="{% trans "Local directory where backups will be moved after creation." %}"
required>
</div>
</div>


<div ng-hide="scheduleBtn" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button type="button" ng-click="addSchedule()"
class="btn btn-primary btn-lg btn-block">{% trans "Add Destination" %}</button>

</div>
</div>


<!------ List of Destinations --------------->


<div class="form-group">

<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">

<div ng-hide="canNotAddSchedule" class="alert alert-danger">
<p>{% trans "Cannot add schedule. Error message:" %} {$ errorMessage $} </p>
</div>

<div ng-hide="scheduleAdded" class="alert alert-success">
<p>{% trans "Schedule Added" %}</p>
</div>

<div ng-hide="couldNotConnect" class="alert alert-danger">
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
</div>
</div>
</div>

<div class="form-group">

<div class="col-sm-12">

<table class="table">
<thead>
<tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Destination" %}</th>
<th>{% trans "Frequency" %}</th>
<th>{% trans "Delete" %}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="record in records track by $index">
<td ng-bind="record.id"></td>
<td ng-bind="record.destLoc"></td>
<td ng-bind="record.frequency"></td>
<td ng-click="delSchedule(record.destLoc,record.frequency)"><img
src="{% static 'images/delete.png' %}"></td>

</tr>
</tbody>
</table>
</div>
</div>

<!------ List of records --------------->


</form>


</div>
</div>
</div>


</div>


{% endblock %}
Empty file modified IncBackups/templates/IncBackups/createBackup.html
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions IncBackups/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
url(r'^deleteBackup$', views.deleteBackup, name='deleteBackupInc'),
url(r'^fetchRestorePoints$', views.fetchRestorePoints, name='fetchRestorePointsInc'),
url(r'^restorePoint$', views.restorePoint, name='restorePointInc'),
url(r'^scheduleBackups$', views.scheduleBackups, name='scheduleBackupsInc'),
]
27 changes: 26 additions & 1 deletion IncBackups/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,4 +540,29 @@ def restorePoint(request):
logging.writeToFile(str(msg))
final_dic = {'status': 0, 'metaStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
return HttpResponse(final_json)

def scheduleBackups(request):
try:
userID = request.session['userID']
currentACL = ACLManager.loadedACL(userID)

if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
return ACLManager.loadError()

websitesName = ACLManager.findAllSites(currentACL, userID)

destinations = []
destinations.append('local')

path = '/home/cyberpanel/sftp'

for items in os.listdir(path):
destinations.append('sftp:%s' % (items))

for items in os.listdir(path):
destinations.append('s3:s3.amazonaws.com/%s' % (items))

return defRenderer(request, 'IncBackups/scheduleBackups.html', {'websiteList': websitesName, 'destinations': destinations})
except BaseException, msg:
return HttpResponse(str(msg))
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Webhosting control panel that uses OpenLiteSpeed as web server.
* PHP 7.0
* PHP 7.1
* PHP 7.2
* PHP 7.3

# Installation Instructions

Expand Down
Empty file modified backup/backupManager.py
100644 → 100755
Empty file.
3 changes: 3 additions & 0 deletions baseTemplate/templates/baseTemplate/index.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,9 @@
<li class="restoreBackup"><a href="{% url 'backupDestinationsInc' %}"
title="{% trans 'Restore Back up' %}"><span>{% trans "Add Destinations" %}</span></a>
</li>
<li class="restoreBackup"><a href="{% url 'scheduleBackupsInc' %}"
title="{% trans 'Schedule Back ups' %}"><span>{% trans "Schedule Back ups" %}</span></a>
</li>
</ul>

</div><!-- .sidebar-submenu -->
Expand Down
Empty file modified cli/cliLogger.py
100644 → 100755
Empty file.
Empty file modified emailPremium/templates/emailPremium/emailPage.html
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion emailPremium/templates/emailPremium/listDomains.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ <h4 class="mb-10">{% trans "Email Policy Server is not enabled " %}



{% endblock %}
{% endblock %}
Empty file modified emailPremium/templates/emailPremium/policyServer.html
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion firewall/templates/firewall/index.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h3 class="content-box-header">
<i class="fa fa-lock"></i>
</div>
</a>
</div>
</div>



Expand Down
Loading

0 comments on commit 8eae731

Please sign in to comment.