Merge branch 'ent-3882-revision-politicas' into 'develop'

Función auxiliar políticas

See merge request artica/pandorafms!2354

Former-commit-id: de065e2ef71e864862a4b2a93419cdf9285f092c
This commit is contained in:
Daniel Rodriguez 2019-04-22 16:27:51 +02:00
commit 3a68e1bb77

View File

@ -120,6 +120,7 @@ our @EXPORT = qw(
month_have_days
translate_obj
valid_regex
read_file
set_file_permissions
uri_encode
check_server_threads
@ -330,6 +331,28 @@ my @ServerThreads;
# Keep threads running.
our $THRRUN :shared = 1;
##########################################################################
## Reads a file and returns entire content or undef if error.
##########################################################################
sub read_file {
my $path = shift;
my $_FILE;
if( !open($_FILE, "<", $path) ) {
# failed to open, return undef
return undef;
}
# Slurp configuration file content.
my $content = do { local $/; <$_FILE> };
# Close file
close($_FILE);
return $content;
}
###############################################################################
# Sets user:group owner for the given file
###############################################################################