Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $command_save = 'mysqldump --defaults-file='.$config_file.' '.$database_name.' > '.$db_dump_file;
- exec($command_save, $output = array(), $res_save);
- $server = "localhost";
- $username = "user";
- $password = "pass";
- $connection = ssh2_connect($server, 22);
- if (ssh2_auth_password($connection, $username, $password)) {
- $command = 'drush up --security-only -y';
- // Run a command that will probably write to stderr (unless you have a folder named /hom)
- $stream = ssh2_exec($connection, $command);
- $errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
- // Enable blocking for both streams
- stream_set_blocking($errorStream, true);
- stream_set_blocking($stream, true);
- // Whichever of the two below commands is listed first will receive its appropriate output. The second command receives nothing
- $result = stream_get_contents($stream);
- $result_error = stream_get_contents($errorStream);
- // Close the streams
- fclose($errorStream);
- fclose($stream);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement