diff --git a/auto_database_backup/README.rst b/auto_database_backup/README.rst index 2aaa6b9bb..5d7b1626f 100644 --- a/auto_database_backup/README.rst +++ b/auto_database_backup/README.rst @@ -1,30 +1,35 @@ -Automatic Database Backup To Local Server, Remote Server, Google Drive And Dropbox -================================================================================== +.. image:: https://img.shields.io/badge/licence-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Automatic Database Backup To Local Server, Remote Server, Google Drive, Dropbox, Nextcloud and Amazon S3 +======================================================================================================== * Generate Database Backups and store to multiple locations -Installation +Configuration ============ - - www.odoo.com/documentation/15.0/setup/install.html - - Install our custom addon + - www.odoo.com/documentation/15.0/setup/install.html + - Install our custom addon -License +Company ------- -General Public License, Version 3 (LGPL v3). -(https://www.odoo.com/documentation/user/15.0/legal/licenses/licenses.html) +* `Cybrosys Techno Solutions `__ -Company +License ------- -* 'Cybrosys Techno Solutions `__ +General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) Credits ------- * Developer: -(v15) Midilaj @ Cybrosys - +(v15) Midilaj, Contact: odoo@cybrosys.com +(V15 Amazon S3,NextCloud-Features) Anfas Faisal K , Contact: odoo@cybrosys.com Contacts -------- * Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com Bug Tracker ----------- @@ -32,6 +37,9 @@ Bugs are tracked on GitHub Issues. In case of trouble, please check there if you Maintainer ========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + This module is maintained by Cybrosys Technologies. For support and more information, please visit https://www.cybrosys.com @@ -39,4 +47,3 @@ For support and more information, please visit https://www.cybrosys.com Further information =================== HTML Description: ``__ - diff --git a/auto_database_backup/__init__.py b/auto_database_backup/__init__.py index 117da7d8f..c39f34965 100644 --- a/auto_database_backup/__init__.py +++ b/auto_database_backup/__init__.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -17,7 +17,8 @@ # You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE # (LGPL v3) along with this program. # If not, see . - +# +############################################################################### +from . import controllers from . import models from . import wizard -from . import controllers diff --git a/auto_database_backup/__manifest__.py b/auto_database_backup/__manifest__.py index 200d4dd66..de2d133ff 100644 --- a/auto_database_backup/__manifest__.py +++ b/auto_database_backup/__manifest__.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -18,29 +18,39 @@ # (LGPL v3) along with this program. # If not, see . # -############################################################################# - +############################################################################### { - 'name': "Automatic Database Backup To Local Server, Remote Server, Google Drive And Dropbox", - 'version': '15.0.3.1.2', - 'summary': """Generate automatic backup of databases and store to local, google drive, dropbox, onedrive or remote server""", - 'description': """This module has been developed for creating database backups automatically - and store it to the different locations.""", + 'name': "Automatic Database Backup To Local Server, Remote Server, Google " + "Drive, Dropbox, Onedrive, Nextcloud and Amazon S3", + 'version': '15.0.4.1.2', + 'category': 'Discuss,Extra Tools', + 'summary': """Generate automatic backup of databases and store to local, + google drive, dropbox, nextcloud, amazon S3, onedrive or + remote server""", + 'description': """This module helps to generate backups of your databases + automatically on regular interval of times. The generated backups can be + stored into local storage, ftp server, sftp server, dropbox, Google Drive, + Onedrive Nextcloud and Amazon S3. User can enable auto remove option to + automatically delete old backups. User can enable email notification to + be notified about the success and failure of the backup generation and + storage.""", 'author': "Cybrosys Techno Solutions", - 'website': "https://www.cybrosys.com", 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', - 'category': 'Tools', + 'website': "https://www.cybrosys.com", 'depends': ['base', 'mail'], 'data': [ 'security/ir.model.access.csv', - 'data/data.xml', + 'data/ir_cron_data.xml', + 'data/mail_data.xml', 'views/db_backup_configure_views.xml', - 'wizard/dropbox_authcode_wizard_views.xml', + 'wizard/dropbox_auth_code_views.xml', ], - 'external_dependencies': {'python': ['dropbox']}, - 'license': 'LGPL-3', + 'external_dependencies': { + 'python': ['dropbox', 'pyncclient', 'boto3', 'nextcloud-api-wrapper','paramiko'], + }, 'images': ['static/description/banner.gif'], + 'license': 'LGPL-3', 'installable': True, 'auto_install': False, 'application': False, diff --git a/auto_database_backup/controllers/__init__.py b/auto_database_backup/controllers/__init__.py index 8c5dc606f..fe47e9971 100644 --- a/auto_database_backup/controllers/__init__.py +++ b/auto_database_backup/controllers/__init__.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -17,5 +17,6 @@ # You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE # (LGPL v3) along with this program. # If not, see . - -from . import main +# +############################################################################### +from . import auto_database_backup diff --git a/auto_database_backup/controllers/main.py b/auto_database_backup/controllers/auto_database_backup.py similarity index 61% rename from auto_database_backup/controllers/main.py rename to auto_database_backup/controllers/auto_database_backup.py index f0c42adcf..fbb5232ab 100644 --- a/auto_database_backup/controllers/main.py +++ b/auto_database_backup/controllers/auto_database_backup.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -17,27 +17,37 @@ # You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE # (LGPL v3) along with this program. # If not, see . - +# +############################################################################### import json - from odoo import http from odoo.http import request class OnedriveAuth(http.Controller): - + """Controller for handling OneDrive and google authentication + Methods: + oauth2callback: Callback route for OneDrive authentication + gdrive_oauth2callback: Callback route for Google Drive authentication + """ @http.route('/onedrive/authentication', type='http', auth="public") def oauth2callback(self, **kw): + """Callback route for OneDrive authentication""" state = json.loads(kw['state']) - backup_config = request.env['db.backup.configure'].sudo().browse(state.get('backup_config_id')) + backup_config = request.env['db.backup.configure'].sudo().browse( + state.get('backup_config_id')) backup_config.get_onedrive_tokens(kw.get('code')) - url_return = state.get('url_return') - return request.redirect(url_return) + backup_config.hide_active = True + backup_config.active = True + return request.redirect(state.get('url_return')) @http.route('/google_drive/authentication', type='http', auth="public") def gdrive_oauth2callback(self, **kw): + """Callback route for Google Drive authentication""" state = json.loads(kw['state']) - backup_config = request.env['db.backup.configure'].sudo().browse(state.get('backup_config_id')) + backup_config = request.env['db.backup.configure'].sudo().browse( + state.get('backup_config_id')) backup_config.get_gdrive_tokens(kw.get('code')) - url_return = state.get('url_return') - return request.redirect(url_return) + backup_config.hide_active = True + backup_config.active = True + return request.redirect(state.get('url_return')) diff --git a/auto_database_backup/data/ir_cron_data.xml b/auto_database_backup/data/ir_cron_data.xml new file mode 100644 index 000000000..30efef2b9 --- /dev/null +++ b/auto_database_backup/data/ir_cron_data.xml @@ -0,0 +1,16 @@ + + + + + + Backup : Automatic Database Backup + + code + model._schedule_auto_backup() + 1 + days + -1 + True + + + diff --git a/auto_database_backup/data/data.xml b/auto_database_backup/data/mail_data.xml similarity index 82% rename from auto_database_backup/data/data.xml rename to auto_database_backup/data/mail_data.xml index 08fc27c75..3f3118b1b 100644 --- a/auto_database_backup/data/data.xml +++ b/auto_database_backup/data/mail_data.xml @@ -1,23 +1,6 @@ - - - - - Backup : Automatic Database Backup - - code - model._schedule_auto_backup() - 1 - days - -1 - True - - - - - Database Backup: Notification Successful @@ -54,7 +37,12 @@ Onedrive - . + + Amazon S3 + + + NextCloud +

Database Name: @@ -79,6 +67,12 @@ Onedrive + + Amazon S3 + + + NextCloud +
Backup Path: @@ -94,6 +88,12 @@ + + + + + +
Backup Type: @@ -106,7 +106,6 @@
- Database Backup: Notification Failed @@ -148,6 +147,12 @@ Onedrive + + Amazon S3 + + + NextCloud +
Backup Path: @@ -163,6 +168,12 @@ + + + + + +
Backup Type: @@ -177,5 +188,4 @@
-
diff --git a/auto_database_backup/doc/RELEASE_NOTES.md b/auto_database_backup/doc/RELEASE_NOTES.md index 99038b5eb..6fe8d5c56 100644 --- a/auto_database_backup/doc/RELEASE_NOTES.md +++ b/auto_database_backup/doc/RELEASE_NOTES.md @@ -20,3 +20,7 @@ #### ADD - Google Drive authentication updated. +#### 16.10.2023 +#### Version 15.0.4.1.2 +#### ADD +- Nextcloud and Amazon S3 integration added. Backup can be stored into Nextcloud and Amazon S3. diff --git a/auto_database_backup/models/__init__.py b/auto_database_backup/models/__init__.py index f71ffa785..bcc836212 100644 --- a/auto_database_backup/models/__init__.py +++ b/auto_database_backup/models/__init__.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -17,5 +17,6 @@ # You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE # (LGPL v3) along with this program. # If not, see . - +# +############################################################################### from . import db_backup_configure diff --git a/auto_database_backup/models/db_backup_configure.py b/auto_database_backup/models/db_backup_configure.py index f4196f42a..2029b4fc8 100644 --- a/auto_database_backup/models/db_backup_configure.py +++ b/auto_database_backup/models/db_backup_configure.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################# +############################################################################### # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Copyright (C) 2023-TODAY Cybrosys Technologies() # Author: Cybrosys Techno Solutions() # # You can modify it under the terms of the GNU LESSER @@ -18,130 +18,374 @@ # (LGPL v3) along with this program. # If not, see . # -############################################################################# - -from odoo import models, fields, api, _ -from odoo.exceptions import UserError, ValidationError -import odoo -from odoo.service import db -from odoo.http import request - +############################################################################### +import boto3 import dropbox - -from werkzeug import urls -from datetime import timedelta - -import datetime -import os -import paramiko +import errno import ftplib import json +import logging +import nextcloud_client +import os +import paramiko import requests import tempfile -import errno -import logging +import odoo +from datetime import timedelta +from nextcloud import NextCloud +from requests.auth import HTTPBasicAuth +from werkzeug import urls +from odoo import _, api, fields, models +from odoo.exceptions import UserError, ValidationError +from odoo.http import request +from odoo.service import db _logger = logging.getLogger(__name__) - ONEDRIVE_SCOPE = ['offline_access openid Files.ReadWrite.All'] MICROSOFT_GRAPH_END_POINT = "https://graph.microsoft.com" GOOGLE_AUTH_ENDPOINT = 'https://accounts.google.com/o/oauth2/auth' GOOGLE_TOKEN_ENDPOINT = 'https://accounts.google.com/o/oauth2/token' GOOGLE_API_BASE_URL = 'https://www.googleapis.com' +headers = {"content-type": "application/x-www-form-urlencoded"} -class AutoDatabaseBackup(models.Model): +class DbBackupConfigure(models.Model): + """Model for configuring automatic database backup settings. + Methods: + action_nextcloud: Perform a Nextcloud connection test and display a + notification based on the result. + action_s3cloud:Perform an Amazon connection test and display a + notification based on the result. + _compute_redirect_uri: Compute the redirect URIs based on the backup + destination. + _compute_is_google_drive_token_generated: Set True if the Google Drive + refresh token is generated. + generate_gdrive_refresh_token: Generate Google Drive access token from + refresh token if expired. + get_gdrive_tokens: Generate onedrive tokens from authorization code. + _compute_is_onedrive_token_generated: Set true if onedrive tokens are + generated. + _compute_is_dropbox_token_generated: Set True if the dropbox refresh + token is generated. + action_get_dropbox_auth_code : Open a wizard to set up dropbox + Authorization code. + action_get_onedrive_auth_code: Generate onedrive authorization code + generate_onedrive_refresh_token: Generate onedrive access token from + refresh token if expired. + get_onedrive_tokens: Generate onedrive tokens from authorization code + get_dropbox_auth_url: Return dropbox authorization url. + set_dropbox_refresh_token: Generate and set the dropbox refresh token + from authorization code. + _check_db_credentials: Validate entered database name and master + password. + action_sftp_connection: Test the sftp and ftp connection using entered + credentials. + _schedule_auto_backup: Function for generating and storing backup + Database backup for all the active records in backup configuration + model will be created + """ _name = 'db.backup.configure' _description = 'Automatic Database Backup' - name = fields.Char(string='Name', required=True) - db_name = fields.Char(string='Database Name', required=True) - master_pwd = fields.Char(string='Master Password', required=True) + name = fields.Char(string='Name', required=True, help='Name of the Record') + db_name = fields.Char(string='Database Name', required=True, + help='Name of the current database') + master_pwd = fields.Char(string='Master Password', required=True, + help='Master password of the database') backup_format = fields.Selection([ ('zip', 'Zip'), ('dump', 'Dump') - ], string='Backup Format', default='zip', required=True) + ], string='Backup Format', default='zip', required=True, + help='The format in which the backup should be created') backup_destination = fields.Selection([ ('local', 'Local Storage'), ('google_drive', 'Google Drive'), ('ftp', 'FTP'), ('sftp', 'SFTP'), ('dropbox', 'Dropbox'), - ('onedrive', 'Onedrive') - ], string='Backup Destination') - backup_path = fields.Char(string='Backup Path', help='Local storage directory path') - sftp_host = fields.Char(string='SFTP Host') - sftp_port = fields.Char(string='SFTP Port', default=22) - sftp_user = fields.Char(string='SFTP User', copy=False) - sftp_password = fields.Char(string='SFTP Password', copy=False) - sftp_path = fields.Char(string='SFTP Path') - ftp_host = fields.Char(string='FTP Host') - ftp_port = fields.Char(string='FTP Port', default=21) - ftp_user = fields.Char(string='FTP User', copy=False) - ftp_password = fields.Char(string='FTP Password', copy=False) - ftp_path = fields.Char(string='FTP Path') - dropbox_client_id = fields.Char(string='Dropbox Client ID', copy=False) - dropbox_client_secret = fields.Char(string='Dropbox Client Secret', copy=False) - dropbox_refresh_token = fields.Char(string='Dropbox Refresh Token', copy=False) - is_dropbox_token_generated = fields.Boolean(string='Dropbox Token Generated', compute='_compute_is_dropbox_token_generated', copy=False) - dropbox_folder = fields.Char('Dropbox Folder') - active = fields.Boolean(default=True) - auto_remove = fields.Boolean(string='Remove Old Backups') + ('onedrive', 'Onedrive'), + ('next_cloud', 'Next Cloud'), + ('amazon_s3', 'Amazon S3') + ], string='Backup Destination', + help='The destination where the backup should be stored') + backup_path = fields.Char(string='Backup Path', + help='Local storage directory path') + sftp_host = fields.Char(string='SFTP Host', + help='The host of the SFTP server') + sftp_port = fields.Char(string='SFTP Port', default=22, + help='The port number for the SFTP connection') + sftp_user = fields.Char(string='SFTP User', copy=False, + help='The username for the SFTP connection') + sftp_password = fields.Char(string='SFTP Password', copy=False, + help='The password for the SFTP connection') + sftp_path = fields.Char(string='SFTP Path', + help='The path to the destination directory on ' + 'the SFTP server') + ftp_host = fields.Char(string='FTP Host', + help='The hostname or IP address of the FTP server') + ftp_port = fields.Char(string='FTP Port', default=21, + help='The port number used for FTP connections') + ftp_user = fields.Char(string='FTP User', copy=False, + help='The username used for FTP authentication') + ftp_password = fields.Char(string='FTP Password', copy=False, + help='The password used for FTP authentication') + ftp_path = fields.Char(string='FTP Path', + help='The path to the directory on the FTP server ' + 'where the backup should be stored') + dropbox_client_key = fields.Char(string='Dropbox Client ID', copy=False, + help='The client ID for accessing Dropbox ' + 'API') + dropbox_client_secret = fields.Char(string='Dropbox Client Secret', + copy=False, + help='The client secret for accessing ' + 'Dropbox API') + dropbox_refresh_token = fields.Char(string='Dropbox Refresh Token', + copy=False, + help='The refresh token for accessing ' + 'Dropbox API') + is_dropbox_token_generated = fields.Boolean( + string='Dropbox Token Generated', + compute='_compute_is_dropbox_token_generated', copy=False, + help='A boolean indicating whether the Dropbox token has been ' + 'generated or not') + dropbox_folder = fields.Char(string='Dropbox Folder', + help='The name of the Dropbox folder where ' + 'backups should be stored') + active = fields.Boolean(string='Active', + help='Set this field to True to activate the backup' + 'configuration.') + hide_active = fields.Boolean(string="Hide Active", + help="Make active field to readonly") + auto_remove = fields.Boolean(string='Remove Old Backups', + help='Set this field to True to automatically ' + 'remove old backups.') days_to_remove = fields.Integer(string='Remove After', - help='Automatically delete stored backups after this specified number of days') - google_drive_folderid = fields.Char(string='Drive Folder ID') + help='Automatically delete stored backups ' + 'after this specified number of days') + google_drive_folder_key = fields.Char(string='Drive Folder ID', + help='Folder ID inside Google Drive') notify_user = fields.Boolean(string='Notify User', - help='Send an email notification to user when the backup operation is successful or failed') - user_id = fields.Many2one('res.users', string='User') - backup_filename = fields.Char(string='Backup Filename', help='For Storing generated backup filename') - generated_exception = fields.Char(string='Exception', help='Exception Encountered while Backup generation') - onedrive_client_id = fields.Char(string='Onedrive Client ID', copy=False) - onedrive_client_secret = fields.Char(string='Onedrive Client Secret', copy=False) - onedrive_access_token = fields.Char(string='Onedrive Access Token', copy=False) - onedrive_refresh_token = fields.Char(string='Onedrive Refresh Token', copy=False) - onedrive_token_validity = fields.Datetime(string='Onedrive Token Validity', copy=False) - onedrive_folder_id = fields.Char(string='Folder ID') - is_onedrive_token_generated = fields.Boolean(string='onedrive Tokens Generated', - compute='_compute_is_onedrive_token_generated', copy=False) - gdrive_refresh_token = fields.Char(string='Google drive Refresh Token', copy=False) - gdrive_access_token = fields.Char(string='Google Drive Access Token', copy=False) - is_google_drive_token_generated = fields.Boolean(string='Google drive Token Generated', - compute='_compute_is_google_drive_token_generated', copy=False) - gdrive_client_id = fields.Char(string='Google Drive Client ID', copy=False) - gdrive_client_secret = fields.Char(string='Google Drive Client Secret', copy=False) - gdrive_token_validity = fields.Datetime(string='Google Drive Token Validity', copy=False) - gdrive_redirect_uri = fields.Char(string='Google Drive Redirect URI', compute='_compute_redirect_uri') - onedrive_redirect_uri = fields.Char(string='Onedrive Redirect URI', compute='_compute_redirect_uri') + help='Send an email notification to user ' + 'when the backup operation is ' + 'successful or failed') + user_id = fields.Many2one('res.users', string='User', + help='Select the user to send email') + backup_filename = fields.Char(string='Backup Filename', + help='For Storing generated backup filename') + generated_exception = fields.Char(string='Exception', + help='Exception Encountered while ' + 'Backup generation') + onedrive_client_key = fields.Char(string='Onedrive Client ID', copy=False, + help='The client ID of your Onedrive ' + 'application.') + onedrive_client_secret = fields.Char(string='Onedrive Client Secret', + copy=False, + help='The client secret of your ' + 'Onedrive application.') + onedrive_access_token = fields.Char(string='Onedrive Access Token', + copy=False, + help='The access token required to ' + 'authenticate with Onedrive API.' + ) + onedrive_refresh_token = fields.Char(string='Onedrive Refresh Token', + copy=False, + help='The refresh token required to ' + 'obtain a new access token from ' + 'Onedrive API.') + onedrive_token_validity = fields.Datetime(string='Onedrive Token Validity', + copy=False, + help='The date and time when ' + 'the Onedrive access token ' + 'expires.') + onedrive_folder_key = fields.Char(string='Folder ID', + help='The unique identifier of the ' + 'Onedrive folder where the backup ' + 'file will be stored.') + is_onedrive_token_generated = fields.Boolean( + string='onedrive Tokens Generated', + compute='_compute_is_onedrive_token_generated', copy=False, + help='Indicates whether the Onedrive tokens have been generated.') + gdrive_refresh_token = fields.Char(string='Google drive Refresh Token', + copy=False, + help='The refresh token for the Google ' + 'Drive account') + gdrive_access_token = fields.Char(string='Google Drive Access Token', + copy=False, + help='The access token for the Google ' + 'Drive account') + is_google_drive_token_generated = fields.Boolean( + string='Google drive Token Generated', + compute='_compute_is_google_drive_token_generated', copy=False, + help='A flag to indicate whether a token has been generated for the ' + 'Google Drive account') + gdrive_client_key = fields.Char(string='Google Drive Client ID', copy=False, + help='The client ID for the Google Drive API' + ) + gdrive_client_secret = fields.Char(string='Google Drive Client Secret', + copy=False, + help='The client secret for the Google ' + 'Drive API') + gdrive_token_validity = fields.Datetime( + string='Google Drive Token Validity', copy=False, + help='Specify the validity period of the Google Drive access token.') + gdrive_redirect_uri = fields.Char(string='Google Drive Redirect URI', + compute='_compute_redirect_uri', + help='The redirect URI used for the ' + 'Google Drive API authentication ' + 'flow') + onedrive_redirect_uri = fields.Char(string='Onedrive Redirect URI', + compute='_compute_redirect_uri', + help='The redirect URI used for the ' + 'Onedrive API authentication flow') + aws_access_key = fields.Char(string="Amazon S3 Access Key", + help="Field used to store the Access Key " + "for an Amazon S3 bucket.") + aws_secret_access_key = fields.Char(string='Amazon S3 Secret Key', + help="Field used to store the Secret " + "Key for an Amazon S3 bucket.") + bucket_file_name = fields.Char(string='Bucket Name', + help="Field used to store the name of an " + "Amazon S3 bucket.") + aws_folder_name = fields.Char(string='File Name', + help="field used to store the name of a " + "folder in an Amazon S3 bucket.") + domain = fields.Char(string='Domain Name', help="Field used to store the " + "name of a domain") + next_cloud_user_name = fields.Char(string='User Name', + help="Field used to store the user " + "name for a Nextcloud account.") + next_cloud_password = fields.Char(string='Password', + help="Field used to store the password " + "for a Nextcloud account.") + nextcloud_folder_key = fields.Char(string='Next Cloud Folder Id', + help="Field used to store the unique " + "identifier for a Nextcloud folder.") + + def action_nextcloud(self): + """If it has next_cloud_password, domain, and next_cloud_user_name + which will perform an action for nextcloud connection test""" + if self.domain and self.next_cloud_password and \ + self.next_cloud_user_name: + try: + ncx = NextCloud(self.domain, + auth=HTTPBasicAuth(self.next_cloud_user_name, + self.next_cloud_password)) + + data = ncx.list_folders('/').__dict__ + if data['raw'].status_code == 207: + self.active = True + self.hide_active = True + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'success', + 'title': _("Connection Test Succeeded!"), + 'message': _("Everything seems properly set up!"), + 'sticky': False, + } + } + else: + self.active = False + self.hide_active = False + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'danger', + 'title': _("Connection Test Failed!"), + 'message': _("An error occurred while testing the " + "connection."), + 'sticky': False, + } + } + except Exception: + self.active = False + self.hide_active = False + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'danger', + 'title': _("Connection Test Failed!"), + 'message': _("An error occurred while testing the " + "connection."), + 'sticky': False, + } + } + + def action_s3cloud(self): + """If it has aws_secret_access_key, which will perform s3 cloud + operations for connection test""" + if self.aws_access_key and self.aws_secret_access_key: + try: + bo3 = boto3.client( + 's3', + aws_access_key_id=self.aws_access_key, + aws_secret_access_key=self.aws_secret_access_key) + response = bo3.list_buckets() + for bucket in response['Buckets']: + if self.bucket_file_name == bucket['Name']: + self.active = True + self.hide_active = True + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'success', + 'title': _("Connection Test Succeeded!"), + 'message': _( + "Everything seems properly set up!"), + 'sticky': False, + } + } + raise UserError( + _("Bucket not found. Please check the bucket name and" + " try again.")) + except Exception: + self.active = False + self.hide_active = False + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'type': 'danger', + 'title': _("Connection Test Failed!"), + 'message': _("An error occurred while testing the " + "connection."), + 'sticky': False, + } + } - @api.depends('backup_destination') def _compute_redirect_uri(self): + """Compute the redirect URIs based on the backup destination""" for rec in self: - base_url = request.env['ir.config_parameter'].get_param('web.base.url') + base_url = request.env['ir.config_parameter'].get_param( + 'web.base.url') rec.onedrive_redirect_uri = base_url + '/onedrive/authentication' rec.gdrive_redirect_uri = base_url + '/google_drive/authentication' @api.depends('gdrive_access_token', 'gdrive_refresh_token') def _compute_is_google_drive_token_generated(self): - """ - Set True if the Google Drive refresh token is generated - """ + """Set True if the Google Drive refresh token is generated""" for rec in self: - rec.is_google_drive_token_generated = bool(rec.gdrive_access_token) and bool(rec.gdrive_refresh_token) + rec.is_google_drive_token_generated = bool( + rec.gdrive_access_token) and bool(rec.gdrive_refresh_token) def action_get_gdrive_auth_code(self): - """ - Generate ogoogle drive authorization code - """ - action = self.env["ir.actions.act_window"].sudo()._for_xml_id("auto_database_backup.action_db_backup_configure") + """Generate Google drive authorization code""" + action = self.env["ir.actions.act_window"].sudo()._for_xml_id( + "auto_database_backup.db_backup_configure_action") base_url = request.env['ir.config_parameter'].get_param('web.base.url') - url_return = base_url + '/web#id=%d&action=%d&view_type=form&model=%s' % (self.id, action['id'], 'db.backup.configure') + url_return = base_url + '/web#id=%d&action=%d&view_type=form&model=%s' % ( + self.id, action['id'], 'db.backup.configure') state = { 'backup_config_id': self.id, 'url_return': url_return } encoded_params = urls.url_encode({ 'response_type': 'code', - 'client_id': self.gdrive_client_id, + 'client_id': self.gdrive_client_key, 'scope': 'https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive.file', 'redirect_uri': base_url + '/google_drive/authentication', 'access_type': 'offline', @@ -156,45 +400,42 @@ class AutoDatabaseBackup(models.Model): } def generate_gdrive_refresh_token(self): - """ - generate google drive access token from refresh token if expired - """ - headers = {"content-type": "application/x-www-form-urlencoded"} + """Generate Google Drive access token from refresh token if expired""" data = { 'refresh_token': self.gdrive_refresh_token, - 'client_id': self.gdrive_client_id, + 'client_id': self.gdrive_client_key, 'client_secret': self.gdrive_client_secret, 'grant_type': 'refresh_token', } try: - res = requests.post(GOOGLE_TOKEN_ENDPOINT, data=data, headers=headers) + res = requests.post(GOOGLE_TOKEN_ENDPOINT, data=data, + headers=headers) res.raise_for_status() response = res.content and res.json() or {} if response: expires_in = response.get('expires_in') self.write({ 'gdrive_access_token': response.get('access_token'), - 'gdrive_token_validity': fields.Datetime.now() + timedelta(seconds=expires_in) if expires_in else False, + 'gdrive_token_validity': fields.Datetime.now() + timedelta( + seconds=expires_in) if expires_in else False, }) except requests.HTTPError as error: error_key = error.response.json().get("error", "nc") error_msg = _( - "An error occurred while generating the token. Your authorization code may be invalid or has already expired [%s]. " - "You should check your Client ID and secret on the Google APIs plateform or try to stop and restart your calendar synchronisation.", + "An error occurred while generating the token. Your " + "authorization code may be invalid or has already expired [%s]." + "You should check your Client ID and secret on the Google " + "APIs plateform or try to stop and restart your calendar " + "synchronisation.", error_key) raise UserError(error_msg) def get_gdrive_tokens(self, authorize_code): - """ - Generate onedrive tokens from authorization code - """ - + """Generate onedrive tokens from authorization code""" base_url = request.env['ir.config_parameter'].get_param('web.base.url') - - headers = {"content-type": "application/x-www-form-urlencoded"} data = { 'code': authorize_code, - 'client_id': self.gdrive_client_id, + 'client_id': self.gdrive_client_key, 'client_secret': self.gdrive_client_secret, 'grant_type': 'authorization_code', 'redirect_uri': base_url + '/google_drive/authentication' @@ -213,59 +454,57 @@ class AutoDatabaseBackup(models.Model): seconds=expires_in) if expires_in else False, }) except requests.HTTPError: - error_msg = _("Something went wrong during your token generation. Maybe your Authorization Code is invalid") + error_msg = _( + "Something went wrong during your token generation. Maybe " + "your Authorization Code is invalid") raise UserError(error_msg) @api.depends('onedrive_access_token', 'onedrive_refresh_token') def _compute_is_onedrive_token_generated(self): - """ - Set true if onedrive tokens are generated - """ + """Set true if onedrive tokens are generated""" for rec in self: - rec.is_onedrive_token_generated = bool(rec.onedrive_access_token) and bool(rec.onedrive_refresh_token) + rec.is_onedrive_token_generated = bool( + rec.onedrive_access_token) and bool(rec.onedrive_refresh_token) @api.depends('dropbox_refresh_token') def _compute_is_dropbox_token_generated(self): - """ - Set True if the dropbox refresh token is generated - """ + """Set True if the dropbox refresh token is generated""" for rec in self: rec.is_dropbox_token_generated = bool(rec.dropbox_refresh_token) def action_get_dropbox_auth_code(self): - """ - Open a wizard to set up dropbox Authorization code - """ + """Open a wizard to set up dropbox Authorization code""" return { 'type': 'ir.actions.act_window', 'name': 'Dropbox Authorization Wizard', - 'res_model': 'dropbox.auth.wizard', + 'res_model': 'dropbox.auth.code', 'view_mode': 'form', 'target': 'new', } def action_get_onedrive_auth_code(self): - """ - Generate onedrive authorization code - """ - AUTHORITY = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize' - action = self.env["ir.actions.act_window"].sudo()._for_xml_id("auto_database_backup.action_db_backup_configure") + """Generate onedrive authorization code""" + authority = \ + 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize' + action = self.env["ir.actions.act_window"].sudo()._for_xml_id( + "auto_database_backup.db_backup_configure_action") base_url = request.env['ir.config_parameter'].get_param('web.base.url') - url_return = base_url + '/web#id=%d&action=%d&view_type=form&model=%s' % (self.id, action['id'], 'db.backup.configure') + url_return = base_url + '/web#id=%d&action=%d&view_type=form&model=%s' % ( + self.id, action['id'], 'db.backup.configure') state = { 'backup_config_id': self.id, 'url_return': url_return } encoded_params = urls.url_encode({ 'response_type': 'code', - 'client_id': self.onedrive_client_id, + 'client_id': self.onedrive_client_key, 'state': json.dumps(state), 'scope': ONEDRIVE_SCOPE, 'redirect_uri': base_url + '/onedrive/authentication', 'prompt': 'consent', 'access_type': 'offline' }) - auth_url = "%s?%s" % (AUTHORITY, encoded_params) + auth_url = "%s?%s" % (authority, encoded_params) return { 'type': 'ir.actions.act_url', 'target': 'self', @@ -273,13 +512,10 @@ class AutoDatabaseBackup(models.Model): } def generate_onedrive_refresh_token(self): - """ - generate onedrive access token from refresh token if expired - """ + """Generate onedrive access token from refresh token if expired""" base_url = request.env['ir.config_parameter'].get_param('web.base.url') - headers = {"Content-type": "application/x-www-form-urlencoded"} data = { - 'client_id': self.onedrive_client_id, + 'client_id': self.onedrive_client_key, 'client_secret': self.onedrive_client_secret, 'scope': ONEDRIVE_SCOPE, 'grant_type': "refresh_token", @@ -287,7 +523,9 @@ class AutoDatabaseBackup(models.Model): 'refresh_token': self.onedrive_refresh_token } try: - res = requests.post("https://login.microsoftonline.com/common/oauth2/v2.0/token", data=data, headers=headers) + res = requests.post( + "https://login.microsoftonline.com/common/oauth2/v2.0/token", + data=data, headers=headers) res.raise_for_status() response = res.content and res.json() or {} if response: @@ -295,28 +533,29 @@ class AutoDatabaseBackup(models.Model): self.write({ 'onedrive_access_token': response.get('access_token'), 'onedrive_refresh_token': response.get('refresh_token'), - 'onedrive_token_validity': fields.Datetime.now() + timedelta(seconds=expires_in) if expires_in else False, + 'onedrive_token_validity': fields.Datetime.now() + timedelta( + seconds=expires_in) if expires_in else False, }) except requests.HTTPError as error: - _logger.exception("Bad microsoft onedrive request : %s !", error.response.content) + _logger.exception("Bad microsoft onedrive request : %s !", + error.response.content) raise error def get_onedrive_tokens(self, authorize_code): - """ - Generate onedrive tokens from authorization code - """ - headers = {"content-type": "application/x-www-form-urlencoded"} + """Generate onedrive tokens from authorization code""" base_url = request.env['ir.config_parameter'].get_param('web.base.url') data = { 'code': authorize_code, - 'client_id': self.onedrive_client_id, + 'client_id': self.onedrive_client_key, 'client_secret': self.onedrive_client_secret, 'grant_type': 'authorization_code', 'scope': ONEDRIVE_SCOPE, 'redirect_uri': base_url + '/onedrive/authentication' } try: - res = requests.post("https://login.microsoftonline.com/common/oauth2/v2.0/token", data=data, headers=headers) + res = requests.post( + "https://login.microsoftonline.com/common/oauth2/v2.0/token", + data=data, headers=headers) res.raise_for_status() response = res.content and res.json() or {} if response: @@ -324,35 +563,32 @@ class AutoDatabaseBackup(models.Model): self.write({ 'onedrive_access_token': response.get('access_token'), 'onedrive_refresh_token': response.get('refresh_token'), - 'onedrive_token_validity': fields.Datetime.now() + timedelta(seconds=expires_in) if expires_in else False, + 'onedrive_token_validity': fields.Datetime.now() + timedelta + (seconds=expires_in) if expires_in else False, }) except requests.HTTPError as error: - _logger.exception("Bad microsoft onedrive request : %s !", error.response.content) + _logger.exception("Bad microsoft onedrive request : %s !", + error.response.content) raise error def get_dropbox_auth_url(self): - """ - Return dropbox authorization url - """ - dbx_auth = dropbox.oauth.DropboxOAuth2FlowNoRedirect(self.dropbox_client_id, self.dropbox_client_secret, - token_access_type='offline') - auth_url = dbx_auth.start() - return auth_url + """Return dropbox authorization url""" + dbx_auth = dropbox.oauth.DropboxOAuth2FlowNoRedirect( + self.dropbox_client_key, self.dropbox_client_secret, + token_access_type='offline') + return dbx_auth.start() def set_dropbox_refresh_token(self, auth_code): - """ - Generate and set the dropbox refresh token from authorization code - """ - dbx_auth = dropbox.oauth.DropboxOAuth2FlowNoRedirect(self.dropbox_client_id, self.dropbox_client_secret, - token_access_type='offline') + """Generate and set the dropbox refresh token from authorization code""" + dbx_auth = dropbox.oauth.DropboxOAuth2FlowNoRedirect( + self.dropbox_client_key, self.dropbox_client_secret, + token_access_type='offline') outh_result = dbx_auth.finish(auth_code) self.dropbox_refresh_token = outh_result.refresh_token @api.constrains('db_name') def _check_db_credentials(self): - """ - Validate entered database name and master password - """ + """Validate entered database name and master password""" database_list = db.list_dbs() if self.db_name not in database_list: raise ValidationError(_("Invalid Database Name!")) @@ -361,15 +597,16 @@ class AutoDatabaseBackup(models.Model): except Exception: raise ValidationError(_("Invalid Master Password!")) - def test_connection(self): - """ - Test the sftp and ftp connection using entered credentials - """ + def action_sftp_connection(self): + """Test the sftp and ftp connection using entered credentials""" if self.backup_destination == 'sftp': client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) try: - client.connect(hostname=self.sftp_host, username=self.sftp_user, password=self.sftp_password, port=self.sftp_port) + client.connect(hostname=self.sftp_host, + username=self.sftp_user, + password=self.sftp_password, + port=self.sftp_port) sftp = client.open_sftp() sftp.close() except Exception as e: @@ -384,29 +621,42 @@ class AutoDatabaseBackup(models.Model): ftp_server.quit() except Exception as e: raise UserError(_("FTP Exception: %s", e)) - title = _("Connection Test Succeeded!") - message = _("Everything seems properly set up!") + self.hide_active = True + self.active = True return { 'type': 'ir.actions.client', 'tag': 'display_notification', 'params': { - 'title': title, - 'message': message, + 'title': _("Connection Test Succeeded!"), + 'message': _("Everything seems properly set up!"), 'sticky': False, } } - def _schedule_auto_backup(self): - """ - Function for generating and storing backup - Database backup for all the active records in backup configuration model will be created + @api.onchange('backup_destination') + def _onchange_back_up_local(self): """ + On change handler for the 'backup_destination' field. This method is + triggered when the value of 'backup_destination' is changed. If the + chosen backup destination is 'local', it sets the 'hide_active' field + to True which make active field to readonly to False. + """ + if self.backup_destination == 'local': + self.hide_active = True + + def _schedule_auto_backup(self): + """Function for generating and storing backup Database backup for all + the active records in backup configuration model will be created""" records = self.search([]) - mail_template_success = self.env.ref('auto_database_backup.mail_template_data_db_backup_successful') - mail_template_failed = self.env.ref('auto_database_backup.mail_template_data_db_backup_failed') + mail_template_success = self.env.ref( + 'auto_database_backup.mail_template_data_db_backup_successful') + mail_template_failed = self.env.ref( + 'auto_database_backup.mail_template_data_db_backup_failed') for rec in records: - backup_time = datetime.datetime.utcnow().strftime("%Y-%m-%d_%H-%M-%S") - backup_filename = "%s_%s.%s" % (rec.db_name, backup_time, rec.backup_format) + backup_time = fields.datetime.utcnow().strftime( + "%Y-%m-%d_%H-%M-%S") + backup_filename = "%s_%s.%s" % ( + rec.db_name, backup_time, rec.backup_format) rec.backup_filename = backup_filename # Local backup if rec.backup_destination == 'local': @@ -414,15 +664,17 @@ class AutoDatabaseBackup(models.Model): if not os.path.isdir(rec.backup_path): os.makedirs(rec.backup_path) backup_file = os.path.join(rec.backup_path, backup_filename) - f = open(backup_file, "wb") - odoo.service.db.dump_db(rec.db_name, f, rec.backup_format) - f.close() + fds = open(backup_file, "wb") + odoo.service.db.dump_db(rec.db_name, fds, rec.backup_format) + fds.close() # remove older backups if rec.auto_remove: for filename in os.listdir(rec.backup_path): file = os.path.join(rec.backup_path, filename) - create_time = datetime.datetime.fromtimestamp(os.path.getctime(file)) - backup_duration = datetime.datetime.utcnow() - create_time + create_time = fields.datetime.fromtimestamp( + os.path.getctime(file)) + backup_duration = \ + fields.datetime.utcnow() - create_time if backup_duration.days >= rec.days_to_remove: os.remove(file) if rec.notify_user: @@ -439,22 +691,28 @@ class AutoDatabaseBackup(models.Model): ftp_server.connect(rec.ftp_host, int(rec.ftp_port)) ftp_server.login(rec.ftp_user, rec.ftp_password) ftp_server.encoding = "utf-8" - temp = tempfile.NamedTemporaryFile(suffix='.%s' % rec.backup_format) + temp = tempfile.NamedTemporaryFile( + suffix='.%s' % rec.backup_format) try: ftp_server.cwd(rec.ftp_path) except ftplib.error_perm: ftp_server.mkd(rec.ftp_path) ftp_server.cwd(rec.ftp_path) with open(temp.name, "wb+") as tmp: - odoo.service.db.dump_db(rec.db_name, tmp, rec.backup_format) - ftp_server.storbinary('STOR %s' % backup_filename, open(temp.name, "rb")) + odoo.service.db.dump_db(rec.db_name, tmp, + rec.backup_format) + ftp_server.storbinary('STOR %s' % backup_filename, + open(temp.name, "rb")) if rec.auto_remove: files = ftp_server.nlst() - for f in files: - create_time = datetime.datetime.strptime(ftp_server.sendcmd('MDTM ' + f)[4:], "%Y%m%d%H%M%S") - diff_days = (datetime.datetime.now() - create_time).days + for file in files: + create_time = fields.datetime.strptime( + ftp_server.sendcmd('MDTM ' + file)[4:], + "%Y%m%d%H%M%S") + diff_days = ( + fields.datetime.now() - create_time).days if diff_days >= rec.days_to_remove: - ftp_server.delete(f) + ftp_server.delete(file) ftp_server.quit() if rec.notify_user: mail_template_success.send_mail(rec.id, force_send=True) @@ -468,11 +726,16 @@ class AutoDatabaseBackup(models.Model): client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) try: - client.connect(hostname=rec.sftp_host, username=rec.sftp_user, password=rec.sftp_password, port=rec.sftp_port) + client.connect(hostname=rec.sftp_host, + username=rec.sftp_user, + password=rec.sftp_password, + port=rec.sftp_port) sftp = client.open_sftp() - temp = tempfile.NamedTemporaryFile(suffix='.%s' % rec.backup_format) + temp = tempfile.NamedTemporaryFile( + suffix='.%s' % rec.backup_format) with open(temp.name, "wb+") as tmp: - odoo.service.db.dump_db(rec.db_name, tmp, rec.backup_format) + odoo.service.db.dump_db(rec.db_name, tmp, + rec.backup_format) try: sftp.chdir(rec.sftp_path) except IOError as e: @@ -482,7 +745,11 @@ class AutoDatabaseBackup(models.Model): sftp.put(temp.name, backup_filename) if rec.auto_remove: files = sftp.listdir() - expired = list(filter(lambda fl: (datetime.datetime.now() - datetime.datetime.fromtimestamp(sftp.stat(fl).st_mtime)).days >= rec.days_to_remove, files)) + expired = list(filter( + lambda fl: (fields.datetime.now() - + fields.datetime.fromtimestamp( + sftp.stat(fl).st_mtime)).days >= + rec.days_to_remove, files)) for file in expired: sftp.unlink(file) sftp.close() @@ -497,20 +764,23 @@ class AutoDatabaseBackup(models.Model): client.close() # Google Drive backup elif rec.backup_destination == 'google_drive': - if rec.gdrive_token_validity is not False and rec.gdrive_token_validity <= fields.Datetime.now(): + if (rec.gdrive_token_validity is not False and + rec.gdrive_token_validity <= fields.Datetime.now()): rec.generate_gdrive_refresh_token() - temp = tempfile.NamedTemporaryFile(suffix='.%s' % rec.backup_format) + temp = tempfile.NamedTemporaryFile( + suffix='.%s' % rec.backup_format) with open(temp.name, "wb+") as tmp: odoo.service.db.dump_db(rec.db_name, tmp, rec.backup_format) try: - # access_token = self.env['google.drive.config'].sudo().get_access_token() - headers = {"Authorization": "Bearer %s" % rec.gdrive_access_token} + headers = { + "Authorization": "Bearer %s" % rec.gdrive_access_token} para = { "name": backup_filename, - "parents": [rec.google_drive_folderid], + "parents": [rec.google_drive_folder_key], } files = { - 'data': ('metadata', json.dumps(para), 'application/json; charset=UTF-8'), + 'data': ('metadata', json.dumps(para), + 'application/json; charset=UTF-8'), 'file': open(temp.name, "rb") } requests.post( @@ -519,15 +789,25 @@ class AutoDatabaseBackup(models.Model): files=files ) if rec.auto_remove: - query = "parents = '%s'" % rec.google_drive_folderid - files_req = requests.get("https://www.googleapis.com/drive/v3/files?q=%s" % query, headers=headers) + query = "parents = '%s'" % rec.google_drive_folder_key + files_req = requests.get( + "https://www.googleapis.com/drive/v3/files?q=%s" % query, + headers=headers) files = files_req.json()['files'] for file in files: - file_date_req = requests.get("https://www.googleapis.com/drive/v3/files/%s?fields=createdTime" % file['id'], headers=headers) - create_time = file_date_req.json()['createdTime'][:19].replace('T', ' ') - diff_days = (datetime.datetime.now() - datetime.datetime.strptime(create_time, '%Y-%m-%d %H:%M:%S')).days + file_date_req = requests.get( + "https://www.googleapis.com/drive/v3/files/%s?fields=createdTime" % + file['id'], headers=headers) + create_time = file_date_req.json()['createdTime'][ + :19].replace('T', ' ') + diff_days = ( + fields.datetime.now() + - fields.datetime.strptime( + create_time, '%Y-%m-%d %H:%M:%S')).days if diff_days >= rec.days_to_remove: - requests.delete("https://www.googleapis.com/drive/v3/files/%s" % file['id'], headers=headers) + requests.delete( + "https://www.googleapis.com/drive/v3/files/%s" % + file['id'], headers=headers) if rec.notify_user: mail_template_success.send_mail(rec.id, force_send=True) except Exception as e: @@ -537,19 +817,29 @@ class AutoDatabaseBackup(models.Model): mail_template_failed.send_mail(rec.id, force_send=True) # Dropbox backup elif rec.backup_destination == 'dropbox': - temp = tempfile.NamedTemporaryFile(suffix='.%s' % rec.backup_format) + temp = tempfile.NamedTemporaryFile( + suffix='.%s' % rec.backup_format) with open(temp.name, "wb+") as tmp: odoo.service.db.dump_db(rec.db_name, tmp, rec.backup_format) try: - dbx = dropbox.Dropbox(app_key=rec.dropbox_client_id, app_secret=rec.dropbox_client_secret, oauth2_refresh_token=rec.dropbox_refresh_token) + drop_connection = dropbox.Dropbox( + app_key=rec.dropbox_client_key, + app_secret=rec.dropbox_client_secret, + oauth2_refresh_token=rec.dropbox_refresh_token) dropbox_destination = rec.dropbox_folder + '/' + backup_filename - dbx.files_upload(temp.read(), dropbox_destination) + drop_connection.files_upload(temp.read(), + dropbox_destination) if rec.auto_remove: - files = dbx.files_list_folder(rec.dropbox_folder) + files = drop_connection.files_list_folder( + rec.dropbox_folder) file_entries = files.entries - expired_files = list(filter(lambda fl: (datetime.datetime.now() - fl.client_modified).days >= rec.days_to_remove, file_entries)) + expired_files = list(filter( + lambda fl: (fields.datetime.now() - + fl.client_modified).days >= + rec.days_to_remove, + file_entries)) for file in expired_files: - dbx.files_delete_v2(file.path_display) + drop_connection.files_delete_v2(file.path_display) if rec.notify_user: mail_template_success.send_mail(rec.id, force_send=True) except Exception as error: @@ -559,26 +849,36 @@ class AutoDatabaseBackup(models.Model): mail_template_failed.send_mail(rec.id, force_send=True) # Onedrive Backup elif rec.backup_destination == 'onedrive': - if rec.onedrive_token_validity is not False and rec.onedrive_token_validity <= fields.Datetime.now(): + if (rec.onedrive_token_validity is not False and + rec.onedrive_token_validity <= fields.Datetime.now()): rec.generate_onedrive_refresh_token() - temp = tempfile.NamedTemporaryFile(suffix='.%s' % rec.backup_format) + temp = tempfile.NamedTemporaryFile( + suffix='.%s' % rec.backup_format) with open(temp.name, "wb+") as tmp: odoo.service.db.dump_db(rec.db_name, tmp, rec.backup_format) - headers = {'Authorization': 'Bearer %s' % rec.onedrive_access_token, 'Content-Type': 'application/json'} - upload_session_url = MICROSOFT_GRAPH_END_POINT + "/v1.0/me/drive/items/%s:/%s:/createUploadSession" % (rec.onedrive_folder_id, backup_filename) + headers = { + 'Authorization': 'Bearer %s' % rec.onedrive_access_token, + 'Content-Type': 'application/json'} + upload_session_url = MICROSOFT_GRAPH_END_POINT + "/v1.0/me/drive/items/%s:/%s:/createUploadSession" % ( + rec.onedrive_folder_key, backup_filename) try: - upload_session = requests.post(upload_session_url, headers=headers) + upload_session = requests.post(upload_session_url, + headers=headers) upload_url = upload_session.json().get('uploadUrl') requests.put(upload_url, data=temp.read()) if rec.auto_remove: - list_url = MICROSOFT_GRAPH_END_POINT + "/v1.0/me/drive/items/%s/children" % rec.onedrive_folder_id + list_url = MICROSOFT_GRAPH_END_POINT + "/v1.0/me/drive/items/%s/children" % rec.onedrive_folder_key response = requests.get(list_url, headers=headers) files = response.json().get('value') for file in files: - create_time = file['createdDateTime'][:19].replace('T', ' ') - diff_days = (datetime.datetime.now() - datetime.datetime.strptime(create_time, '%Y-%m-%d %H:%M:%S')).days + create_time = file['createdDateTime'][:19].replace( + 'T', ' ') + diff_days = ( + fields.datetime.now() - fields.datetime.strptime( + create_time, '%Y-%m-%d %H:%M:%S')).days if diff_days >= rec.days_to_remove: - delete_url = MICROSOFT_GRAPH_END_POINT + "/v1.0/me/drive/items/%s" % file['id'] + delete_url = MICROSOFT_GRAPH_END_POINT + "/v1.0/me/drive/items/%s" % \ + file['id'] requests.delete(delete_url, headers=headers) if rec.notify_user: mail_template_success.send_mail(rec.id, force_send=True) @@ -587,3 +887,155 @@ class AutoDatabaseBackup(models.Model): _logger.info('Onedrive Exception: %s', error) if rec.notify_user: mail_template_failed.send_mail(rec.id, force_send=True) + # amazon S3 backup + elif rec.backup_destination == 'amazon_s3': + if rec.aws_access_key and rec.aws_secret_access_key: + try: + # create a boto3 client for Amazon S3 with provided + # access key id and secret access key + bo3 = boto3.client( + 's3', + aws_access_key_id=rec.aws_access_key, + aws_secret_access_key=rec.aws_secret_access_key) + # create a boto3 resource for Amazon S3 with provided + # access key id and secret access key + s3 = boto3.resource( + 's3', + aws_access_key_id=rec.aws_access_key, + aws_secret_access_key=rec.aws_secret_access_key, ) + # create a folder in the specified bucket, if it + # doesn't already exist + s3.Object(rec.bucket_file_name, + rec.aws_folder_name + '/').put() + bucket = s3.Bucket(rec.bucket_file_name) + # get all the prefixes in the bucket + prefixes = set() + for obj in bucket.objects.all(): + key = obj.key + if key.endswith('/'): + prefix = key[:-1] # Remove the trailing slash + prefixes.add(prefix) + # if the specified folder is present in the bucket, + # take a backup of the database and upload it to the + # S3 bucket + if rec.aws_folder_name in prefixes: + temp = tempfile.NamedTemporaryFile( + suffix='.%s' % rec.backup_format) + with open(temp.name, "wb+") as tmp: + odoo.service.db.dump_db(rec.db_name, tmp, + rec.backup_format) + backup_file_path = temp.name + remote_file_path = \ + f"{rec.aws_folder_name}/{rec.db_name}_" \ + f"{backup_time}.{rec.backup_format}" + s3.Object(rec.bucket_file_name, + remote_file_path).upload_file( + backup_file_path) + # If notify_user is enabled, send a success email + # user notifying them about the successful backup + if rec.notify_user: + mail_template_success.send_mail(rec.id, + force_send=True) + # if auto_remove is enabled, remove the backups that + # are older than specified days from the S3 bucket + if rec.auto_remove: + folder_path = rec.aws_folder_name + response = bo3.list_objects( + Bucket=rec.bucket_file_name, + Prefix=folder_path) + today = fields.date.today() + for file in response['Contents']: + file_path = file['Key'] + last_modified = file['LastModified'] + date = last_modified.date() + age_in_days = (today - date).days + if age_in_days >= rec.days_to_remove: + bo3.delete_object( + Bucket=rec.bucket_file_name, + Key=file_path) + except Exception as error: + # if any error occurs, set the 'generated_exception' + # field to the error message and log the error + rec.generated_exception = error + _logger.info('Amazon S3 Exception: %s', error) + # If an exception occurs, send a failed email + # notifying them about the failed backup + if rec.notify_user: + mail_template_failed.send_mail(rec.id, + force_send=True) + # nextcloud backup + elif rec.backup_destination == 'next_cloud': + if rec.domain and rec.next_cloud_password and \ + rec.next_cloud_user_name: + try: + # Connect to NextCloud using the provided username + # and password + ncx = NextCloud(rec.domain, + auth=HTTPBasicAuth( + rec.next_cloud_user_name, + rec.next_cloud_password)) + # Connect to NextCloud again to perform additional + # operations + nc = nextcloud_client.Client(rec.domain) + nc.login(rec.next_cloud_user_name, + rec.next_cloud_password) + # Get the folder name from the NextCloud folder ID + folder_name = rec.nextcloud_folder_key + # If auto_remove is enabled, remove backup files + # older than specified days + if rec.auto_remove: + folder_path = "/" + folder_name + for item in nc.list(folder_path): + backup_file_name = item.path.split("/")[-1] + backup_date_str = backup_file_name.split("_")[ + 2] + backup_date = fields.datetime.strptime( + backup_date_str, '%Y-%m-%d').date() + if (fields.date.today() - backup_date).days \ + >= rec.days_to_remove: + nc.delete(item.path) + # If notify_user is enabled, send a success email + # notification + if rec.notify_user: + mail_template_success.send_mail(rec.id, + force_send=True) + except Exception as error: + rec.generated_exception = error + _logger.info('NextCloud Exception: %s', error) + if rec.notify_user: + # If an exception occurs, send a failed email + # notification + mail_template_failed.send_mail(rec.id, + force_send=True) + # Get the list of folders in the root directory of NextCloud + data = ncx.list_folders('/').__dict__ + folders = [ + [file_name['href'].split('/')[-2], file_name['file_id']] + for file_name in data['data'] if + file_name['href'].endswith('/')] + # If the folder name is not found in the list of folders, + # create the folder + if folder_name.replace('/', '') not in [file[0] for file in + folders]: + nc.mkdir(folder_name) + # Dump the database to a temporary file + temp = tempfile.NamedTemporaryFile( + suffix='.%s' % rec.backup_format) + with open(temp.name, "wb+") as tmp: + odoo.service.db.dump_db(rec.db_name, tmp, + rec.backup_format) + backup_file_path = temp.name + remote_file_path = f"/{folder_name}/{rec.db_name}_" \ + f"{backup_time}.{rec.backup_format}" + nc.put_file(remote_file_path, backup_file_path) + else: + # Dump the database to a temporary file + temp = tempfile.NamedTemporaryFile( + suffix='.%s' % rec.backup_format) + with open(temp.name, "wb+") as tmp: + odoo.service.db.dump_db(rec.db_name, tmp, + rec.backup_format) + backup_file_path = temp.name + remote_file_path = f"/{folder_name}/{rec.db_name}_" \ + f"{backup_time}.{rec.backup_format}" + nc.put_file(remote_file_path, backup_file_path) diff --git a/auto_database_backup/security/ir.model.access.csv b/auto_database_backup/security/ir.model.access.csv index 632a3360f..8d4ff9c61 100644 --- a/auto_database_backup/security/ir.model.access.csv +++ b/auto_database_backup/security/ir.model.access.csv @@ -1,3 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_db_backup_configure,access.db.backup.configure,model_db_backup_configure,base.group_user,1,1,1,1 -access_dropbox_auth_wizard,access.dropbox.auth.wizard,model_dropbox_auth_wizard,base.group_user,1,1,1,1 \ No newline at end of file +access_db_backup_configure_user,access.db.backup.configure.user,model_db_backup_configure,base.group_user,1,1,1,1 +access_dropbox_auth_code_user,access.dropbox.auth.code.user,model_dropbox_auth_code,base.group_user,1,1,1,1 diff --git a/auto_database_backup/static/description/assets/icons/f-alarm.png b/auto_database_backup/static/description/assets/icons/f-alarm.png deleted file mode 100644 index 4a4d3d2c8..000000000 Binary files a/auto_database_backup/static/description/assets/icons/f-alarm.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/icons/f-backup.png b/auto_database_backup/static/description/assets/icons/f-backup.png deleted file mode 100644 index 808708a3f..000000000 Binary files a/auto_database_backup/static/description/assets/icons/f-backup.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/icons/f-dropbox.png b/auto_database_backup/static/description/assets/icons/f-dropbox.png deleted file mode 100644 index c8885eb5a..000000000 Binary files a/auto_database_backup/static/description/assets/icons/f-dropbox.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/icons/f-google-drive.png b/auto_database_backup/static/description/assets/icons/f-google-drive.png deleted file mode 100644 index cfb334951..000000000 Binary files a/auto_database_backup/static/description/assets/icons/f-google-drive.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/icons/f-remove-database.png b/auto_database_backup/static/description/assets/icons/f-remove-database.png deleted file mode 100644 index d6550213d..000000000 Binary files a/auto_database_backup/static/description/assets/icons/f-remove-database.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/icons/f-sftp.png b/auto_database_backup/static/description/assets/icons/f-sftp.png deleted file mode 100644 index 11d4ae53d..000000000 Binary files a/auto_database_backup/static/description/assets/icons/f-sftp.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/icons/onedrive.png b/auto_database_backup/static/description/assets/icons/onedrive.png deleted file mode 100644 index 8a779bcc2..000000000 Binary files a/auto_database_backup/static/description/assets/icons/onedrive.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/misc/categories.png b/auto_database_backup/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/categories.png differ diff --git a/auto_database_backup/static/description/assets/misc/check-box.png b/auto_database_backup/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/check-box.png differ diff --git a/auto_database_backup/static/description/assets/misc/compass.png b/auto_database_backup/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/compass.png differ diff --git a/auto_database_backup/static/description/assets/misc/corporate.png b/auto_database_backup/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/corporate.png differ diff --git a/auto_database_backup/static/description/assets/misc/customer-support.png b/auto_database_backup/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/customer-support.png differ diff --git a/auto_database_backup/static/description/assets/misc/cybrosys-logo.png b/auto_database_backup/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/cybrosys-logo.png differ diff --git a/auto_database_backup/static/description/assets/misc/features.png b/auto_database_backup/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/features.png differ diff --git a/auto_database_backup/static/description/assets/misc/logo.png b/auto_database_backup/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/logo.png differ diff --git a/auto_database_backup/static/description/assets/misc/pictures.png b/auto_database_backup/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/pictures.png differ diff --git a/auto_database_backup/static/description/assets/misc/pie-chart.png b/auto_database_backup/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/pie-chart.png differ diff --git a/auto_database_backup/static/description/assets/misc/right-arrow.png b/auto_database_backup/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/right-arrow.png differ diff --git a/auto_database_backup/static/description/assets/misc/star.png b/auto_database_backup/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/star.png differ diff --git a/auto_database_backup/static/description/assets/misc/support.png b/auto_database_backup/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/support.png differ diff --git a/auto_database_backup/static/description/assets/misc/whatsapp.png b/auto_database_backup/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/auto_database_backup/static/description/assets/misc/whatsapp.png differ diff --git a/auto_database_backup/static/description/assets/modules/1.png b/auto_database_backup/static/description/assets/modules/1.png index 3ad04ecfd..919be798f 100644 Binary files a/auto_database_backup/static/description/assets/modules/1.png and b/auto_database_backup/static/description/assets/modules/1.png differ diff --git a/auto_database_backup/static/description/assets/modules/2.png b/auto_database_backup/static/description/assets/modules/2.png index 499b1a72f..84ebbfb41 100644 Binary files a/auto_database_backup/static/description/assets/modules/2.png and b/auto_database_backup/static/description/assets/modules/2.png differ diff --git a/auto_database_backup/static/description/assets/modules/3.png b/auto_database_backup/static/description/assets/modules/3.png index 5238bdeab..de2c12ab6 100644 Binary files a/auto_database_backup/static/description/assets/modules/3.png and b/auto_database_backup/static/description/assets/modules/3.png differ diff --git a/auto_database_backup/static/description/assets/modules/4.png b/auto_database_backup/static/description/assets/modules/4.png index 7f2815273..b92e546a9 100644 Binary files a/auto_database_backup/static/description/assets/modules/4.png and b/auto_database_backup/static/description/assets/modules/4.png differ diff --git a/auto_database_backup/static/description/assets/modules/5.png b/auto_database_backup/static/description/assets/modules/5.png index cfb5be33c..61d3e0244 100644 Binary files a/auto_database_backup/static/description/assets/modules/5.png and b/auto_database_backup/static/description/assets/modules/5.png differ diff --git a/auto_database_backup/static/description/assets/modules/6.png b/auto_database_backup/static/description/assets/modules/6.png index f01b10060..457607dc9 100644 Binary files a/auto_database_backup/static/description/assets/modules/6.png and b/auto_database_backup/static/description/assets/modules/6.png differ diff --git a/auto_database_backup/static/description/assets/modules/approval_image.png b/auto_database_backup/static/description/assets/modules/approval_image.png deleted file mode 100644 index 84fe94e80..000000000 Binary files a/auto_database_backup/static/description/assets/modules/approval_image.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/modules/dynamic_image.png b/auto_database_backup/static/description/assets/modules/dynamic_image.png deleted file mode 100644 index f55c47e0f..000000000 Binary files a/auto_database_backup/static/description/assets/modules/dynamic_image.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/modules/list_view_image.png b/auto_database_backup/static/description/assets/modules/list_view_image.png deleted file mode 100644 index 510d36ae9..000000000 Binary files a/auto_database_backup/static/description/assets/modules/list_view_image.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/modules/multiple_ref_image.png b/auto_database_backup/static/description/assets/modules/multiple_ref_image.png deleted file mode 100644 index 3fe90e552..000000000 Binary files a/auto_database_backup/static/description/assets/modules/multiple_ref_image.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/modules/print_image.png b/auto_database_backup/static/description/assets/modules/print_image.png deleted file mode 100644 index b470725a1..000000000 Binary files a/auto_database_backup/static/description/assets/modules/print_image.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/modules/product_return_image.png b/auto_database_backup/static/description/assets/modules/product_return_image.png deleted file mode 100644 index 3afc14722..000000000 Binary files a/auto_database_backup/static/description/assets/modules/product_return_image.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/screenshots/add.png b/auto_database_backup/static/description/assets/screenshots/add.png new file mode 100644 index 000000000..af240d4d9 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/add.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/amazon_s3_7.png b/auto_database_backup/static/description/assets/screenshots/amazon_s3_7.png new file mode 100644 index 000000000..9a740ae0c Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/amazon_s3_7.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/amazon_s3_8.png b/auto_database_backup/static/description/assets/screenshots/amazon_s3_8.png new file mode 100644 index 000000000..c1dd06a9a Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/amazon_s3_8.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/amazon_s3_pci1.png b/auto_database_backup/static/description/assets/screenshots/amazon_s3_pci1.png new file mode 100644 index 000000000..5fcd336d6 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/amazon_s3_pci1.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/amazon_s3_pic 2.png b/auto_database_backup/static/description/assets/screenshots/amazon_s3_pic 2.png new file mode 100644 index 000000000..d259da8a9 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/amazon_s3_pic 2.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/amazons3_4.png b/auto_database_backup/static/description/assets/screenshots/amazons3_4.png new file mode 100644 index 000000000..c50a20cc8 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/amazons3_4.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/amazons3_5.png b/auto_database_backup/static/description/assets/screenshots/amazons3_5.png new file mode 100644 index 000000000..415d521c4 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/amazons3_5.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/amazons3_6.png b/auto_database_backup/static/description/assets/screenshots/amazons3_6.png new file mode 100644 index 000000000..284490127 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/amazons3_6.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/amazons3_7.png b/auto_database_backup/static/description/assets/screenshots/amazons3_7.png new file mode 100644 index 000000000..f9345a6d8 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/amazons3_7.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/amazons3_access.png b/auto_database_backup/static/description/assets/screenshots/amazons3_access.png new file mode 100644 index 000000000..270d27035 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/amazons3_access.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/amazons3_pick 3.png b/auto_database_backup/static/description/assets/screenshots/amazons3_pick 3.png new file mode 100644 index 000000000..22bbce54c Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/amazons3_pick 3.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/amazons3_signup.png b/auto_database_backup/static/description/assets/screenshots/amazons3_signup.png new file mode 100644 index 000000000..52357df9a Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/amazons3_signup.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup1.png b/auto_database_backup/static/description/assets/screenshots/backup1.png index 3e34ded7d..899861ec1 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup1.png and b/auto_database_backup/static/description/assets/screenshots/backup1.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup10.png b/auto_database_backup/static/description/assets/screenshots/backup10.png index d4ca7d749..ddd92a93f 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup10.png and b/auto_database_backup/static/description/assets/screenshots/backup10.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup11.png b/auto_database_backup/static/description/assets/screenshots/backup11.png index 5e8a6bb8e..3500f8c70 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup11.png and b/auto_database_backup/static/description/assets/screenshots/backup11.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup12.png b/auto_database_backup/static/description/assets/screenshots/backup12.png index 05e7392a5..99f74c5aa 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup12.png and b/auto_database_backup/static/description/assets/screenshots/backup12.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup13.png b/auto_database_backup/static/description/assets/screenshots/backup13.png index 990525b8f..982d9c83c 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup13.png and b/auto_database_backup/static/description/assets/screenshots/backup13.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup14.png b/auto_database_backup/static/description/assets/screenshots/backup14.png index 5c61aea39..756a13c25 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup14.png and b/auto_database_backup/static/description/assets/screenshots/backup14.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup15.png b/auto_database_backup/static/description/assets/screenshots/backup15.png new file mode 100644 index 000000000..2512c53ce Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/backup15.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup16.png b/auto_database_backup/static/description/assets/screenshots/backup16.png new file mode 100644 index 000000000..020345b48 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/backup16.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup17.png b/auto_database_backup/static/description/assets/screenshots/backup17.png new file mode 100644 index 000000000..5e8a6bb8e Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/backup17.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup18.png b/auto_database_backup/static/description/assets/screenshots/backup18.png new file mode 100644 index 000000000..05e7392a5 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/backup18.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup2.png b/auto_database_backup/static/description/assets/screenshots/backup2.png index e2dd784fe..80afdd5ef 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup2.png and b/auto_database_backup/static/description/assets/screenshots/backup2.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup3.png b/auto_database_backup/static/description/assets/screenshots/backup3.png index 3966e1d62..7971483e4 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup3.png and b/auto_database_backup/static/description/assets/screenshots/backup3.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup4.png b/auto_database_backup/static/description/assets/screenshots/backup4.png index c07717bbb..835112431 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup4.png and b/auto_database_backup/static/description/assets/screenshots/backup4.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup5.png b/auto_database_backup/static/description/assets/screenshots/backup5.png index 8e9f1224d..bd6f62d55 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup5.png and b/auto_database_backup/static/description/assets/screenshots/backup5.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup6.png b/auto_database_backup/static/description/assets/screenshots/backup6.png index 340195bd7..db661d19b 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup6.png and b/auto_database_backup/static/description/assets/screenshots/backup6.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup7.png b/auto_database_backup/static/description/assets/screenshots/backup7.png index a801a8591..29beb393f 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup7.png and b/auto_database_backup/static/description/assets/screenshots/backup7.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup8.png b/auto_database_backup/static/description/assets/screenshots/backup8.png index 714d81df5..8894a554c 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup8.png and b/auto_database_backup/static/description/assets/screenshots/backup8.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/backup9.png b/auto_database_backup/static/description/assets/screenshots/backup9.png index e8ef7e233..09ff79ec7 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/backup9.png and b/auto_database_backup/static/description/assets/screenshots/backup9.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/drive5.png b/auto_database_backup/static/description/assets/screenshots/drive5.png index 22dbd0512..da827d867 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/drive5.png and b/auto_database_backup/static/description/assets/screenshots/drive5.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/drive6.png b/auto_database_backup/static/description/assets/screenshots/drive6.png deleted file mode 100644 index 9de986e55..000000000 Binary files a/auto_database_backup/static/description/assets/screenshots/drive6.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/screenshots/drive7.png b/auto_database_backup/static/description/assets/screenshots/drive7.png deleted file mode 100644 index 8be1b4b85..000000000 Binary files a/auto_database_backup/static/description/assets/screenshots/drive7.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/screenshots/drive8.png b/auto_database_backup/static/description/assets/screenshots/drive8.png deleted file mode 100644 index 29beb393f..000000000 Binary files a/auto_database_backup/static/description/assets/screenshots/drive8.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/screenshots/drive9.png b/auto_database_backup/static/description/assets/screenshots/drive9.png deleted file mode 100644 index e64fb136c..000000000 Binary files a/auto_database_backup/static/description/assets/screenshots/drive9.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/screenshots/drop1.png b/auto_database_backup/static/description/assets/screenshots/drop1.png new file mode 100644 index 000000000..af02afc76 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/drop1.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/drop2.png b/auto_database_backup/static/description/assets/screenshots/drop2.png new file mode 100644 index 000000000..488fb6cbc Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/drop2.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/drop3.png b/auto_database_backup/static/description/assets/screenshots/drop3.png new file mode 100644 index 000000000..1088638e0 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/drop3.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/drop4.png b/auto_database_backup/static/description/assets/screenshots/drop4.png new file mode 100644 index 000000000..f8eeae60e Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/drop4.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/dropbox1.png b/auto_database_backup/static/description/assets/screenshots/dropbox1.png deleted file mode 100644 index b06cd219f..000000000 Binary files a/auto_database_backup/static/description/assets/screenshots/dropbox1.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/screenshots/dropbox2.png b/auto_database_backup/static/description/assets/screenshots/dropbox2.png deleted file mode 100644 index 2544b8cd8..000000000 Binary files a/auto_database_backup/static/description/assets/screenshots/dropbox2.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/screenshots/dropbox3.png b/auto_database_backup/static/description/assets/screenshots/dropbox3.png deleted file mode 100644 index 1ac146ad6..000000000 Binary files a/auto_database_backup/static/description/assets/screenshots/dropbox3.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/screenshots/dropbox4.png b/auto_database_backup/static/description/assets/screenshots/dropbox4.png deleted file mode 100644 index d392e50de..000000000 Binary files a/auto_database_backup/static/description/assets/screenshots/dropbox4.png and /dev/null differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter15.png b/auto_database_backup/static/description/assets/screenshots/enter15.png new file mode 100644 index 000000000..5763fddd4 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter15.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter17.png b/auto_database_backup/static/description/assets/screenshots/enter17.png new file mode 100644 index 000000000..c0c12d305 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter17.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_1.png b/auto_database_backup/static/description/assets/screenshots/enter_1.png new file mode 100644 index 000000000..88f6d6d6d Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_1.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_10.png b/auto_database_backup/static/description/assets/screenshots/enter_10.png new file mode 100644 index 000000000..7009f87b2 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_10.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_11.png b/auto_database_backup/static/description/assets/screenshots/enter_11.png new file mode 100644 index 000000000..0e4015ac2 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_11.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_12.png b/auto_database_backup/static/description/assets/screenshots/enter_12.png new file mode 100644 index 000000000..ad571330a Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_12.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_13.png b/auto_database_backup/static/description/assets/screenshots/enter_13.png new file mode 100644 index 000000000..965d1ab80 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_13.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_2.png b/auto_database_backup/static/description/assets/screenshots/enter_2.png new file mode 100644 index 000000000..510e3619f Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_2.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_22.png b/auto_database_backup/static/description/assets/screenshots/enter_22.png new file mode 100644 index 000000000..b89f3af87 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_22.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_3.png b/auto_database_backup/static/description/assets/screenshots/enter_3.png new file mode 100644 index 000000000..8420f4806 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_3.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_4.png b/auto_database_backup/static/description/assets/screenshots/enter_4.png new file mode 100644 index 000000000..a672c02ec Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_4.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_5.png b/auto_database_backup/static/description/assets/screenshots/enter_5.png new file mode 100644 index 000000000..9aa286743 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_5.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_6.png b/auto_database_backup/static/description/assets/screenshots/enter_6.png new file mode 100644 index 000000000..1f5be9219 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_6.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_7.png b/auto_database_backup/static/description/assets/screenshots/enter_7.png new file mode 100644 index 000000000..e8d36c084 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_7.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_8.png b/auto_database_backup/static/description/assets/screenshots/enter_8.png new file mode 100644 index 000000000..51e96b2e3 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_8.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_9.png b/auto_database_backup/static/description/assets/screenshots/enter_9.png new file mode 100644 index 000000000..6e45d0fe1 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_9.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_9999 (copy).png b/auto_database_backup/static/description/assets/screenshots/enter_9999 (copy).png new file mode 100644 index 000000000..d6280a82a Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_9999 (copy).png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_9999.png b/auto_database_backup/static/description/assets/screenshots/enter_9999.png new file mode 100644 index 000000000..d6280a82a Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_9999.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_amazons3.png b/auto_database_backup/static/description/assets/screenshots/enter_amazons3.png new file mode 100644 index 000000000..ec0822979 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_amazons3.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_next1.png b/auto_database_backup/static/description/assets/screenshots/enter_next1.png new file mode 100644 index 000000000..41eac2288 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_next1.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_old1.png b/auto_database_backup/static/description/assets/screenshots/enter_old1.png new file mode 100644 index 000000000..4c5e1afe5 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_old1.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_schedule (copy).png b/auto_database_backup/static/description/assets/screenshots/enter_schedule (copy).png new file mode 100644 index 000000000..4483caef0 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_schedule (copy).png differ diff --git a/auto_database_backup/static/description/assets/screenshots/enter_schedule.png b/auto_database_backup/static/description/assets/screenshots/enter_schedule.png new file mode 100644 index 000000000..4483caef0 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/enter_schedule.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/gd_folder_id.png b/auto_database_backup/static/description/assets/screenshots/gd_folder_id.png new file mode 100644 index 000000000..ec8aa8188 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/gd_folder_id.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/hero.png b/auto_database_backup/static/description/assets/screenshots/hero.png index 5e7d34238..cb468d375 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/hero.png and b/auto_database_backup/static/description/assets/screenshots/hero.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/newcloud1.png b/auto_database_backup/static/description/assets/screenshots/newcloud1.png new file mode 100644 index 000000000..89b6501ce Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/newcloud1.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/newcloud2.png b/auto_database_backup/static/description/assets/screenshots/newcloud2.png new file mode 100644 index 000000000..b213b1145 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/newcloud2.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/newcloud2_ds.png b/auto_database_backup/static/description/assets/screenshots/newcloud2_ds.png new file mode 100644 index 000000000..2c97c2316 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/newcloud2_ds.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/next_cloud2.png b/auto_database_backup/static/description/assets/screenshots/next_cloud2.png new file mode 100644 index 000000000..bfa0ff1f6 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/next_cloud2.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/next_cloud_9.png b/auto_database_backup/static/description/assets/screenshots/next_cloud_9.png new file mode 100644 index 000000000..261d476f4 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/next_cloud_9.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/nextcloud_4.png b/auto_database_backup/static/description/assets/screenshots/nextcloud_4.png new file mode 100644 index 000000000..a0fbb2f36 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/nextcloud_4.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/nextcloud_5.png b/auto_database_backup/static/description/assets/screenshots/nextcloud_5.png new file mode 100644 index 000000000..14a69f1e0 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/nextcloud_5.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/nextcloud_6.png b/auto_database_backup/static/description/assets/screenshots/nextcloud_6.png new file mode 100644 index 000000000..35259d927 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/nextcloud_6.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/nextcloud_create_3.png b/auto_database_backup/static/description/assets/screenshots/nextcloud_create_3.png new file mode 100644 index 000000000..2548aa71e Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/nextcloud_create_3.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/older_2.png b/auto_database_backup/static/description/assets/screenshots/older_2.png new file mode 100644 index 000000000..6417fa782 Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/older_2.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/onedrive1.png b/auto_database_backup/static/description/assets/screenshots/onedrive1.png index 6e5e16728..8d763ea85 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/onedrive1.png and b/auto_database_backup/static/description/assets/screenshots/onedrive1.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/onedrive6.png b/auto_database_backup/static/description/assets/screenshots/onedrive6.png index c078e3b22..4f241299c 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/onedrive6.png and b/auto_database_backup/static/description/assets/screenshots/onedrive6.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/onedrive7.png b/auto_database_backup/static/description/assets/screenshots/onedrive7.png index 3e771fcc7..2da4020c1 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/onedrive7.png and b/auto_database_backup/static/description/assets/screenshots/onedrive7.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/onedrive8.png b/auto_database_backup/static/description/assets/screenshots/onedrive8.png index 8db9d4bce..61f5cb9bc 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/onedrive8.png and b/auto_database_backup/static/description/assets/screenshots/onedrive8.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/onedrive9.png b/auto_database_backup/static/description/assets/screenshots/onedrive9.png index 33e1a2edb..b2894148f 100644 Binary files a/auto_database_backup/static/description/assets/screenshots/onedrive9.png and b/auto_database_backup/static/description/assets/screenshots/onedrive9.png differ diff --git a/auto_database_backup/static/description/assets/screenshots/stat.gif b/auto_database_backup/static/description/assets/screenshots/stat.gif new file mode 100644 index 000000000..15e0f2d6f Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/stat.gif differ diff --git a/auto_database_backup/static/description/assets/screenshots/v15-hero.gif b/auto_database_backup/static/description/assets/screenshots/v15-hero.gif new file mode 100644 index 000000000..15e0f2d6f Binary files /dev/null and b/auto_database_backup/static/description/assets/screenshots/v15-hero.gif differ diff --git a/auto_database_backup/static/description/banner.gif b/auto_database_backup/static/description/banner.gif index 591c8b18d..b9fa8b25f 100644 Binary files a/auto_database_backup/static/description/banner.gif and b/auto_database_backup/static/description/banner.gif differ diff --git a/auto_database_backup/static/description/index.html b/auto_database_backup/static/description/index.html index ea239addc..08ae2504a 100644 --- a/auto_database_backup/static/description/index.html +++ b/auto_database_backup/static/description/index.html @@ -1,885 +1,1062 @@ -
-
-
-

- Automatic Database Backup

-

- Automatic Database Backup To Local Server, Remote Server, Google Drive, Onedrive And Dropbox -

- -
-
- -
-
-

- Explore this module -

-
- - -
- -
-
-

- Features

-

- View features of this module

-
-
- -
+
+ + - -
-
-

- Overview -

+ +
+
+
- -
-

- This module helps to generate backups of your databases automatically on regular interval of times. - The generated backups can be stored into local storage, ftp server, sftp server, dropbox, Google Drive or Onedrive. - User can enable auto remove option to automatically delete old backups. - User can enable email notification to be notified about the success and failure of the backup generation - and storage. - Using Automatic Database Backup module user can generate and store database backups to multiple - location.

- +

+ Explore This + Module

+
+ - -
-
-

- Features -

+ - -
-
- + + + +
+
+ +
+

+ Overview +

+
+
+
+ This module helps to generate backups of your databases automatically on + regular interval of times. The generated backups can be stored into + local storage, ftp server, sftp server, dropbox,nextcloud, Google Drive + or Onedrive and Amazon S3. User can enable auto remove option to automatically delete + old backups. User can enable email notification to be notified about the + success and failure of the backup generation and storage. + Using Automatic Database Backup module user can generate and store + database backups to multiple location. +
+
+ This module uses an external python dependency 'dropbox'.Before + installing the module install the python + package + first.The required python package can be installed using the + following command, +
+ pip install dropbox
-
-

