Example #1
0
     if (!$upload) {
         die('FTP upload Fehler!<br />');
     }
     file_get_contents($_REQUEST["shopUrl"] . "/" . $sputnikDrone);
     ftp_delete($connection, $_REQUEST["ftpPath"] . "/" . $sputnikDrone);
     echo "MySQL dump ausgeführt, importiere Datenbank ...<br />";
 }
 if ($_REQUEST["spaceStep"] == 3) {
     $timestamp = time();
     $connection = ftp_connect($_REQUEST["ftpServer"]);
     $login = ftp_login($connection, $_REQUEST["ftpUser"], $_REQUEST["ftpPass"]);
     $remoteFile = $_REQUEST["ftpPath"] . "/tmp/backup-" . date('dmY', $timestamp) . ".sql";
     ftp_get($connection, dirname(__FILE__) . "/backup-" . date('dmY', $timestamp) . ".sql", $remoteFile, FTP_BINARY);
     ftp_delete($connection, $remoteFile);
     ftp_close($connection);
     importDb($_REQUEST["user"], $_REQUEST["pass"], $_REQUEST["host"], $_REQUEST["name"], dirname(__FILE__) . "/backup-" . date('dmY', $timestamp) . ".sql");
     unlink(dirname(__FILE__) . "/backup-" . date('dmY', $timestamp) . ".sql");
     echo "Hole Shopdaten vom Remote Server<br />";
 }
 if ($_REQUEST["spaceStep"] == 4) {
     $connection = ftp_connect($_REQUEST["ftpServer"]);
     $login = ftp_login($connection, $_REQUEST["ftpUser"], $_REQUEST["ftpPass"]);
     ftp_chdir($connection, $_REQUEST["ftpPath"]);
     recDownload(dirname(__FILE__), "./", $connection);
     ftp_close($connection);
     echo "Shopdaten übertragen, räume auf<br />";
 }
 if ($_REQUEST["spaceStep"] == 5) {
     rrmdir(dirname(__FILE__) . "/tmp");
     mkdir(dirname(__FILE__) . "/tmp", 0777);
     //mod config
Example #2
0
echo "Correct connection in all databases...<br>";
echo "Export DB 'master'...<br>";
backupDb($dbData, 'master');
// Export db 'master'
echo "Importando DB a 'stage'...<br>";
replaceUrl($dbData, 'master', 'stage');
// Change the url
echo "Replace Url'...<br>";
emptyDb($dbData, 'stage');
importDb($dbData, 'stage');
echo "Importando DB a 'dev'...<br>";
replaceUrl($dbData, 'stage', 'dev');
// Change the url
echo "Replace Url'...<br>";
emptyDb($dbData, 'dev');
importDb($dbData, 'dev');
echo "Elimando archivo SQL original...<br>";
unlink($sqlOriginal . '.sql');
echo "Done!...<br>";
function tryConnections($dbData)
{
    foreach ($dbData as $key => $data) {
        try {
            $dbh = new PDO('mysql:host=' . $data['host'] . ';port=' . $data['port'] . ';dbname=' . $data['db'], $data['user'], $data['pass']);
            echo "SUCCESS - DB:" . $key . "<br>";
        } catch (PDOException $e) {
            print "ERROR!!! - DB:{$key} : " . $e->getMessage() . "\n";
            die;
        }
    }
}