Created
May 13, 2014 10:04
-
-
Save martinseener/7a08e22c4b091e9286a7 to your computer and use it in GitHub Desktop.
MODX Revolution Quick File and DB Backup PHP-CLI Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"; | |
} | |
?> |
What does the "type type" mean? :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
proudly copied from http://de.modx.com/blog/2014/03/modx-revolution-updates-vereinfachen and modified a bit