public function __construct($params)
 {
     parent::__construct($params);
     $this->init(array('id' => uniqid('wpadm_method_backup__'), 'stime' => time()));
     $file_log = WPAdm_Core::getTmpDir() . "/log.log";
     if (file_exists($file_log)) {
         unlink($file_log);
     }
     WPAdm_Core::log('Create Unique Id ' . $this->id);
     $name = get_option('siteurl');
     $name = str_replace("http://", '', $name);
     $name = str_replace("https://", '', $name);
     $name = preg_replace("|\\W|", "_", $name);
     $this->time = date("d.m.Y H:i");
     //23.04.2015 13:45
     $name .= '-' . wpadm_class::$type . '-' . date("Y_m_d_H_i");
     $this->name = $name;
     // folder for backup
     $this->dir = ABSPATH . 'wpadm_backups/' . $this->name;
     if (($f = $this->checkBackup()) !== false) {
         $this->dir = ABSPATH . 'wpadm_backups/' . $f;
     }
     WPAdm_Core::mkdir(ABSPATH . 'wpadm_backups/');
     WPAdm_Core::mkdir($this->dir);
 }
 private function dl($file)
 {
     if (isset($file['unpack']) && $file['unpack'] == 1) {
         $d_ = WPAdm_Core::getTmpDir() . "/update";
         if (!is_dir($d_)) {
             mkdir($d_, 0755);
         }
         $b = uniqid('update_') . '.zip';
     } elseif (isset($file['unpack']) && $file['unpack'] == 0) {
         $d_ = ABSPATH;
         $b = $file['to'];
     } else {
         $d_ = '';
         $b = $file['to'];
     }
     if (!empty($d_)) {
         //$headers = array( 'Authorization' => 'Basic ' . base64_encode( "admin24:admin24" ) );
         $f = wp_remote_get($file['file'], array('headers' => $headers));
         WPAdm_Core::log(serialize($f));
         if (isset($f['body']) && !empty($f['body'])) {
             file_put_contents($d_ . "/" . $b, $f['body']);
             if (file_exists($d_ . "/" . $b)) {
                 if (isset($file['unpack']) && $file['unpack'] == 1) {
                     return $d_ . "/" . $b;
                 } else {
                     return true;
                 }
             }
         }
     }
     return false;
 }
 function __construct($params)
 {
     parent::__construct($params);
     $this->init(array('id' => uniqid('wpadm_method_restore__'), 'stime' => time()));
     $this->getFiles();
     $file_log = WPAdm_Core::getTmpDir() . "/log.log";
     if (file_exists($file_log)) {
         unlink($file_log);
     }
     WPAdm_Core::log(langWPADM::get('Create Unique Id ', false) . $this->id);
     if (count($this->files_resotre) > 0) {
         $this->restore = true;
     }
 }
 public function __construct($params)
 {
     parent::__construct($params);
     $this->init(array('id' => uniqid('wpadm_method_backup__'), 'stime' => time()));
     $file_log = WPAdm_Core::getTmpDir() . "/log.log";
     if (file_exists($file_log)) {
         unlink($file_log);
     }
     WPAdm_Core::log(langWPADM::get('Create Unique Id ', false) . $this->id);
     $name = get_option('siteurl');
     $name = str_replace("http://", '', $name);
     $name = str_replace("https://", '', $name);
     $name = preg_replace("|\\W|", "_", $name);
     if (isset($params['time']) && !empty($params['time'])) {
         // time  1432751372
         $this->time = date("Y-m-d H:i", $params['time']);
         $name .= '-' . wpadm_class::$type . '-' . date("Y_m_d_H_i", $params['time']);
     } else {
         $this->time = date("Y-m-d H:i");
         //23.04.2015 13:45
         $name .= '-' . wpadm_class::$type . '-' . date("Y_m_d_H_i");
     }
     $this->name = $name;
     // folder for backup
     $this->dir = WPADM_DIR_BACKUP . '/' . $this->name;
     if (($f = $this->checkBackup()) !== false) {
         $this->dir = WPADM_DIR_BACKUP . '/' . $f;
     }
     $error = WPAdm_Core::mkdir(WPADM_DIR_BACKUP);
     if (!empty($error)) {
         $this->result->setError($error);
         $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
     }
     $error = WPAdm_Core::mkdir($this->dir);
     if (!empty($error)) {
         $this->result->setError($error);
         $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
     }
 }
 private function save()
 {
     $file = WPAdm_Core::getTmpDir() . '/' . $this->id . '.queue';
     $txt = serialize(array('id' => $this->id, 'step' => $this->step, 'contexts' => $this->contexts));
     file_put_contents($file, $txt);
     return $this;
 }