- Generate Database Backup

-

- Generate database backups on regular intervals -

+
+
+ This module uses an external python dependency 'nextcloud'.Before + installing the module install the python + package + first.The required python package can be installed using the + following command, +
+ pip install pyncclient +
+
+
+ This module uses an external python dependency 'nextcloud-api-wrapper'.Before + installing the module install the python + package + first.The required python package can be installed using the + following command, +
+ pip install nextcloud-api-wrapper
-
+
+
+ This module uses an external python dependency 'Boto3'.Before installing + the module install the python + package + first.The required python package can be installed using the following + command, +
+ pip install boto3
-
-
-
- -
-
-

- Store Backup to Remote Server

-

- Generated backup can be stored to remote servers. -

-
-
+
+
+ This module uses an external python dependency 'paramiko'.Before + installing the module install the python + package + first.The required python package can be installed using the following + command, +
+ pip install paramiko
+
-
-
-
- + + +
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + Generate Database + Backups on regular intervals
-
-

- Store Backup to Dropbox

-

- Generated backup can be stored to Dropbox account. -

+ +
+ + Store Backup to + Dropbox
-
-
-
-
-
- +
+ + Store Backup to + Onedrive
-
-

- Store Backup to Google Drive

-

- Generated backup can be stored to Google Drive. -

+ +
+ + Notify user on + success + and failure of backup generation
-
- -
-
-
- +
+
+ + Store Backup to + Remote + Server
-
-

- Store Backup to Onedrive

-

- Generated backup can be stored to Onedrive. -

+
+ + Store Backup to + Nextcloud
-
-
- -
-
-
- +
+ + Store Backup to + Amazon S3
-
-

- Automatically remove old backups

-

- Old backups files will be deleted automatically based on the obsolescence of backup. -

+ +
+ + Generated backup can + be + stored to Google Drive
-
-
-
-
-
- +
+ + Automatically remove + old backups
-
-

- Notify user on success and failure of backup generation

-

- An email notification send to user on successful backup generation also send an email notification when - backup operation failed. -

+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

+ Database Backup + Configuration Menu

+

+ Go to Setting --> Technical --> Backup Configuration to configure + backups

+
-
-
+
+

+ Create New Database + Backup + Configuration

+

+ Enter the Database Name and Master Password. Specify Backup Destination. + Enter the backup directory path, if directory does not exist new + directory will be created.

+ +
-
+
+

+ Store Backup to + Remote + SFTP Server

+

+ Select Backup Destination as SFTP, enter credentials. + "TEST CONNECTION" button to check whether the connection is + successful. +

+ +
-
-
-

