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 /
Created Jan 16, 2020
Shell script to get all the Solr fields indexed from MODS elements
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 / AppFixtures.php
Created Jan 25, 2019
Symfony 4 fixtures generator for Riprap
View AppFixtures.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 / 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
"responseHeader": {
"status": 0,
"QTime": 1,
"params": {
"q": "RELS_EXT_isMemberOfCollection_uri_mt:\u0022vpl:collection\u0022\u0026RELS_EXT_hasModel_uri_mt\\:info:fedora",
"": "map",
"fl": "PID,fgs_label_t",
"start": "0",
mjordan / test_pids.php
Created Jul 24, 2017
Script to test Fedora Repository PIDs
View test_pids.php
$pids = array(
View LAC OAI-ORE sample
<?xml version="1.0"?>
<atom:entry xmlns:atom="" xmlns:doc="" xmlns:dcterms="" xmlns:oreatom="" xmlns:ore="" schemaLocation="">
<atom:link rel="alternate" href=""/>
<atom:link rel="" href=""/>
<atom:link type="application/atom+xml" rel="self" href=""/>
View cartoons2csv.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
* 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="" xmlns:dc="" xmlns:xsi="" xsi:schemaLocation="">
<dc:title>Testing at $now</dc:title>
mjordan / islandora_derivative_factory
Last active Jul 14, 2016
Writing out derivatives for use in another Islandora
View islandora_derivative_factory
This simple module:
* 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.