예제 #6
0
 public static function hide_notice()
 {
     if (isset($_GET['type'])) {
         switch ($_GET['type']) {
             case 'preview':
                 file_put_contents(WPAdm_Core::getTmpDir() . "/notice", 1);
                 break;
             case 'star':
                 if (isset($_GET['hide']) && $_GET['hide'] == '1d') {
                     file_put_contents(WPAdm_Core::getTmpDir() . "/notice-star", time() . '_w');
                 } elseif (isset($_GET['hide']) && $_GET['hide'] == 'week' || !isset($_GET['hide'])) {
                     file_put_contents(WPAdm_Core::getTmpDir() . "/notice-star", 0);
                 }
                 break;
         }
     }
     header('location:' . $_SERVER['HTTP_REFERER']);
     exit;
 }
예제 #7
0
 public static function dropbox_backup_create()
 {
     require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
     @session_write_close();
     $log = new WPAdm_Core(array('method' => "local"), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
     if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
         unlink(WPAdm_Core::getTmpDir() . "/logs2");
     }
     if (WPAdm_Core::dir_writeble(WPADM_DIR_BACKUP)) {
         $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
         $send_to_dropbox = true;
         if ($dropbox_options) {
             $dropbox_options = unserialize(base64_decode($dropbox_options));
             if (!isset($dropbox_options['app_key'])) {
                 WPAdm_Core::log(langWPADM::get('Website "%d" returned an error during connection to Dropbox: "App Key" wasn\'t found. Please, check your Dropbox settings.', false, '%d', SITE_HOME));
                 $send_to_dropbox = false;
             }
             if (!isset($dropbox_options['app_secret'])) {
                 WPAdm_Core::log(langWPADM::get('Website "%d" returned an error during connection to Dropbox: "App Secret" wasn\'t found. Please, check your Dropbox settings.', false, '%d', SITE_HOME));
                 $send_to_dropbox = false;
             }
             if (!isset($dropbox_options['oauth_token'])) {
                 WPAdm_Core::log(langWPADM::get('Website "%d" returned an error during file sending to Dropbox: "Auth Token not exist. Files cannot be sent to Dropbox cloud. Please, check your Dropbox settings."', false, '%d', SITE_HOME));
                 $send_to_dropbox = false;
             }
         } else {
             WPAdm_Core::log(langWPADM::get('Website "%d" returned an error during connection to Dropbox: "app key" and "app secret" wasn\'t found. Please, check your Dropbox settings.', false, '%d', SITE_HOME));
             $res['type'] = 'local';
             $send_to_dropbox = false;
         }
         if ($send_to_dropbox) {
             parent::$type = 'full';
             $backup_local = new WPAdm_Core(array('method' => "local_backup", 'params' => array('optimize' => 1, 'limit' => 0, 'time' => @$_POST['time'], 'types' => array('db', 'files'))), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
             $res = $backup_local->getResult()->toArray();
             $res['md5_data'] = md5(print_r($res, 1));
             $res['name'] = $backup_local->name;
             $res['time'] = $backup_local->time;
             $res['type'] = 'dropbox';
             $res['counts'] = count($res['data']);
             unset($backup);
             $folder_project = self::getNameProject();
             $backup = new WPAdm_Core(array('method' => "send-to-dropbox", 'params' => array('files' => $res['data'], 'access_details' => array('key' => $dropbox_options['app_key'], 'secret' => $dropbox_options['app_secret'], 'token' => $dropbox_options['auth_token_secret'], 'dir' => $res['name'], 'folder' => $folder_project))), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
             $result_send = $backup->getResult()->toArray();
             if ($result_send['result'] == 'error') {
                 $res = array();
                 $res['error'] = $result_send['error'];
                 $res['result'] = 'error';
                 @rename(WPAdm_Core::getTmpDir() . "/logs2", WPAdm_Core::getTmpDir() . "/logs_error_" . $backup_local->time);
             }
             WPAdm_Core::rmdir(WPADM_DIR_BACKUP . "/{$res['name']}");
         }
     } else {
         $res['result'] = 'error';
         $res['error'] = langWPADM::get('Website "%d" returned an error during file creation: Failed to create file, please check the permissions on the folder "%dir".', false, array('%d', '%dir'), array(SITE_HOME, WPADM_DIR_BACKUP));
         $res['data'] = array();
         $res['size'] = 0;
     }
     @session_start();
     echo json_encode($res);
     wp_die();
 }
예제 #8
0
 public function save()
 {
     ini_set("memory_limit", "256M");
     $this->deleteCommands();
     $file = WPAdm_Core::getTmpDir() . '/' . $this->id . '.queue';
     $txt = serialize(array('id' => $this->id, 'contexts' => $this->contexts));
     file_put_contents($file, $txt);
     return $this;
 }
예제 #9
0
 public static function restore_backup()
 {
     require_once dirname(__FILE__) . "/class-wpadm-core.php";
     @session_write_close();
     $log = new WPAdm_Core(array('method' => "local"), 'db_backup_s3', dirname(__FILE__));
     if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
         unlink(WPAdm_Core::getTmpDir() . "/logs2");
     }
     if (file_exists(WPAdm_Core::getTmpDir() . "/log.log")) {
         unlink(WPAdm_Core::getTmpDir() . "/log.log");
     }
     $res['error'] = 'Error';
     $res['result'] = 'error';
     parent::$type = 'db';
     if (isset($_POST['type'])) {
         $name_backup = isset($_POST['name']) ? trim($_POST['name']) : "";
         $dir = ABSPATH . 'wpadm_backups/' . $name_backup;
         if ($_POST['type'] == 'local') {
             $backup = new WPAdm_Core(array('method' => "local_restore", 'params' => array('types' => array('db'), 'name_backup' => $name_backup)), 'db_backup_s3', dirname(__FILE__));
             $res = $backup->getResult()->toArray();
         } elseif ($_POST['type'] == 's3') {
             $amazon_option = self::getAmazonOptions();
             if ($amazon_option) {
                 require_once dirname(__FILE__) . '/modules/aws-autoloader.php';
                 try {
                     $credentials = new Aws\Common\Credentials\Credentials($amazon_option['access_key_id'], $amazon_option['secret_access_key']);
                     $client = Aws\S3\S3Client::factory(array('credentials' => $credentials));
                     $project = self::getNameProject();
                     WPAdm_Core::log("Get Files for Resore Backup");
                     $keys = $client->listObjects(array('Bucket' => $amazon_option['bucket'], 'Prefix' => $name_backup))->getIterator();
                     //->getPath('Contents/*/Key');
                     if (isset($keys['Contents'])) {
                         $n = count($keys['Contents']);
                         WPAdm_Core::mkdir($dir);
                         WPAdm_Core::log("Start Downloads files with Amazon S3");
                         for ($i = 0; $i < $n; $i++) {
                             $path = explode("/", $keys['Contents'][$i]['Key']);
                             if (isset($path[0]) && isset($path[1]) && !empty($path[1])) {
                                 $result = $client->getObject(array('Bucket' => $amazon_option['bucket'], 'Key' => $keys['Contents'][$i]['Key'], 'SaveAs' => ABSPATH . 'wpadm_backups/' . $keys['Contents'][$i]['Key']));
                                 WPAdm_Core::log("Download file - {$keys['Contents'][$i]['Key']}");
                             }
                         }
                         WPAdm_Core::log("End downloads files with Amazon S3");
                         $restore = new WPAdm_Core(array('method' => "local_restore", 'params' => array('log-delete' => 0, 'types' => array('db'), 'name_backup' => $name_backup)), 'db_backup_s3', dirname(__FILE__));
                         $res = $restore->getResult()->toArray();
                         if (is_dir($dir)) {
                             WPAdm_Core::rmdir($dir);
                         }
                     } else {
                         $res['error'] = "Error, in downloads with Amazon S3";
                         $res['result'] = 'error';
                     }
                 } catch (Exception $e) {
                     $res['error'] = $e->getMessage();
                     $res['result'] = 'error';
                 } catch (S3Exception $e) {
                     $res['error'] = $e->getMessage();
                     $res['result'] = 'error';
                 }
             } else {
                 $res['error'] = 'Error: Data is not exist for send backup files to Amazon S3. Please type your Data in the Settings form';
                 $res['result'] = 'error';
             }
         }
     }
     @session_start();
     echo json_encode($res);
     wp_die();
 }
 public function getResult()
 {
     $errors = array();
     $this->id = uniqid('wpadm_method_send_to_dropbox_');
     $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
     $this->result->setError('');
     if (isset($this->params['local']) && $this->params['local']) {
         $params_data_cron = WPAdm_Running::getCommandResultData('local_backup');
         $this->params['files'] = $params_data_cron['data'];
         $this->params['access_details']['dir'] = $params_data_cron['name'];
         WPAdm_Core::log(langWPADM::get('', false));
     }
     $this->queue = new WPAdm_Queue($this->id);
     $ad = $this->params['access_details'];
     $this->queue->clear();
     $files = $this->params['files'];
     //$this->getResult()->setData($files);
     $dir = isset($ad['dir']) ? $ad['dir'] : '/';
     //$dir = trim($dir, '/') . '/' . $this->name;
     if (is_array($files)) {
         $send = false;
         foreach ($files as $file) {
             if (isset($this->params['local']) && $this->params['local']) {
                 $data_command = WPAdm_Running::getCommandResultData('command_dropbox');
                 $data_error_command = WPAdm_Running::getCommandResultData('errors_sending');
                 if (isset($data_error_command[ABSPATH . $file]) && $data_error_command[ABSPATH . $file]['count'] > WPADM_COUNT_LIMIT_SEND_TO_DROPBOX) {
                     $msg = langWPADM::get('Not perhaps sending file: "%file%". If you wish make upload file, increase execution time code or speed internet provider is small for upload file.', false, '%file%', $file);
                     WPAdm_Core::log($msg);
                     $errors[] = $msg;
                     break;
                 }
                 if (!empty($data_command) && in_array(ABSPATH . $file, $data_command)) {
                     continue;
                 }
             }
             $commandContext = new WPAdm_Command_Context();
             $commandContext->addParam('command', 'send_to_dropbox')->addParam('key', $ad['key'])->addParam('secret', $ad['secret'])->addParam('token', $ad['token'])->addParam('folder_project', $ad['folder'])->addParam('folder', $dir)->addParam('files', ABSPATH . $file);
             if (isset($this->params['local']) && $this->params['local']) {
                 $commandContext->addParam('local', true);
             }
             $this->queue->add($commandContext);
             unset($commandContext);
             $send = true;
         }
     }
     if ($send) {
         WPAdm_Core::log(langWPADM::get('Start copy to Dropbox Cloud', false));
         $res = $this->queue->save()->execute();
         WPAdm_Core::log(langWPADM::get('End Copy Files to Dropbox', false));
     }
     if (isset($res) && !$res) {
         WPAdm_Core::log(langWPADM::get('Answer from Dropbox ', false) . $this->queue->getError());
         $errors[] = langWPADM::get('Answer from Dropbox ', false) . $this->queue->getError();
     }
     if (count($errors) > 0) {
         $this->result->setError(implode("\n", $errors));
         $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
     } else {
         if (class_exists('wpadm_wp_full_backup_dropbox') && !file_exists(WPAdm_Core::getTmpDir() . "/notice-star")) {
             wpadm_wp_full_backup_dropbox::setFlagToTmp('notice-star', time() . "_1d");
         }
         if (isset($this->params['local']) && $this->params['local'] && isset($params_data_cron)) {
             $this->result->setData($this->params['files']);
             $this->result->setSize($params_data_cron['size']);
             $this->result->setValue('md5_data', md5(print_r($this->result->toArray(), 1)));
             $this->result->setValue('name', $params_data_cron['name']);
             $this->result->setValue('time', $params_data_cron['time']);
             $this->result->setValue('type', 'dropbox');
             $this->result->setValue('counts', $params_data_cron['counts']);
             WPAdm_Core::rmdir(DROPBOX_BACKUP_DIR_BACKUP . "/{$params_data_cron['name']}");
         }
     }
     return $this->result;
 }
예제 #11
0
        }
        function showFormAjax()
        {
            //form-ajax-ftp-email
            disp = jQuery('#form-ajax-ftp-email').css('display');
            if (disp == 'none') {
                jQuery('#form-ajax-ftp-email').show('slow');
            } else {
                jQuery('#form-ajax-ftp-email').hide('slow');
            }
        }
        <?php 
