* <topic>Education</topic> * </subject> * <subject> * <topic>Health Education</topic> * </subject> * <subject> * <topic>Other Data</topic> * </subject> * * This script also updates the DC record after the changes are made. * * @author Paul Church * @date July 2014 */ # grab the first user supplied parameter as the name of the collection $collection = drush_shift(); if (!$collection) { drush_print("***Error: please provide the name of the collection as the first argument"); drush_print("Example: drush php-script editMODSTopics.php islandora:collection_name_here"); return; } // include all Tuque php files $tuquePath = libraries_get_path('tuque') . '/*.php'; foreach (glob($tuquePath) as $filename) { require_once $filename; } # repository connection parameters $url = 'localhost:8080/fedora'; $username = '******'; $password = '******'; # set up connection and repository variables
#!/usr/bin/env drush #<?php /** * This script is designed to update the DC record of an object based off the MODS record * * Call this script using drush and supply it with the object PID you want to change as the parameter * * @author Paul Church * * @date August 2014 */ // grab the first user supplied parameter as the name of the collection $objectPID = drush_shift(); if (!$objectPID) { drush_print("***Error: please provide the object PID as the first argument"); drush_print("Example: drush php-script updateDublinCoreFromMODS.php RULA:13"); return; } // include all Tuque php files $tuquePath = libraries_get_path('tuque') . '/*.php'; foreach (glob($tuquePath) as $filename) { require_once $filename; } module_load_include('inc', 'islandora', 'includes/derivatives'); // require_once(drupal_get_path('module', 'islandora').'/includes/derivatives.inc'); // repository connection parameters $url = 'localhost:8080/fedora'; $username = '******'; $password = '******'; // set up connection and repository variables
<?php //set fits.sh executable first... it could be at /opt/fits //usage //drush php-script regen-obj [root of book object] # repository connection parameters $url = 'localhost:8080/fedora'; $username = '******'; $password = '******'; # set up connection and repository variables $connection = new RepositoryConnection($url, $username, $password); $repository = new FedoraRepository(new FedoraApi($connection), new SimpleCache()); $root_pid = drush_shift(); $parent_obj = $repository->getObject($root_pid); $itql = 'select $page_itql from <#ri> where $page_itql <fedora-rels-ext:isMemberOf> <info:fedora/' . $root_pid . '> order by $page_itql'; $page_objects = $repository->ri->itqlQuery($itql, 'unlimited', '0'); foreach ($page_objects as $page) { $page_pid = $page['page_itql']['value']; $object = islandora_object_load($page_pid); if (!$object->getDataStream('JP2')) { echo "regenerating OBJ for {$page_pid}\n"; $obj_ds = $object['OBJ']; //url of image... http://fedora_repo_url:8080/objects/[pid]/datastreams/OBJ/content $file_url = $repo_url . '/objects/' . $page_pid . '/datastreams/OBJ/content'; $drupal_result = drupal_http_request($file_url); if (!empty($drupal_result->data)) { //create a temporary file $new_file = file_save_data($drupal_result->data, file_default_scheme() . '://'); $path = drupal_realpath($new_file->uri);
* * * Usage: drush scr printDSInfo.php objectPID datastreamLabel * * Example: drush scr printDSInfo.php islandora:3 TECHMD * */ // grab the first user supplied parameter as the PID $PID = drush_shift(); if (!$PID) { drush_print("***Error: please provide the PID as the first argument"); drush_print("Example: drush php-script printDSInfo.php RULA:193"); return; } // grab the second user supplied parameter as the DS name $dslabel = drush_shift(); if (!$dslabel) { drush_print("***Error: please provide the DS name as the second argument"); drush_print("Example: drush php-script printDSInfo.php RULA:193 OBJ.0"); return; } # include all Tuque php files $tuquePath = libraries_get_path('tuque') . '/*.php'; foreach (glob($tuquePath) as $filename) { require_once $filename; } // repository connection parameters $url = 'localhost:8080/fedora'; $username = '******'; $password = '******'; // set up connection and repository variables
* a provided path to an XSLT file. * * This script also updates the DC record after the changes are made. * * @author MJ Suhonos * @date September 2014 */ # grab the first user supplied parameter as the name of the collection $collection = drush_shift(); if (!$collection) { drush_print("***Error: please provide the name of the collection as the first argument"); drush_print("Example: drush php-script editMODSTopics.php islandora:collection_name_here /path/to/file.xsl"); return; } # grab the second user supplied parameter as the name of the XSLT file $xslt = drush_shift(); if (!$xslt) { drush_print("***Error: please provide the name of the XSLT as the second argument"); drush_print("Example: drush php-script editMODSTopics.php islandora:collection_name_here /path/to/file.xsl"); return; } if (!file_exists($xslt)) { drush_print("***Error: provided XSLT file/path does not exist: {$xslt}"); return; } // include all Tuque php files $tuquePath = libraries_get_path('tuque') . '/*.php'; foreach (glob($tuquePath) as $filename) { require_once $filename; } # repository connection parameters