Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@martinseener martinseener commented May 13, 2014

@mrhaw

This comment has been minimized.

Copy link

@mrhaw 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