• Resolved ronando51

    (@ronando51)


    I installed last version of ez_sqlreport end i try to backup DB.
    in directory i do not find backup file.

    i run with make new back and click butto ‘Run’

    what is my mistake?
    Thanks Fernando

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Eli

    (@scheeeli)

    When you ran the backup did it give any errors or did it say “0 Errors”?

    In what directory are you looking for backups?

    Does the plugin show your new backup listed below the Run button?

    Thread Starter ronando51

    (@ronando51)

    i use default on the screen.
    after click on run button, no message received and under ‘database maintenance’
    there is nothing exposed.

    how can i post the screen shot to show? i made e .doc to send.
    thanks
    Fernando

    Plugin Author Eli

    (@scheeeli)

    copy screenshot image and paste at https://snag.gy/
    then post the link here

    Thread Starter ronando51

    (@ronando51)

    this is the start situation: https://snag.gy/xtoP7W.jpg
    this is after click run button : https://snag.gy/5oCu7c.jpg

    if you need some other information please ask me!

    Fernando

    p.s. i use wordpres 4.6.1 in local machine.

    Plugin Author Eli

    (@scheeeli)

    I see, so it seems to be crashing and there is no output from the backup job.

    You could check your error_log files to see what is causing the crash.

    You could also try selecting the PHP method for backup since the auto method is not working.

    I see that you are on a Windows server so I can’t say off-hand what might be causing this issue, but I am curious to figure it out and I would like to fix it if you can help me find the problem.

    Thread Starter ronando51

    (@ronando51)

    this is le last activities of 3/jan/2017 (tests)
    i break some line but i padding under the start line.
    https://snag.gy/1i4fNg.jpg
    Hope this help you.

    Fernando

    • This reply was modified 8 years, 1 month ago by ronando51.
    Thread Starter ronando51

    (@ronando51)

    Hi Eli, as suggested i run with PHP choice. the situation remain the same!

    Fernando

    Plugin Author Eli

    (@scheeeli)

    Yes, the problem is that the version of PHP on your server does not have MYSQL functions installed so it is probably so new that you only have MYSQLi installed. What kind of errors do you get in your error_log file if you specify the Command Line (mysqldump) method?

    Thread Starter ronando51

    (@ronando51)

    this is the error log.

    Fernando

    https://snag.gy/szw8TD.jpg

    Plugin Author Eli

    (@scheeeli)

    Ah, I can see that is still not going to work if you don’t have MYSQL functions installed on your server.

    Try replacing the ELISQLREPORTS_make_Backup function with this:

    function ELISQLREPORTS_make_Backup($date_format, $backup_type = “manual”, $db_name = DB_NAME, $db_host = DB_HOST, $db_user = DB_USER, $db_password = DB_PASSWORD) {
    global $wpdb, $wp_version;
    ELISQLREPORTS_set_backupdir();
    $db_date = date($date_format);
    $db_port = ”;
    if (strpos($db_host, ‘:’)) {
    list($db_host, $db_port) = explode(‘:’, $db_host, 2);
    if (is_numeric($db_port))
    $db_port = ‘ –port=’.escapeshellarg($db_port);
    else
    $db_port = ‘ –socket=’.escapeshellarg($db_port);
    }
    $db_port .= ‘ ‘;
    $subject = “$backup_type.$db_name.$db_host.sql”;
    $filename = “z.$db_date.$subject”;
    $backup_file = trailingslashit($GLOBALS[“ELISQLREPORTS”][“settings_array”][“backup_dir”]).$filename;
    $content = ”;
    $uid = md5(time());
    $message = “\r\n–$uid\r\nContent-type: text/html; charset=\”iso-8859-1\”\r\nContent-Transfer-Encoding: 7bit\r\n\r\n”;
    if (isset($GLOBALS[“ELISQLREPORTS”][“settings_array”][“backup_method”]) && $GLOBALS[“ELISQLREPORTS”][“settings_array”][“backup_method”] == 1) {
    $mysqlbasedir = $wpdb->get_row(“SHOW VARIABLES LIKE ‘basedir'”);
    if(substr(PHP_OS,0,3) == ‘WIN’)
    $backup_command = ‘”‘.(isset($mysqlbasedir->Value)?trailingslashit(str_replace(‘\\’, ‘/’, $mysqlbasedir->Value)).’bin/’:”).’mysqldump.exe”‘;
    else
    $backup_command = (isset($mysqlbasedir->Value)&&is_file(trailingslashit($mysqlbasedir->Value).’bin/mysqldump’)?trailingslashit($mysqlbasedir->Value).’bin/’:”).’mysqldump’;
    $backup_command .= ‘ –user=’.escapeshellarg($db_user).’ –password=’.escapeshellarg($db_password).’ –add-drop-table –skip-lock-tables –host=’.escapeshellarg($db_host).$db_port.escapeshellarg($db_name);
    if (isset($GLOBALS[“ELISQLREPORTS”][“settings_array”][“compress_backup”]) && $GLOBALS[“ELISQLREPORTS”][“settings_array”][“compress_backup”]) {
    $backup_command .= ‘ | gzip > ‘;
    $backup_file .= ‘.gz’;
    } else
    $backup_command .= ‘ -r ‘;
    passthru($backup_command.escapeshellarg($backup_file), $errors);
    $return = “Command Line Backup of $subject returned $errors error”.($error!=1?’s’:”);
    } elseif ($GLOBALS[“ELISQLREPORTS”][“backup_file”] = fopen($backup_file, ‘w’)) {
    if (mysql_connect($db_host, $db_user, $db_password)) {
    if (mysql_select_db($db_name)) {
    $server = strtolower(isset($_SERVER[“HTTP_HOST”])?$_SERVER[“HTTP_HOST”]:(isset($_SERVER[“SERVER_NAME”])?$_SERVER[“SERVER_NAME”]:$_SERVER[“SERVER_ADDR”]));
    $ip = explode(“$server”, get_option(“siteurl”).”$server”);
    if (!(count($ip) == 3 && strlen(trim($ip[1], ” \t\r\n/”)) > 0))
    $ip[1] = $_SERVER[“SERVER_ADDR”];
    fwrite($GLOBALS[“ELISQLREPORTS”][“backup_file”], ‘– EZ SQL Backup ‘.ELISQLREPORTS_VERSION.’, for ‘.$server.’ (‘.trim($ip[1]).’)

    — Host: ‘.$db_host.’ Database: ‘.$db_name.’
    — ——————————————————
    — WordPress version ‘.$wp_version.’ ‘.$db_date.’

    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
    /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
    /*!40103 SET TIME_ZONE=\’+00:00\’ */;
    /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
    /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
    /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=\’NO_AUTO_VALUE_ON_ZERO\’ */;
    /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;’);
    $sql = “show full tables where Table_Type = ‘BASE TABLE'”;
    $result = mysql_query($sql);
    $errors = “”;
    if (mysql_errno())
    $errors .= “/* SQL ERROR: “.mysql_error().” */\n\n/*$sql*/\n\n”;
    else {
    while ($row = mysql_fetch_row($result)) {
    $errors .= ELISQLREPORTS_get_structure($row[0]);
    if (!is_numeric($rows = ELISQLREPORTS_get_data($row[0])))
    $errors .= $rows;
    }
    mysql_free_result($result);
    $sql = “show full tables where Table_Type = ‘VIEW'”;
    if ($result = mysql_query($sql)) {
    while ($row = mysql_fetch_row($result))
    $errors .= ELISQLREPORTS_get_structure($row[0], “View”);
    mysql_free_result($result);
    }
    }
    fclose($GLOBALS[“ELISQLREPORTS”][“backup_file”]);
    $return = “Backup: $subject Saved”;
    $message .= “A database backup was saved on “.(get_option(“blogname”)).”.\r\n<p>

    $errors

    <p>”;
    if (isset($GLOBALS[“ELISQLREPORTS”][“settings_array”][“compress_backup”]) && $GLOBALS[“ELISQLREPORTS”][“settings_array”][“compress_backup”]) {
    $zip = new ZipArchive();
    if ($zip->open($backup_file.’.zip’, ZIPARCHIVE::CREATE) === true) {
    $zip->addFile($backup_file, $filename);
    $zip->close();
    }
    if (is_file($backup_file) && is_file($backup_file).’.zip’) {
    if (@unlink($backup_file))
    $backup_file .= ‘.zip’;
    } else
    $return .= ” but not Zipped”;
    }
    } else
    $return = “Failed to save backup!”;
    if (isset($GLOBALS[“ELISQLREPORTS”][“settings_array”][$backup_type.”_backup”]) && $GLOBALS[“ELISQLREPORTS”][“settings_array”][$backup_type.”_backup”] > 0) {
    $sql_files = array();
    if ($handle = opendir($GLOBALS[“ELISQLREPORTS”][“settings_array”][“backup_dir”])) {
    while (false !== ($entry = readdir($handle)))
    if (is_file(trailingslashit($GLOBALS[“ELISQLREPORTS”][“settings_array”][“backup_dir”]).$entry))
    if (strpos($entry, $subject))
    $sql_files[] = “$entry”;
    closedir($handle);
    rsort($sql_files);
    }
    $del=0;
    while (count($sql_files)>$GLOBALS[“ELISQLREPORTS”][“settings_array”][$backup_type.”_backup”])
    if (@unlink(trailingslashit($GLOBALS[“ELISQLREPORTS”][“settings_array”][“backup_dir”]).array_pop($sql_files)))
    $del++;
    $message .= “\r\nNumber of archives:

    • Deleted: $del
    • Kept: “.count($sql_files).”
    • <p>”;
      }
      if (strlen($GLOBALS[“ELISQLREPORTS”][“settings_array”][“backup_email”])) {
      $headers = ‘From: ‘.get_option(“admin_email”).”\r\n”;
      $headers .= “MIME-Version: 1.0\r\n”;
      $headers .= “Content-Type: multipart/mixed; boundary=\”$uid\”\r\n”;
      $upload = wp_upload_dir();
      if (file_exists($backup_file)) {
      $file_size = filesize($backup_file);
      $handle = fopen($backup_file, “rb”);
      $content .= “The backup has been attached to this email for your convenience.\r\n\r\n–$uid\r\nContent-Type: application/octet-stream; name=\””.basename($backup_file).”\”\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\””.basename($backup_file).”\”\r\n\r\n”.chunk_split(base64_encode(fread($handle, $file_size)), 70, “\r\n”);
      fclose($handle);
      }
      if (mail($GLOBALS[“ELISQLREPORTS”][“settings_array”][“backup_email”], $return, $message.$content.”\r\n\r\n–$uid–“, $headers))
      $return .= ” and Sent!”;
      else
      mail($GLOBALS[“ELISQLREPORTS”][“settings_array”][“backup_email”], $return, $message.strlen($content).” bytes is too large to attach but you can download it here.\r\n\r\n–$uid–“, $headers);
      } else
      $return = ‘Database Selection ERROR: ‘.mysql_error();
      } else
      $return = ‘Database Connection ERROR: ‘.mysql_error();
      }
      return $return;
      }

    ..and next time you post the contents of your error_log you don’t need to make a screenshot, just paste the text into you post so I can see all of it ??

    Plugin Author Eli

    (@scheeeli)

    Don’t use that last code I posted, the WP forum messed up the formatting and replaced characters. I will work on a fix that you can download…

    Thread Starter ronando51

    (@ronando51)

    thanks Heli for your support.
    i tested on internet and backup funtions.

    IS It in plugin a restore function (also in future)?

    Thanks again
    Fernando

    Plugin Author Eli

    (@scheeeli)

    I just released a new version 4.16.38 that should fix those issues you were having and also some other compatibility issues with newer versions of WordPress and PHP7 ??

    Please let me know if you have any more problems with it.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘backup do not work’ is closed to new replies.