scholarslab/BagItPHP — Issue #3: Populating bag-info.txt
Author: mjordan
Created: 2012-02-06 05:28:40+00:00
State: open

Hi,

I can't figure out how to populate bag-info.txt. I've tried the following, but bag-info.txt is not populated:

$bag = new BagIt($bag_output_path);
$bag->bagInfoData = array(
'First' => 'This is the first tag value',
'Second' => 'This is the second tag value'
);
$bag->addFile('/tmp/test.txt', 'test.txt');
$bag->update();
$bag->package($serialized_bag_path, 'zip');

I've taken a look at the bagit.php code and can see the _createExtendedBag() function, but at the end of the function it looks like an empty file is created by touch() and $this->bagInfoData = array() isn't populated with any values. Any help would be appreciated.