Skip to content

Instantly share code, notes, and snippets.

@mjordan
mjordan / gist:f26ade27b1a9d0d8a9cc5280d4adf759
Last active May 26, 2018 22:12
Testing Checksum Checker

Checking for verification cycle completion

  1. At the very top of function islandora_checksum_checker_send_check_complete_message() , add the line dd("Cycle complete");.
  2. Run checksum checker via either the drupal cron or the drush script enough times that all objects are checked. The number of times you will need to run checksum checker will depend on how many objects are in your repo and how many checksum checker is configured to check per cron run.
  3. Checksum checker will report that the verification cycle has completed. Tail /tmp/drupal_debug.txt to see the message confirmig this.

Checking for a checksum mismatch

  1. In the function islandora_checksum_checker_send_mismatch_notice(), add dd($mismatches, 'Mismatches'); just after the line of code $mismatches = variable_get('islandora_checksum_checker_mismatches', array());.
```javascript
{
"responseHeader": {
"status": 0,
"QTime": 1,
"params": {
"q": "RELS_EXT_isMemberOfCollection_uri_mt:\u0022vpl:collection\u0022\u0026RELS_EXT_hasModel_uri_mt\\:info:fedora",
"json.nl": "map",
"fl": "PID,fgs_label_t",
"start": "0",
@mjordan
mjordan / test_pids.php
Created July 24, 2017 19:20
Script to test Fedora Repository PIDs
<?php
$pids = array(
'foo:%0F',
'foo-:123',
'.foo.:123',
'foo.:-.~_',
'foo.:-___',
);
<?xml version="1.0"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:doc="http://www.lyncode.com/xoai" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:oreatom="http://www.openarchives.org/ore/atom/" xmlns:ore="http://www.openarchives.org/ore/terms/" schemaLocation="http://www.w3.org/2005/Atom http://www.kbcafe.com/rss/atom.xsd.xml">
<atom:id>http://hdl.handle.net/10294/3386/ore.xml</atom:id>
<atom:link rel="alternate" href="http://hdl.handle.net/10294/3386"/>
<atom:link rel="http://www.openarchives.org/ore/terms/describes" href="http://hdl.handle.net/10294/3386/ore.xml"/>
<atom:link type="application/atom+xml" rel="self" href="http://hdl.handle.net/10294/3386/ore.xml#atom"/>
<atom:published>2011-07-11T02:23:04Z</atom:published>
<atom:updated>2011-07-11T02:23:04Z</atom:updated>
<atom:source>
<atom:generator>oURspace</atom:generator>
<?php
/**
* Script to export entries from the SFU Editorial Cartoons database
* for importing into Islandora.
*/
$db['user'] = '****';
$db['password'] = '****';
$db['name'] = 'Cartoons';
<?php
/**
* Implements hook_islandora_datastream_alter().
*/
function mjtest_islandora_datastream_alter(AbstractObject $object, AbstractDatastream $datastream, array &$context) {
$now = date("Y-m-d H:i:s");
$dc = <<<EOX
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Testing at $now</dc:title>
@mjordan
mjordan / islandora_derivative_factory
Last active July 14, 2016 07:22
Writing out derivatives for use in another Islandora
This simple module:
<?php
/**
* Implements hook_islandora_object_ingested().
*/
function islandora_derivative_factory_islandora_object_ingested(AbstractObject $object) {
$base_output_dir = '/tmp/derivativefactoryoutput';
foreach ($object as $ds) {
(function ($) {
$(document).ready(function() {
$("dd").each(function() {
// Value of the <dd> cannot contain only puncutation or be empty.
if ($.trim($(this).text()).match(/^[.,::\-]$/g) || $.trim($(this).html()) == '') {
// Hide the <dd>.
$(this).hide();
// Hide the corresponding <dt>.
$(this).prev().hide();
}
$map = array(
'jpeg' => 'islandora:sp_basic_image',
'jpe' => 'islandora:sp_basic_image',
'jpeg' => 'islandora:sp_basic_image',
'gif' => 'islandora:sp_basic_image',
'png' => 'islandora:sp_basic_image',
'tif' => 'islandora:sp_large_image_cmodel',
'tiff' => 'islandora:sp_large_image_cmodel',
'jp2' => 'islandora:sp_large_image_cmodel',
'pdf' => 'islandora:sp_pdf',
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 2.
CartoonID,CartoonKey,Cartoonist,Date,CartoonText,PhysicalDescription,PublicationInfo,DisplayNotes,MsCCode,MD5Checksum,Subjects,Subjects_TGM1,Subjects_LCSH,File
7904,2-1999-08-25,|Harrop, Graham|,1999-08-25,|"Will I be Premier?" "I'm afraid not Mr. Wilson ... not a chance." "Finished with the costume Mr. Dosanjh?"|,|18.9 cm x 17.6 cm|,|Vancouver Sun|,,|MsC 25.HAR.71.7|,cfd527c036e3bd67212921e689a94963,|Dosanjh, Ujjal;Wilson, Gordon F.D., 1948 -;Fortune telling|,|Politics & government -- British Columbia|,|Premiers (Canada)|,2-1999-08-25.tif
8292,3-1988-01-13,|Krieger, Bob|,1988-01-13,|"Watch out! He's got a stone!!!"|,|16.3 cm x 19.1 cm|,|The Province|,,|MsC 25.KRI.14.14|,a2f34dbf981359b3476b7b89a6641e7f,|Stones;Ten commandments;Israel. Army|,,,3-1988-01-13.tif
6971,3-2004-03-29,|Krieger, Bob|,2004-03-29,|Finally acting like a premier|,|20.5 cm x 24.7 cm|,|The Provine|,,|MsC 25.KRI.6.67|,c27fa07e838ec02146e738c9a9478585,|MacPhail, Joy|,Feet;Mouths,|Premiers (Canada)|,3-2004-03-29.tif
6688,5-9115-00-00,|Murphy,