Skip to content

Instantly share code, notes, and snippets.

Mark Jordan mjordan

Block or report user

Report or block mjordan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mjordan
mjordan / get_all_mods_fields_in_solr.sh
Created Jan 16, 2020
Shell script to get all the Solr fields indexed from MODS elements
View get_all_mods_fields_in_solr.sh
#!/bin/bash
SOLR_HOST='http://192.168.50.111:8080'
SOLR_URL="$SOLR_HOST/solr/select?q=*:*&wt=csv&rows=0&facet&fl=mods_*"
curl -s -o mods_elements.txt "$SOLR_URL"
sed 's/,/\n/g' mods_elements.txt > mods_elements_one_per_line.txt
sed 's/_mlt$// ; s/_ms$// ; s/_mt$// ; s/_s$// ; s/_ss$// ; s/_t$// ; s/_all$// ; s/_dt$// ; s/_mdt$//' mods_elements_one_per_line.txt > mods_elements_one_per_line.txt.pruned
sort mods_elements_one_per_line.txt.pruned > mods_elements_one_per_line.txt.pruned.sorted
uniq mods_elements_one_per_line.txt.pruned.sorted > mods_elements.txt
@mjordan
mjordan / AppFixtures.php
Created Jan 25, 2019
Symfony 4 fixtures generator for Riprap
View AppFixtures.php
<?php
// src/DataFixtures/AppFixtures.php
namespace App\DataFixtures;
use App\Entity\FixityCheckEvent;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Ramsey\Uuid\Uuid;
class AppFixtures extends Fixture
@mjordan
mjordan / gist:6368d0d07047528d85b2b1dd7a997b10
Created Nov 22, 2018
Using JWT for internal REST calls in Drupal 8.
View gist:6368d0d07047528d85b2b1dd7a997b10
// Construct Authorization header using jwt token.
$container = \Drupal::getContainer();
$jwt = $container->get('jwt.authentication.jwt');
$auth = 'Bearer ' . $jwt->generateToken();
$client = \Drupal::httpClient();
$options = [
'auth' => [],
'headers' => ['Authorization' => $auth],
'form_params' => []
];
View gist:f26ade27b1a9d0d8a9cc5280d4adf759

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());.
View sample_7x_to_claw_migration.yml
```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 Jul 24, 2017
Script to test Fedora Repository PIDs
View test_pids.php
<?php
$pids = array(
'foo:%0F',
'foo-:123',
'.foo.:123',
'foo.:-.~_',
'foo.:-___',
);
View LAC OAI-ORE sample
<?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>
View cartoons2csv.php
<?php
/**
* Script to export entries from the SFU Editorial Cartoons database
* for importing into Islandora.
*/
$db['user'] = '****';
$db['password'] = '****';
$db['name'] = 'Cartoons';
View hook_islandora_datastream_alter-example.php
<?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 Jul 14, 2016
Writing out derivatives for use in another Islandora
View islandora_derivative_factory
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) {
You can’t perform that action at this time.