mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +02:00
Better code in file_list_get().
This commit is contained in:
parent
23df43e781
commit
8ae6c2719d
@ -522,12 +522,6 @@ backup_init
|
|||||||
config_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_THREAD_TIMEOUT)
|
config_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_THREAD_TIMEOUT)
|
||||||
);
|
);
|
||||||
|
|
||||||
####################################################################################################################################
|
|
||||||
# DEBUG
|
|
||||||
####################################################################################################################################
|
|
||||||
#print "out: " . ($oFile->file_list_get(PATH_BACKUP_ARCHIVE, "0000000100000000", ".*", 'asc'))[0];
|
|
||||||
#exit 0;
|
|
||||||
|
|
||||||
####################################################################################################################################
|
####################################################################################################################################
|
||||||
# BACKUP
|
# BACKUP
|
||||||
####################################################################################################################################
|
####################################################################################################################################
|
||||||
|
@ -767,7 +767,7 @@ sub file_list_get
|
|||||||
|
|
||||||
# Builds the file list command
|
# Builds the file list command
|
||||||
# my $strCommand = "ls ${strPathList} | egrep \"$strExpression\" 2> /dev/null";
|
# my $strCommand = "ls ${strPathList} | egrep \"$strExpression\" 2> /dev/null";
|
||||||
my $strCommand = "ls ${strPathList} | cat 2> /dev/null";
|
my $strCommand = "ls -1 ${strPathList} 2> /dev/null";
|
||||||
|
|
||||||
# Run the file list command
|
# Run the file list command
|
||||||
my $strFileList = "";
|
my $strFileList = "";
|
||||||
@ -787,15 +787,15 @@ sub file_list_get
|
|||||||
$strFileList = capture($strCommand) or confess("error in ${strCommand}");
|
$strFileList = capture($strCommand) or confess("error in ${strCommand}");
|
||||||
}
|
}
|
||||||
|
|
||||||
# If nothing was found return undef
|
|
||||||
if ($strFileList eq "")
|
|
||||||
{
|
|
||||||
return undef;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Split the files into an array
|
# Split the files into an array
|
||||||
my @stryFileList = grep(/$strExpression/i, split(/\n/, $strFileList));
|
my @stryFileList = grep(/$strExpression/i, split(/\n/, $strFileList));
|
||||||
|
|
||||||
|
# If nothing was found return undef
|
||||||
|
# if (undef(@stryFileList) || scalar @stryFileList == 0)
|
||||||
|
# {
|
||||||
|
# return undef;
|
||||||
|
# }
|
||||||
|
|
||||||
# Return the array in reverse order if specified
|
# Return the array in reverse order if specified
|
||||||
if (defined($strSortOrder) && $strSortOrder eq "reverse")
|
if (defined($strSortOrder) && $strSortOrder eq "reverse")
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user