<<

NAME

Koha::UploadedFiles - Koha::Objects class for uploaded files

SYNOPSIS

    use Koha::UploadedFiles;

    # get one upload
    my $upload01 = Koha::UploadedFiles->find( $id );

    # get some uploads
    my @uploads = Koha::UploadedFiles->search_term({ term => '.mrc' });

    # delete all uploads
    Koha::UploadedFiles->delete;

DESCRIPTION

Allows regular CRUD operations on uploaded_files via Koha::Objects / DBIx.

The delete method also takes care of deleting files. The search_term method provides a wrapper around search to look for a term in multiple columns.

METHODS

INSTANCE METHODS

delete

Delete uploaded files.

Parameter keep_file may be used to delete records, but keep files.

Returns the number of deleted records, 0E0 or -1 (Unknown). Please note that the number of deleted records is not automatically the same as the number of files.

delete_temporary

Delete_temporary is called by cleanup_database and only removes temporary uploads older than [pref UploadPurgeTemporaryFilesDays] days. It is possible to override the pref with the override_pref parameter.

Return value: see delete.

delete_missing

    $cnt = Koha::UploadedFiles->delete_missing();

    $cnt = Koha::UploadedFiles->delete_missing({ keep_record => 1 });

Deletes all records where the actual file is not found.

Supports a keep_record hash parameter to do a check only.

Return value: If you pass keep_record, it returns the number of records where the file is not found, or 0E0. Otherwise it returns a number, 0E0 or -1 just as delete does.

search_term

Search_term allows you to pass a term to search in filename and hashvalue. If you do not pass include_private, only public records are returned.

Is only a wrapper around Koha::Objects search. Has similar return value.

CLASS METHODS

getCategories

getCategories returns a list of upload category codes and names

_type

Returns name of corresponding DBIC resultset

object_class

Returns name of corresponding Koha object class

AUTHOR

Marcel de Rooy (Rijksmuseum)

Koha Development Team

<<