Freeside:3:Documentation:Developer/FS/ftp target

From Freeside
Jump to: navigation, search

NAME

FS::ftp_target - Object methods for ftp_target records

SYNOPSIS

 use FS::ftp_target;

 $record = new FS::ftp_target \%hash;
 $record = new FS::ftp_target { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::ftp_target object represents an account on a remote FTP or SFTP server for transferring files. FS::ftp_target inherits from FS::Record.

targetnum - primary key; agentnum - FS::agent foreign key; can be null; hostname - the DNS name of the FTP site; username - username; password - password; path - the working directory to change to upon connecting; secure - a flag ('Y' or null) for whether to use SFTP

METHODS

new HASHREF
Creates a new FTP target. To add it to the database, see "insert".
insert
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
delete
Delete this record from the database.
replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
check
Checks all fields to make sure this is a valid example. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
connect
Creates a Net::FTP or Net::SFTP::Foreign object (according to the setting of the 'secure' flag), connects to 'hostname', attempts to log in with 'username' and 'password', and changes the working directory to 'path'. On success, returns the object. On failure, dies with an error message.
label
Returns a descriptive label for this target.
handling_types
Returns a list of values for the "handling" field, corresponding to the known ways to preprocess a file before uploading. Currently those are implemented somewhat crudely in FS::Cron::upload.

SEE ALSO

FS::Record, schema.html from the base documentation.