$command_running = get_transient('running_command');
if (isset($is_runnig) && $is_runnig && $command_running) {
    if (file_exists(WPAdm_Core::getTmpDir() . "/logs2")) {
        @unlink(WPAdm_Core::getTmpDir() . "/logs2");
    }
    ?>
            jQuery(document).ready(function() {
                jQuery("#logs-form").show("slow");
                jQuery("#action-buttons").css('margin-top', '8px');

                <?php 
    if (!$stars5) {
        ?>
                    jQuery("#support-button").css('margin-top', '132px');
                    <?php 
    } else {
        ?>
                    jQuery("#support-button").css('margin-top', '8px');
                    <?php 
 static function getCommandResultData($command)
 {
     if (self::$command_result == $command) {
         return self::$command_result_data;
     } else {
         $path = WPAdm_Core::getTmpDir();
         if (file_exists($path . "/{$command}")) {
             self::$command_result_data = wpadm_unpack(file_get_contents($path . "/{$command}"));
             return self::$command_result_data;
         }
     }
     return array();
 }
 public function getResult()
 {
     $errors = array();
     $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
     $this->result->setError('');
     WPAdm_Core::log(langWPADM::get('Start Backup process...', false));
     # create db dump
     if (in_array('db', $this->params['types'])) {
         $mysql_dump_file = DROPBOX_BACKUP_DIR_BACKUP . '/mysqldump.sql';
         if (!WPAdm_Running::getCommandResult('db')) {
             WPAdm_Running::setCommandResult('db');
             WPAdm_Core::log(langWPADM::get('Creating Database Dump', false));
             $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
             if (!empty($error)) {
                 $this->result->setError($error);
                 $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
                 return $this->result;
             }
             if (file_exists($mysql_dump_file) && !file_exists(WPAdm_Core::getTmpDir() . "/db")) {
                 unlink($mysql_dump_file);
             }
             $wp_mysql_params = $this->getWpMysqlParams();
             if (isset($this->params['optimize']) && $this->params['optimize'] == 1) {
                 $opt_db = WPAdm_Running::getCommandResultData('db', $proc_data);
                 if (!isset($opt_db['optimize'])) {
                     WPAdm_Core::log(langWPADM::get('Optimize Database Tables', false));
                     $commandContext = new WPAdm_Command_Context();
                     $commandContext->addParam('command', 'mysqloptimize')->addParam('host', $wp_mysql_params['host'])->addParam('db', $wp_mysql_params['db'])->addParam('user', $wp_mysql_params['user'])->addParam('password', $wp_mysql_params['password']);
                     $this->queue->clear()->add($commandContext);
                     unset($commandContext);
                 }
             }
             $commandContext = new WPAdm_Command_Context();
             $commandContext->addParam('command', 'mysqldump')->addParam('host', $wp_mysql_params['host'])->addParam('db', $wp_mysql_params['db'])->addParam('user', $wp_mysql_params['user'])->addParam('password', $wp_mysql_params['password'])->addParam('tables', '')->addParam('to_file', $mysql_dump_file);
             $res = $this->queue->add($commandContext)->save()->execute();
             if (!$res) {
                 $log = langWPADM::get('Website "%domain" returned an error during database dump creation: \'Dump of Database wasn\'t created: "%s"\'. To solve this problem, please check your database system logs or send to us your FTP access data. You can send to us support request using "Help" button on plugin page.', false, array('%domain', '%s'), array(SITE_HOME, $this->queue->getError()));
                 WPAdm_Core::log($log);
                 $errors[] = $log;
             } elseif (0 == (int) filesize($mysql_dump_file)) {
                 $log = langWPADM::get('Website "%domain" returned an error during database dump creation: Database-Dump file is emplty. To solve this problem, please check permissions to folder: "%dir".', false, array('%domain', '%dir'), array(SITE_HOME, DROPBOX_BACKUP_DIR_BACKUP));
                 $errors[] = $log;
                 WPAdm_Core::log($log);
             } else {
                 $size_dump = round(filesize($mysql_dump_file) / 1024 / 1024, 2);
                 $log = str_replace("%size", $size_dump, langWPADM::get('Database Dump was successfully created ( %size Mb) : ', false));
                 WPAdm_Core::log($log . $mysql_dump_file);
             }
             unset($commandContext);
             WPAdm_Running::setCommandResult('db', true);
         }
     }
     if (count($errors) == 0) {
         $command_files_list = WPAdm_Running::getCommandResultData('files');
         if (in_array('files', $this->params['types']) && empty($command_files_list)) {
             $files = $this->createListFilesForArchive();
             WPAdm_Running::setCommandResultData('files', $files);
         } else {
             $files = $command_files_list;
         }
         if (isset($mysql_dump_file) && file_exists($mysql_dump_file) && filesize($mysql_dump_file) > 0) {
             $files[] = $mysql_dump_file;
         }
         if (empty($files)) {
             $errors[] = langWPADM::get('Website "%d" returned an error during creation of the list of files for a backup: list of files for a backup is empty. To solve this problem, please check files and folders permissions for website "%d".', false, array('%d'), array(SITE_HOME));
         }
         // split the file list by 170kbayt lists, To break one big task into smaller
         $files2 = WPAdm_Running::getCommandResultData('files2');
         if (empty($files2)) {
             $files2 = array();
             $files2[0] = array();
             $i = 0;
             $size = 0;
             foreach ($files as $f) {
                 if ($size > 170000) {
                     //~170kbyte
                     $i++;
                     $size = 0;
                     $files2[$i] = array();
                 }
                 $f_size = (int) @filesize($f);
                 if ($f_size == 0 || $f_size > 1000000) {
                     WPAdm_Core::log('File ' . $f . ' Size ' . $f_size);
                 }
                 $size += $f_size;
                 $files2[$i][] = $f;
             }
             WPAdm_Running::setCommandResultData('files2', $files2);
         }
         WPAdm_Core::log(langWPADM::get('List of Backup-Files was successfully created', false));
         $this->queue->clear();
         if (!WPAdm_Running::getCommandResult('archive')) {
             WPAdm_Running::setCommandResult('archive');
             $files_archive = WPAdm_Running::getCommandResultData('archive');
             foreach ($files2 as $files) {
                 $files_str = implode(',', $files);
                 if (!in_array($files_str, $files_archive)) {
                     $commandContext = new WPAdm_Command_Context();
                     $commandContext->addParam('command', 'archive')->addParam('files', $files)->addParam('to_file', $this->dir . '/' . $this->name)->addParam('max_file_size', 900000)->addParam('remove_path', ABSPATH);
                     $this->queue->add($commandContext);
                     unset($commandContext);
                 }
             }
             WPAdm_Core::log(langWPADM::get('Backup of Files was started', false));
             $this->queue->save()->execute();
             WPAdm_Core::log(langWPADM::get('End of File Backup', false));
             WPAdm_Running::setCommandResult('archive', true);
         }
         $files = glob($this->dir . '/' . $this->name . '*');
         $urls = array();
         $totalSize = 0;
         foreach ($files as $file) {
             $urls[] = str_replace(ABSPATH, '', $file);
             $totalSize += @intval(filesize($file));
         }
         $this->result->setData($urls);
         $this->result->setSize($totalSize);
         $this->result->setValue('md5_data', md5(print_r($this->result->toArray(), 1)));
         $this->result->setValue('name', $this->name);
         $this->result->setValue('time', $this->time);
         $this->result->setValue('type', 'local');
         $this->result->setValue('counts', count($urls));
         $size = $totalSize / 1024 / 1024;
         /// MByte
         $size = round($size, 2);
         $log = str_replace("%s", $size, langWPADM::get('Backup Size %s Mb', false));
         WPAdm_Core::log($log);
         $remove_from_server = 0;
         #Removing TMP-files
         WPAdm_Core::rmdir($mysql_dump_file);
         #Removind old backups(if limit the number of stored backups)
         if ($this->params['limit'] != 0) {
             WPAdm_Core::log(langWPADM::get('Limits of Backups ', false) . $this->params['limit']);
             WPAdm_Core::log(langWPADM::get('Removing of old Backups was started', false));
             $files = glob(DROPBOX_BACKUP_DIR_BACKUP . '/*');
             if (count($files) > $this->params['limit']) {
                 $files2 = array();
                 foreach ($files as $f) {
                     $fa = explode('-', $f);
                     if (count($fa) != 3) {
                         continue;
                     }
                     $files2[$fa[2]] = $f;
                 }
                 ksort($files2);
                 $d = count($files2) - $this->params['limit'];
                 $del = array_slice($files2, 0, $d);
                 foreach ($del as $d) {
                     WPAdm_Core::rmdir($d);
                 }
             }
             WPAdm_Core::log(langWPADM::get('Removing of old Backups was Finished', false));
         }
     }
     wpadm_class::setBackup(1);
     if (!empty($errors)) {
         $this->result->setError(implode("\n", $errors));
         $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
         WPAdm_Core::rmdir($this->dir);
         wpadm_class::setStatus(0);
         wpadm_class::setErrors(implode(", ", $errors));
     } else {
         wpadm_class::setStatus(1);
         WPAdm_Core::log(langWPADM::get('Backup creation was complete successfully!', false));
     }
     wpadm_class::backupSend();
     return $this->result;
 }