-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseadl_regen_thumbs.php
More file actions
39 lines (31 loc) · 928 Bytes
/
Copy pathseadl_regen_thumbs.php
File metadata and controls
39 lines (31 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env drush
/*
Script to add thumbnails to compound object parents.
5/1/2021
*/
<?php
$tuquePath = libraries_get_path('tuque') . '/*.php'; foreach ( glob($tuquePath) as $filename) {
require_once($filename);
}
$serializer = new FedoraApiSerializer();
$cache = new SimpleCache();
$connection = new RepositoryConnection('fedora_url', 'user', 'password');
$api = new FedoraApi($connection, $serializer);
$repository = new FedoraRepository($api, $cache);
//get csv of parents and loop
$csv = array_map('str_getcsv', file('/file/path/parent_pids_thumbs.csv'));
foreach ($csv as $row) {
$id = $row[0];
$object = $repository->getObject($id);
if (!$object) {
drupal_set_message("Fedora Object isn't in the repo!");
} else {
if (!$object['TN']) {
print "Thumbnail made for $id \n";
islandora_compound_object_update_parent_thumbnail($object);
}else {
print "$id skipped \n";
}
}
}
?>