Xfer.pm (BackupPC-4.3.2) | : | Xfer.pm (BackupPC-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
# This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | |||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# GNU General Public License for more details. | # GNU General Public License for more details. | |||
# | # | |||
# You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | |||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
# | # | |||
# Version 4.3.2, released 17 Feb 2020. | # Version 4.4.0, released 20 Jun 2020. | |||
# | # | |||
# See http://backuppc.sourceforge.net. | # See http://backuppc.sourceforge.net. | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
package BackupPC::Xfer; | package BackupPC::Xfer; | |||
use strict; | use strict; | |||
use Encode qw/from_to encode/; | use Encode qw/from_to encode/; | |||
skipping to change at line 61 | skipping to change at line 61 | |||
sub create | sub create | |||
{ | { | |||
my($protocol, $bpc, $args) = @_; | my($protocol, $bpc, $args) = @_; | |||
my $xfer; | my $xfer; | |||
$errStr = undef; | $errStr = undef; | |||
if ( $protocol eq 'archive' ) { | if ( $protocol eq 'archive' ) { | |||
$xfer = BackupPC::Xfer::Archive->new( $bpc, $args ); | $xfer = BackupPC::Xfer::Archive->new($bpc, $args); | |||
$errStr = BackupPC::Xfer::Archive::errStr() if ( !defined($xfer) ); | $errStr = BackupPC::Xfer::Archive::errStr() if ( !defined($xfer) ); | |||
return $xfer; | return $xfer; | |||
} elsif ( $protocol eq 'ftp' ) { | } elsif ( $protocol eq 'ftp' ) { | |||
$xfer = BackupPC::Xfer::Ftp->new( $bpc, $args ); | $xfer = BackupPC::Xfer::Ftp->new($bpc, $args); | |||
$errStr = BackupPC::Xfer::Ftp::errStr() if ( !defined($xfer) ); | $errStr = BackupPC::Xfer::Ftp::errStr() if ( !defined($xfer) ); | |||
return $xfer; | return $xfer; | |||
} elsif ( $protocol eq 'rsync' || $protocol eq 'rsyncd' ) { | } elsif ( $protocol eq 'rsync' || $protocol eq 'rsyncd' ) { | |||
$xfer = BackupPC::Xfer::Rsync->new( $bpc, $args ); | $xfer = BackupPC::Xfer::Rsync->new($bpc, $args); | |||
$errStr = BackupPC::Xfer::Rsync::errStr() if ( !defined($xfer) ); | $errStr = BackupPC::Xfer::Rsync::errStr() if ( !defined($xfer) ); | |||
return $xfer; | return $xfer; | |||
} elsif ( $protocol eq 'smb' ) { | } elsif ( $protocol eq 'smb' ) { | |||
$xfer = BackupPC::Xfer::Smb->new( $bpc, $args ); | $xfer = BackupPC::Xfer::Smb->new($bpc, $args); | |||
$errStr = BackupPC::Xfer::Smb::errStr() if ( !defined($xfer) ); | $errStr = BackupPC::Xfer::Smb::errStr() if ( !defined($xfer) ); | |||
return $xfer; | return $xfer; | |||
} elsif ( $protocol eq 'tar' ) { | } elsif ( $protocol eq 'tar' ) { | |||
$xfer = BackupPC::Xfer::Tar->new( $bpc, $args ); | $xfer = BackupPC::Xfer::Tar->new($bpc, $args); | |||
$errStr = BackupPC::Xfer::Tar::errStr() if ( !defined($xfer) ); | $errStr = BackupPC::Xfer::Tar::errStr() if ( !defined($xfer) ); | |||
return $xfer; | return $xfer; | |||
} elsif ( $protocol eq 'protocol') { | } elsif ( $protocol eq 'protocol' ) { | |||
$xfer = BackupPC::Xfer::Protocol->new( $bpc, $args ); | $xfer = BackupPC::Xfer::Protocol->new($bpc, $args); | |||
$errStr = BackupPC::Xfer::Protocol::errStr() if ( !defined($xfer) ); | $errStr = BackupPC::Xfer::Protocol::errStr() if ( !defined($xfer) ); | |||
return $xfer; | return $xfer; | |||
} else { | } else { | |||
$xfer = undef; | $xfer = undef; | |||
$errStr = "$protocol is not a supported protocol."; | $errStr = "$protocol is not a supported protocol."; | |||
return $xfer; | return $xfer; | |||
} | } | |||
} | } | |||
# | # | |||
# getShareNames() loads the correct shares dependent on the | # getShareNames() loads the correct shares dependent on the | |||
# transfer type. | # transfer type. | |||
# | # | |||
sub getShareNames | sub getShareNames | |||
{ | { | |||
my($conf) = @_; | my($conf) = @_; | |||
skipping to change at line 146 | skipping to change at line 146 | |||
{ | { | |||
my($conf) = @_; | my($conf) = @_; | |||
my $restoreCmd; | my $restoreCmd; | |||
if ( $conf->{XferMethod} eq "archive" ) { | if ( $conf->{XferMethod} eq "archive" ) { | |||
$restoreCmd = undef; | $restoreCmd = undef; | |||
} elsif ( $conf->{XferMethod} eq "ftp" ) { | } elsif ( $conf->{XferMethod} eq "ftp" ) { | |||
$restoreCmd = undef; | $restoreCmd = undef; | |||
} elsif ( $conf->{XferMethod} eq "rsync" | } elsif ( $conf->{XferMethod} eq "rsync" || $conf->{XferMethod} eq "rsyncd" | |||
|| $conf->{XferMethod} eq "rsyncd" ) { | ) { | |||
$restoreCmd = $conf->{RsyncRestoreArgs}; | $restoreCmd = $conf->{RsyncRestoreArgs}; | |||
} elsif ( $conf->{XferMethod} eq "tar" ) { | } elsif ( $conf->{XferMethod} eq "tar" ) { | |||
$restoreCmd = $conf->{TarClientRestoreCmd}; | $restoreCmd = $conf->{TarClientRestoreCmd}; | |||
} elsif ( $conf->{XferMethod} eq "smb" ) { | } elsif ( $conf->{XferMethod} eq "smb" ) { | |||
$restoreCmd = $conf->{SmbClientRestoreCmd}; | $restoreCmd = $conf->{SmbClientRestoreCmd}; | |||
} else { | } else { | |||
skipping to change at line 178 | skipping to change at line 177 | |||
my($conf) = @_; | my($conf) = @_; | |||
my $restoreCmd; | my $restoreCmd; | |||
if ( $conf->{XferMethod} eq "archive" ) { | if ( $conf->{XferMethod} eq "archive" ) { | |||
return; | return; | |||
} elsif ( $conf->{XferMethod} eq "ftp" ) { | } elsif ( $conf->{XferMethod} eq "ftp" ) { | |||
return; | return; | |||
} elsif ( $conf->{XferMethod} eq "rsync" | } elsif ( $conf->{XferMethod} eq "rsync" | |||
|| $conf->{XferMethod} eq "rsyncd" | || $conf->{XferMethod} eq "rsyncd" | |||
|| $conf->{XferMethod} eq "tar" | || $conf->{XferMethod} eq "tar" | |||
|| $conf->{XferMethod} eq "smb" ) { | || $conf->{XferMethod} eq "smb" ) { | |||
$restoreCmd = getRestoreCmd( $conf ); | $restoreCmd = getRestoreCmd($conf); | |||
return !!( | return !!( | |||
ref $restoreCmd eq "ARRAY" | ref $restoreCmd eq "ARRAY" | |||
? @$restoreCmd | ? @$restoreCmd | |||
: $restoreCmd ne "" | : $restoreCmd ne "" | |||
); | ); | |||
} else { | } else { | |||
return; | return; | |||
} | } | |||
} | } | |||
End of changes. 12 change blocks. | ||||
16 lines changed or deleted | 16 lines changed or added |