| Server IP : 103.161.17.216 / Your IP : 216.73.216.1 Web Server : nginx/1.18.0 System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/app.houseland.info/modules/backup/ |
Upload File : |
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/*
Module Name: Database Backup
Description: Default module to perform database backup
Version: 2.3.0
Requires at least: 2.3.*
*/
require(__DIR__ . '/vendor/autoload.php');
define('BACKUP_MODULE_NAME', 'backup');
/**
* Database backups folder
*/
define('BACKUPS_FOLDER', FCPATH . 'backups' . '/');
hooks()->add_action('after_cron_run', 'backup_perform');
hooks()->add_action('after_system_last_info_row', 'backup_set_info_manager');
hooks()->add_filter('module_backup_action_links', 'module_backup_action_links');
hooks()->add_action('admin_init', 'backup_module_init_menu_items');
hooks()->add_filter('numbers_of_features_using_cron_job', 'backup_numbers_of_features_using_cron_job');
hooks()->add_filter('used_cron_features', 'backup_used_cron_features');
function backup_numbers_of_features_using_cron_job($number)
{
$feature = get_option('auto_backup_enabled');
$number += $feature;
return $number;
}
function backup_used_cron_features($features)
{
$feature = get_option('auto_backup_enabled');
if ($feature > 0) {
array_push($features, 'Auto database backup');
}
return $features;
}
function backup_perform()
{
$CI = &get_instance();
$CI->load->library(BACKUP_MODULE_NAME . '/' . 'backup_module');
$CI->backup_module->make_backup_db();
}
function backup_set_info_manager(){
$CI = &get_instance();
$CI->load->library(BACKUP_MODULE_NAME . '/' . 'backup_module');
$manager = $CI->backup_module->get_backup_manager_name();
echo '<tr>';
echo '<td class="bold">Backup Manager</td>';
echo '<td>'.$manager.'</td>';
echo '</tr>';
}
/**
* Add additional settings for this module in the module list area
* @param array $actions current actions
* @return array
*/
function module_backup_action_links($actions)
{
$actions[] = '<a href="' . admin_url('backup') . '">' . _l('utility_backup') . '</a>';
return $actions;
}
/**
* Register activation module hook
*/
register_activation_hook(BACKUP_MODULE_NAME, 'backup_module_activation_hook');
function backup_module_activation_hook()
{
$CI = &get_instance();
require_once(__DIR__ . '/install.php');
}
/**
* Register language files, must be registered if the module is using languages
*/
register_language_files(BACKUP_MODULE_NAME, [BACKUP_MODULE_NAME]);
/**
* Init backup module menu items in setup in admin_init hook
* @return null
*/
function backup_module_init_menu_items()
{
/**
* If the logged in user is administrator, add custom menu in Setup
*/
if (is_admin()) {
$CI = &get_instance();
$CI->app_menu->add_sidebar_children_item('utilities', [
'slug' => 'utility_backup',
'name' => _l('utility_backup'),
'href' => admin_url('backup'),
'position' => 29,
]);
}
}