Skip to content

Instantly share code, notes, and snippets.

@mjordan
mjordan / d6to7_cck_textfield_length_checker.php
Created August 7, 2013 16:49
Script to find Drupal 6 CCK text fields that are longer than 255 characters. Very useful in preparing to upgrade a site to Drupal 7.
<?php
/**
* d6to7_cck_textfield_length_checker.php, a script to find Drupal 6
* CCK text fields that are longer than 255 characters.
*
* Written by Mark Jordan, mjordan@sfu.ca and released into the
* public domain.
*
* Upgrading to Drupal 7 from Drupal 6 instances that use CCK can
<?xml version="1.0" encoding="utf-8"?>
<premis xmlns="info:lc/xlmns/premis-v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:lc/xlmns/premis-v2 http://www.loc.gov/standards/premis/v2/premis.xsd">
<!--PREMIS data for Islandora object changeme:15. Contains object entries for each Managed datastream
in an Islandora object, and event entries documenting all fixity checks performed on versions of those datastreams.
Note that a datastream version that has never had a fixity check performed on it will not be linked to any fixity
check events.-->
<!--'Internal' eventIdentifierType values are comprised of Fedora datasteam ID plus ':' plus Fedora Audit Record ID.-->
<object>
<objectIdentifier>
<objectIdentifierType>Fedora Commons datastreamVersion ID</objectIdentifierType>
@mjordan
mjordan / gist:8250658
Created January 4, 2014 02:21
PREMIS xml for @dmoses to play with
<?xml version="1.0" encoding="utf-8"?>
<premis xmlns="info:lc/xlmns/premis-v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:lc/xlmns/premis-v2 http://www.loc.gov/standards/premis/v2/premis.xsd">
<!--PREMIS data for Islandora object islandora:1. Contains object entries for each Managed datastream
in an Islandora object, and event entries documenting all fixity checks performed on versions of those datastreams.
Note that a datastream version that has never had a fixity check performed on it will not be linked to any fixity
check events.-->
<!--'Internal' eventIdentifierType values are comprised of Fedora datasteam ID plus ':' plus Fedora Audit Record ID.-->
<object>
<objectIdentifier>
<objectIdentifierType>Fedora Commons datastreamVersion ID</objectIdentifierType>
@mjordan
mjordan / premis_with_agents.xml
Last active December 19, 2016 23:48
PREMIS with organization and validating software agents
<?xml version="1.0" encoding="utf-8"?>
<premis xmlns="info:lc/xmlns/premis-v2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:lc/xmlns/premis-v2 http://www.loc.gov/standards/premis/v2/premis.xsd" version="2.2">
<!--PREMIS data for Islandora object yul:89067. Contains object entries for each datastream
in an Islandora object, and event entries documenting all fixity checks performed on versions of those datastreams.
Note that a datastream version that has never had a fixity check performed on it will not be linked to any fixity
check events.-->
<!--'Internal' eventIdentifierType values are comprised of Fedora datasteam ID plus ':' plus Fedora Audit Record ID.-->
<object xsi:type="file">
<objectIdentifier>
<objectIdentifierType>Fedora Commons datastreamVersion ID</objectIdentifierType>
@mjordan
mjordan / gist:8300260
Created January 7, 2014 14:42
Temp. gist for @dmoses to test XSL against
<?xml version="1.0" encoding="UTF-8"?>
<foxml:digitalObject VERSION="1.1" PID="changeme:23"
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
<foxml:objectProperties>
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Portugal image 023"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2013-12-18T06:52:54.617Z"/>
@mjordan
mjordan / gist:8310775
Created January 8, 2014 02:31
PREMIS containing audit records for all datastream types, not just Managed.
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="utf-8"?>
<premis xmlns="info:lc/xmlns/premis-v2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:lc/xmlns/premis-v2 http://www.loc.gov/standards/premis/v2/premis.xsd" version="2.2">
<!--PREMIS data for Islandora object changeme:20. Contains object entries for each Managed datastream
in an Islandora object, and event entries documenting all fixity checks performed on versions of those datastreams.
Note that a datastream version that has never had a fixity check performed on it will not be linked to any fixity
check events.-->
<!--'Internal' eventIdentifierType values are comprised of Fedora datasteam ID plus ':' plus Fedora Audit Record ID.-->
<object xsi:type="file">
<objectIdentifier>
<objectIdentifierType>Fedora Commons datastreamVersion ID</objectIdentifierType>
@mjordan
mjordan / gist:8329267
Created January 9, 2014 04:05
FOXML with embedded Managed datastreams
<?xml version="1.0" encoding="UTF-8"?>
<foxml:digitalObject VERSION="1.1" PID="changeme:20"
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
<foxml:objectProperties>
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Portugal image 020"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2013-12-18T06:52:42.871Z"/>
@mjordan
mjordan / gist:8388603
Last active January 3, 2016 01:19
Example Drupal / Islandora hook
<?php
/**
* Notify modules that the given object was ingested.
*
* This hook is called after an object has been successfully ingested.
*
* @note
* If ingested directly via the FedoraApiM object this will not be called
* as we don't have acces to the ingested object at that time.
@mjordan
mjordan / gist:8388642
Created January 12, 2014 18:44
Implementation of example hook
<?php
/**
* Implements hook_islandora_object_ingested().
*
* Create technical metadata (specifically FITS) datastreams for the
* input object.
*/
function islandora_fits_islandora_object_ingested(AbstractObject $object) {
module_load_include('inc', 'islandora_fits', 'includes/utilities');
@mjordan
mjordan / gist:8388676
Created January 12, 2014 18:46
Example Drupal / Islandora menu
<?php
/**
* Implements hook_menu().
*/
function islandora_fits_menu() {
$items = array();
$items['islandora/object/%islandora_object/manage/fits_metadata'] = array(
'title' => 'Technical Metadata',
'type' => MENU_LOCAL_TASK,