Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/share/fusioninventory/lib/FusionInventory/Agent/Target/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/fusioninventory/lib/FusionInventory/Agent/Target/Local.pm
package FusionInventory::Agent::Target::Local;

use strict;
use warnings;

use parent 'FusionInventory::Agent::Target';

my $count = 0;

sub new {
    my ($class, %params) = @_;

    die "no path parameter for local target\n" unless $params{path};

    my $self = $class->SUPER::new(%params);

    $self->{path} = $params{path};

    $self->{format} = $params{html} ? 'html' :'xml';

    $self->_init(
        id     => 'local' . $count++,
        vardir => $params{basevardir} . '/__LOCAL__',
    );

    return $self;
}

sub reset {
    $count = 0;
}

sub getPath {
    my ($self) = @_;

    return $self->{path};
}

sub getName {
    my ($self) = @_;

    return $self->{path};
}

sub getType {
    my ($self) = @_;

    return 'local';
}

sub plannedTasks {
    my $self = shift @_;

    # Keep only inventory as local task
    if (@_) {
        $self->{tasks} = [ grep { $_ =~ /^Inventory$/i } @_ ];
    }

    return @{$self->{tasks} || []};
}

1;

__END__

=head1 NAME

FusionInventory::Agent::Target::Local - Local target

=head1 DESCRIPTION

This is a target for storing execution result in a local folder.

=head1 METHODS

=head2 new(%params)

The constructor. The following parameters are allowed, in addition to those
from the base class C<FusionInventory::Agent::Target>, as keys of the %params
hash:

=over

=item I<path>

the output directory path (mandatory)

=back

=head2 reset()

Reset the local target counter.

=head2 getPath()

Return the local output directory for this target.

=head2 getName()

Return the target name

=head2 getType()

Return the target type

=head2 plannedTasks([@tasks])

Initializes target tasks with supported ones if a list of tasks is provided

Return an array of planned tasks.

Hry