Skip to content

Instantly share code, notes, and snippets.

@martinseener
Created May 13, 2014 10:04
Show Gist options
  • Save martinseener/7a08e22c4b091e9286a7 to your computer and use it in GitHub Desktop.
Save martinseener/7a08e22c4b091e9286a7 to your computer and use it in GitHub Desktop.
MODX Revolution Quick File and DB Backup PHP-CLI Script
<?php
if ( !shell_exec("type type")) { echo "Weak your PHP powers are, Luke."; die; }
$dir = "../backup"; /* Verzeichnis außerhalb des Webroot */
$configFile = "./core/config/config.inc.php";
if (file_exists($configFile)) {
include($configFile);
$date = date("Ymd-His");
$targetSql = "$dir/{$date}_mysql.sql";
$targetTar = "$dir/{$date}_files.tar";
system("mkdir $dir");
system("mysqldump --host=$database_server --user=$database_user --password=$database_password --databases $dbase > {$targetSql}");
system("tar cf {$targetTar} ./");
echo "Backup done. Now run 'php modx-revolution-upgrade.php";
}
?>
@martinseener
Copy link
Author

@mrhaw
Copy link

mrhaw commented Aug 30, 2016

What does the "type type" mean? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment