From 7f57f2a4c4b0bceb0a28865bd25f5404edc422fd Mon Sep 17 00:00:00 2001
From: Quentin Garnier <qgarnier@merethis.com>
Date: Fri, 12 Sep 2014 14:40:24 +0200
Subject: [PATCH] Refs #5812 Typo

---
 apps/protocols/ftp/mode/filescount.pm | 54 +++++++++++++--------------
 apps/protocols/ftp/plugin.pm          |  8 ++--
 2 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/apps/protocols/ftp/mode/filescount.pm b/apps/protocols/ftp/mode/filescount.pm
index 65f87e67c..c726441ee 100644
--- a/apps/protocols/ftp/mode/filescount.pm
+++ b/apps/protocols/ftp/mode/filescount.pm
@@ -29,7 +29,7 @@
 # do not wish to do so, delete this exception statement from your version.
 # 
 # For more information : contact@centreon.com
-# Author : Quentin Garnier <qgarnier@merethis.com>
+# Author : Simon Bomm <sbomm@merethis.com>
 #
 ####################################################################################
 
@@ -103,11 +103,11 @@ sub run {
     @array = @$ref_array;
     
     if (defined($self->{option_results}->{recursive})) {
-            while ($flag == 1) {
-                ($ref_array, $cpt, $flag) = $self->countFiles(@array);
-                $globalCount = $globalCount + $cpt;
-                @array = @$ref_array;
-            }
+        while ($flag == 1) {
+            ($ref_array, $cpt, $flag) = $self->countFiles(@array);
+            $globalCount = $globalCount + $cpt;
+            @array = @$ref_array;
+        }
     }
     apps::protocols::ftp::lib::ftp::quit();
 
@@ -115,41 +115,41 @@ sub run {
                                                        threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
     
     $self->{output}->output_add(severity => $exit_code,
-				short_msg => sprintf("Number of files : %s", $globalCount));                               
+                                short_msg => sprintf("Number of files : %s", $globalCount));                               
     $self->{output}->perfdata_add(label => 'files',
                                   value => $globalCount,
                                   warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
                                   critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
-                                 );
+                                  min => 0);
     $self->{output}->display();
     $self->{output}->exit();
 }
 
 sub countFiles {
-   my ($self, @array) = @_;
-   my @files;
-   my @subdirs;
-   my $size;
-   my $cpt = 0;
-   my $time_result;
-   my $flag = 0;
+    my ($self, @array) = @_;
+    my @files;
+    my @subdirs;
+    my $size;
+    my $cpt = 0;
+    my $time_result;
+    my $flag = 0;
   
-   foreach my $dir (@array) {
+    foreach my $dir (@array) {
         if (!(@files = apps::protocols::ftp::lib::ftp::execute($self, command => $map_commands{ls}->{$self->{ssl_or_not}}->{name}, command_args => [$dir]))) {
             $flag = 0;
         }
            
         foreach my $file (@files) {
-           if (!($time_result = apps::protocols::ftp::lib::ftp::execute($self, command => $map_commands{mdtm}->{$self->{ssl_or_not}}->{name}, command_args => [$file]))) {
-               push(@subdirs, $file);
-               $flag = 1;        
-           }
-       $cpt++;
-       }
-       $size = @subdirs;
-   }
-   $cpt = $cpt - $size;
-   return \@subdirs, $cpt, $flag;
+            if (!($time_result = apps::protocols::ftp::lib::ftp::execute($self, command => $map_commands{mdtm}->{$self->{ssl_or_not}}->{name}, command_args => [$file]))) {
+                push(@subdirs, $file);
+                $flag = 1;        
+            }
+            $cpt++;
+        }
+        $size = @subdirs;
+    }
+    $cpt = $cpt - $size;
+    return \@subdirs, $cpt, $flag;
 }
 
 1;
@@ -158,7 +158,7 @@ __END__
 
 =head1 MODE
 
-Count files in an FTP directory, cab be recursive
+Count files in an FTP directory (can be recursive).
 
 =over 8
 
diff --git a/apps/protocols/ftp/plugin.pm b/apps/protocols/ftp/plugin.pm
index 410530ecf..c3f5e8100 100644
--- a/apps/protocols/ftp/plugin.pm
+++ b/apps/protocols/ftp/plugin.pm
@@ -47,10 +47,10 @@ sub new {
 
     $self->{version} = '0.1';
     %{$self->{modes}} = (
-                        'login'     => 'apps::protocols::ftp::mode::login',
-                        'commands'  => 'apps::protocols::ftp::mode::commands',
-                        'date'      => 'apps::protocols::ftp::mode::date',
-                        'filescount'=> 'apps::protocols::ftp::mode::filescount',
+                        'login'         => 'apps::protocols::ftp::mode::login',
+                        'commands'      => 'apps::protocols::ftp::mode::commands',
+                        'date'          => 'apps::protocols::ftp::mode::date',
+                        'filescount'    => 'apps::protocols::ftp::mode::filescount',
                         );
     return $self;
 }