- Screenshots -

-
-
-

- Database Backup Configuration Menu

-

- Got Setting --> Technical --> Backup Configuration to configure backups

- -
+
+

+ Store Backup to + Remote + FTP Server

+

+ Select Backup + Destination + as FTP, enter credentials. + "TEST CONNECTION" button to check whether the connection is + successful.

+ +
-
-

- Crate New Database Backup Configuration

-

- Enter the database name and master password. specify backup type and destination. - Enter the backup directory path, if directory does not exist new directory will be created. -

- -
+
+

+ Store Backup to + Google + Drive

+

+ You'll need to create a + new + Google API project and enabling the Google Drive API, Go to the + Google API Console and log into your + account. + While creating the project, for the Redirect URI restrictions, + copy your Odoo database URI followed by + /google_drive/authentication. Example:

+ +

+ ENABLE API AND SERVICES

+ +

+ ENABLE GOOGLE DRIVE API

+ +

+ Create Credentials, + Follow + the steps, select Website application for the Application + Type.

+ +

+ Under the Authorized + JavaScript Origins section, click + Add URI and type your + company's Odoo URL address. + Under the Authorized redirect URIs section, click + Add URI and + type your company's Odoo URL address + followed + by /google_drive/authentication. + After all the steps are completed, A Client ID and Client secret will + be given, copy the credentials +

+ + +

+ Go to the "OAuth consent screen", then Test users and click on 'ADD USERS' then add the user. +

+ +

+ You can get the drive folder id from the url of the drive folder. +

+ +

+ Configure Backup, Copy + Client ID and Client Secret from Google Drive API Credentials + and paste into their respective fields.

+ +

+ Setup Token, it will + be + redirected to an authorization page.

+ +
+ +

+ Reset the token if + required by clicking on the "Reset Token"

+ +
-
-

- Store Backup to Remote SFTP Server

-

- Select backup destination as SFTP, enter credentials. - Test connection button to check whether the connection is successful. -

- - -

- A successful message will be displayed if connection is successful -

- - -

- An error message will be displayed if test connection is failed -

- -
+
+

+ Store Backup to Dropbox +

+

+ To get the app key and secret key go to the App + Console. + Create a new app +

+ + + Once you created the App , you can get the App key and App Secret as seen in the screenshot + + Choose your app's permission (files.content.write and files.content.read permissions required).then click on Submit + + Choose Dropbox as that of the backup destination. Enter the app secret and key and dropbox Folder. + +

+ Click on the Setup Token

+ +

+ Get the Authorization + Code + and click confirm.

+ +

+ Reset the refresh token + if + required by clicking on the "Reset Token"

+ +
-
-

- Store Backup to Remote FTP Server

-

- Select backup destination as FTP, enter credentials. - Test connection button to check whether the connection is successful. -

- -
+
+

+ Store Backup to + Onedrive +

+

+ Select Backup + Destination + as OneDrive. Enter the App key and App secret. + you'll need to register a new app in the Microsoft + Azure + portal. + While registering the app for the Redirect URI restrictions, + copy your Odoo database URI followed by + /onedrive/authentication. Example:

+ +

+ Copy the Client ID

+ +

+ Generate Client + Secret.

+ + +

+ Get OneDrive folder ID, + where need to store the backup files.

+ +

+ Configure the + Backup

+ +

+ Setup Token, it will + be + redirected to an authorization page.

+ + +

+ Reset the token if + required by clicking on the "Reset Token" +

+ +
+
+

+ Store Backup to + Nextcloud +

+ +

+ To Create an account in Nextcloud go to + https://nextcloud.com/sign-up/, Enter Your Email Address and + Sign up . + + + +

+ You will be redirected to the page as shown in the screenshot, + and it will ask you enter your email and password for the + Nextcloud.

+ + +

+ To get the Domain of the Nextcloud.Go to Settings in the + Nextcloud and Click on Mobile & desktop. You will see server + address Copy link and paste it in your Domain Name.

+ + + +

+ Select the backup destination as Nextcloud. Enter the Domain + Name, UserName, Password and Folder Name where you want to store + your backup on the NextCloud server. Check the Connect button + to check if the connection is successful. + + + +

+ Every day, a Scheduled Action will take place to store a backup + on the Nextcloud Server. The backup will be stored as the folder + name provided in the Folder ID field in Odoo. + + -

-

- Store Backup to Google Drive

-

- you'll need to create a new - Google API project and enabling the Google Drive API, Go to the Google API Console and log into your - account. - While creating the project, for the Redirect URI restrictions, copy your Odoo database URI followed by - /google_drive/authentication. Example: -

- - -

- Enable Google Drive API -

- - - -

- Create Credentials, Follow - the steps, select Website application for the Application Type. -

- - -

- Under the Authorized - JavaScript Origins section, click + Add URI and type your company’s Odoo URL address. - Under the Authorized redirect URIs section, click + Add URI and type your company’s Odoo URL address followed - by /google_drive/authentication. - After all the steps are completed, A client ID and Secret will be given, copy the credentials -

- - -

- Configure Backup, Copy - Client ID and Client Secret from Google Drive API Credentials page into their respective fields. -

- - -

- Setup Tokens, it will be - redirected to an authorization page. -

- - - -

- Reset the token if - required. -

- -
+
-
-

- Store Backup to Dropbox

-

- Select backup destination as Dropbox. Enter the App key and App secret. - you'll need to register a new app in the App - Console. - Select Dropbox API app and choose your app's permission (files.content.write and files.content.read permissions - required). -

-

- Please install dropbox library (pip install dropbox). -

- - -

- Setup refresh token -

- -

- Get the authorization code and click confirm. -

- -

- Reset the refresh token if required -

- -
+
+

+ Store Backup to + Amazon S3 +

+ +

+ To Create an account in Amazon S3 go to + https://portal.aws.amazon.com/billing/signup#/start/email, Enter + Your Email Address and Sign up . + + + +

+ After you created the account.You need to get the Access Key and + Secret Key,To get these go the account Security credentials and + go the Access Keys and create new access keys from there you + will get Access Key and Secret Key.

+ + +

+ + +

+ + + +

+ Next You need to create a Bucket Folder in the Amazon S3.To do + that Go the Services in the top right and go to Storage and S3 + as shown in the Screen shot.

+ + +

+ To create Bucket folder,Click on the Create bucket Button.

+ + +

+ On Creating a Bucket Folder,Check the rules for naming the + Bucket folder,and Select the region as well.After that click on + the create Bucket Button in the bottom of the page.

+ +

+ You will see the Bucket Folder as shown in the screenshot.

+ + +

+ Select Backup Destination as Amazon S3. Enter the Amazon S3 + Access Key,Amazon S3 Secret Key,Bucket Name->Bucket folder you + have created in the Amazon S3 and the File Name->The Folder You + want to store your backup in Amazon S3 Bucket Folder.Test + connection button to check whether the connection is + successful.

+ + +

+ Every day, a Scheduled Action will take place to store a backup + on the Amazon S3 Server. The backup will be stored as the folder + name provided in the File Name field in Odoo.

+ + -
-

- Store Backup to Onedrive

-

- Select backup destination as onedrive. Enter the App key and App secret. - you'll need to register a new app in the Microsoft Azure portal. - While registering the app for the Redirect URI restrictions, copy your Odoo database URI followed by /onedrive/authentication. Example:. -

- - -

- Copy the Client ID -

- -

- Generate Client Secret. -

- - -

- get onedrive folder ID, where need to store the backup files, -

- -

- Configure the backup -

- -

- Setu Tokens, it will be redirected to an authorization page. -

- - - -

- Reset the token if required -

- -
+
-
-

- Automatically Remove Old Backups

-

- Enable auto remove option, specify number of days to remove backups. -

- -
+
+

+ Automatically Remove + Old + Backups

+

+ Enable auto remove + option, + specify number of days to remove backups.

+ +
-
-

- Notify User on Success and Failure of Backup Generation

-

- Enable notify user option, and select a user to notify. An email notification will be sent to the - selected user on - backup successful and failure. - -

+
+

+ Notify User on + Success + and Failure of Backup Generation

+

+ Enable notify user + option, + and select a user to notify. An email notification will be sent + to the selected user on + backup successful and failure. +

+ +
-
-

- Successful backup notification email

- -
+
+

+ Successful backup + notification email

+ +
-
-

- Notification email when backup generation failed

- -
+
+

+ Notification email + when + backup generation failed

+ +
+
+

+ Scheduled Action For + Generating Backup

+

+ Enable the 'Automatic + database Backup' scheduled action, and set up the execution + interval. + Based on the scheduled action setup, backups will be generated + on regular intervals.

+ + +
-
-

- Scheduled Action For Generating Backup

-

- - Enable the 'Automatic database Backup' scheduled action, and set up the execution interval. - Based on the scheduled action setup, backups will be generated on regular intervals. -

- -
+
+ -
- - -
-
-

Suggested Products

-
- -
- + Refresh token set
- + No refresh token set
@@ -109,7 +115,7 @@
@@ -117,7 +123,7 @@
@@ -127,7 +133,7 @@
@@ -135,7 +141,7 @@
@@ -148,7 +154,9 @@
Days
-