Open Journal Systems
3.3.0
|
Public Member Functions | |
__construct ( $bag, $validate=false, $extended=true, $fetch=false, $bagInfoData=null) | |
addFile ($src, $dest) | |
clearBagInfoData ($key) | |
createFile ($content, $dest) | |
getBagContents () | |
getBagErrors ($validate=false) | |
getBagInfo () | |
getBagInfoData ($key) | |
getDataDirectory () | |
getHashEncoding () | |
hasBagInfoData ($key) | |
isExtended () | |
isValid () | |
package ($destination, $method='tgz') | |
setBagInfoData ($key, $value) | |
setHashEncoding ($hashAlgorithm) | |
update () | |
validate () | |
Data Fields | |
$bag | |
$bagCompression | |
$bagDirectory | |
$bagErrors | |
$bagInfoData | |
$bagInfoFile | |
$bagitFile | |
$bagVersion | |
$extended | |
$fetch | |
$manifest | |
$tagFileEncoding | |
$tagManifest | |
BagIt::__construct | ( | $bag, | |
$validate = false , |
|||
$extended = true , |
|||
$fetch = false , |
|||
$bagInfoData = null |
|||
) |
Define a new BagIt instance.
string | $bag | Either a non-existing folder name (will create a new bag here); an existing folder name (this will treat it as a bag and create any missing files or folders needed); or an existing compressed file (this will un-compress it to a temporary directory and treat it as a bag). |
boolean | $validate | This will validate all files in the bag, including running checksums on all of them. Default is false. |
boolean | $extended | This will ensure that optional 'bag-info.txt', 'fetch.txt', and 'tagmanifest-{sha1,md5}.txt' are created. Default is true. |
boolean | $fetch | If true, it will download all files in 'fetch.txt'. Default is false. |
array | $bagInfoData | If given, this sets the bagInfoData property. |
Definition at line 229 of file bagit.php.
References $bag, $bagInfoData, $extended, $fetch, and validate().
BagIt::addFile | ( | $src, | |
$dest | |||
) |
This copies the file specified into the bag at the place given.
$dest should begin with "data/", but if it doesn't that will be added.
string | $src | The file name for the source file. |
string | $dest | The file name for the destination file. This should be relative to the bag directory. |
BagIt::clearBagInfoData | ( | $key | ) |
BagIt::createFile | ( | $content, | |
$dest | |||
) |
Create a new file in the bag at $dest, with the contents in $content.
$dest should begin with "data/", but if it doesn't that will be added.
mixed | $content | the content to write to the file. May be binary data. |
string | $dest | The file name for the destination file. This should be relative to the bag directory. |
BagitException | if the file already exists. |
BagIt::getBagContents | ( | ) |
Return an array of all files in the data directory
Definition at line 351 of file bagit.php.
References getDataDirectory().
BagIt::getBagErrors | ( | $validate = false | ) |
Return errors for a bag
boolean | $validate | If true, then it will run this->validate() to verify the integrity first. Default is false. |
Definition at line 364 of file bagit.php.
References $bagErrors, and validate().
BagIt::getBagInfo | ( | ) |
Return the info keys
Definition at line 291 of file bagit.php.
References getHashEncoding().
BagIt::getBagInfoData | ( | $key | ) |
BagIt::getDataDirectory | ( | ) |
Get the absolute path of the bag's data directory
Definition at line 309 of file bagit.php.
Referenced by getBagContents(), update(), and validate().
BagIt::getHashEncoding | ( | ) |
Determine hash encoding
Definition at line 319 of file bagit.php.
Referenced by getBagInfo().
BagIt::hasBagInfoData | ( | $key | ) |
BagIt::isExtended | ( | ) |
BagIt::isValid | ( | ) |
BagIt::package | ( | $destination, | |
$method = 'tgz' |
|||
) |
BagIt::setBagInfoData | ( | $key, | |
$value | |||
) |
BagIt::setHashEncoding | ( | $hashAlgorithm | ) |
BagIt::update | ( | ) |
This method is used whenever something is added to or removed from the bag. It performs these steps:
Definition at line 409 of file bagit.php.
References $bagDirectory, and getDataDirectory().
BagIt::validate | ( | ) |
Runs the bag validator on the contents of the bag. This verifies the presence of required iles and folders and verifies the checksum for each file.
For the results of validation, check isValid() and getBagErrors().
Definition at line 381 of file bagit.php.
References $bagErrors, and getDataDirectory().
Referenced by __construct(), and getBagErrors().
string BagIt::$bag |
The bag as passed into the constructor. This could be a directory or a file name, and it may not exist.
Definition at line 83 of file bagit.php.
Referenced by __construct().
string BagIt::$bagCompression |
string BagIt::$bagDirectory |
array BagIt::$bagErrors |
An array of all bag validation errors. Each entries is a two-element array containing the path of the file and the error message.
Definition at line 205 of file bagit.php.
Referenced by getBagErrors(), and validate().
array BagIt::$bagInfoData |
A dictionary array containing the 'bag-info.txt' file contents.
Definition at line 183 of file bagit.php.
Referenced by __construct().
string BagIt::$bagInfoFile |
array BagIt::$bagVersion |
boolean BagIt::$extended |
True if the bag is extended.
Definition at line 103 of file bagit.php.
Referenced by __construct(), and isExtended().
BagItFetch BagIt::$fetch |
Information about files that need to be downloaded, listed in fetch.txt.
Definition at line 163 of file bagit.php.
Referenced by __construct().
BagItManifest BagIt::$manifest |
string BagIt::$tagFileEncoding |
BagItManifest BagIt::$tagManifest |