Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <?php
  2.  
  3. error_reporting(E_ALL ^ E_NOTICE);
  4. ini_set('display_errors', 1);
  5. ini_set('memory_limit', '512M');
  6.  
  7. // Get Magento Application
  8. require_once 'app/Mage.php';
  9. Mage::app('default');
  10.  
  11. // get Magento config
  12. $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
  13.  
  14. $dbinfo = array(
  15. 'host' => $config->host,
  16. 'user' => $config->username,
  17. 'pass' => $config->password,
  18. 'dbname' => $config->dbname
  19. );
  20.  
  21.  
  22. // Database Config
  23. $db_host = $dbinfo[“host”];
  24. $db_user = $dbinfo[“user”];
  25. $db_pass = $dbinfo[“pass”];
  26. $db_name = $dbinfo[“dbname”];
  27.  
  28.  
  29.  
  30. // filename
  31. $backup_file = $db_name ."-". date("Y-m-d-H-i-s") . ".gz";
  32.  
  33. $command = "mysqldump --database " . $db_name . " -u ". $db_user . " -p'". $db_pass . "' | gzip > " . $backup_file;
  34.  
  35. echo 'command executing is ' . $command . '<br/>' ;
  36.  
  37. $output = shell_exec($command);
  38.  
  39. echo 'Finished!<br/>' ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement