Skip to content

Instantly share code, notes, and snippets.

@dannylamb
dannylamb / gist:48b4f7284e11e9df05e95cb3625f9c92
Last active September 18, 2019 18:50
Islandora CLAW - Flysystem Import Without Moving Files
$filesystem = \Drupal::service('flysystem_factory')->getFilesystem('mydrive');
$file_storage = \Drupal::service('entity_type.manager')->getStorage('file');
$mime_guesser = \Drupal::service('file.mime_type.guesser');
foreach($filesystem->listContents('/path/to/your/stuff') as $info) {
$mime = $mime_guesser->guess($info['path']);
$file = $file_storage->create([
'uid' => 1,
@dannylamb
dannylamb / gist:99f8720faaa20c37e30454c88468dd1a
Last active May 31, 2018 15:21
Content Modeling Overhaul Setup
cd /var/www/html/drupal
composer require drupal/filehash ^1.1
composer require drupal/prepopulate ^2.0@alpha
composer require drupal/eva ^1.3
composer require drupal/features ^3.7
composer require drupal/migrate_plus 4.0-beta3
composer require drupal/migrate_tools 4.0-beta3
composer require drupal/migrate_source_csv ^2.1
composer require drupal/permissions_by_term ^1.51
composer require drupal/context ^4.0
#!/bin/bash
# This version displays a warning to the screen about having the password on the command line.
# This can be disregarded or use the other script with mysql_config_editor
MYSQL_USER="drupal8"
MYSQL_PASS="islandora"
MYSQL_DB="drupal8"
cd /var/www/html/drupal/web
@dannylamb
dannylamb / ansible-role-test.sh
Created February 7, 2018 13:40 — forked from geerlingguy/ansible-role-test.sh
Ansible Role Test Shim Script
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
# - test_idempotence: whether to test playbook's idempotence (default = true)
@dannylamb
dannylamb / gist:50c6753dc54cedfb7e8ab1c04f820d6e
Created December 18, 2017 15:42
some queyr work to remember later
/**
function islandora_node_insert(NodeInterface $node) {
_node_index($node);
}
function islandora_node_update(NodeInterface $node) {
dsm("IN NODE UPDATE");
_node_index($node);
}
/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_mimetype
/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_height
/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_width
/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_image
/var/www/html/drupal/vendor/bin/drush --y pmu islandora
ubuntu@claw:/var/www/html/drupal/web/modules/contrib/islandora$ drupal config:override
Enter configuration name [at_core.settings]:
> system.file
Enter the configuration key [allow_insecure_uploads]:
> temporary_maximum_age
Enter the configuration value:
> 1
Configuration name system.file
@dannylamb
dannylamb / issue-640.sh
Last active August 15, 2017 17:06
Issue 640 Install Script
cd /var/www/html/drupal/web/
/var/www/html/drupal/vendor/bin/drush --y pmu islandora_image
/var/www/html/drupal/vendor/bin/drush --y pmu islandora_collection
/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_mimetype
/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_height
/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_width
/var/www/html/drupal/vendor/bin/drupal config:delete active field.field.media.tn.field_image
/var/www/html/drupal/vendor/bin/drush --y pmu islandora
cd /var/www/html/drupal/web/modules/contrib/islandora
git remote add danny https://github.com/dannylamb/islandora.git
from("timer:foo?period=5000")
.setHeader("IslandoraExchangePattern", constant("InOut"))
.setHeader("IslandoraBroadcastRecipients", constant("activemq:queue:testA,activemq:queue:testB"))
.to("{{input.stream}}")
.log(INFO, LOGGER, "RECEIVED FROM B: ${body}");
from("activemq:queue:testA")
.log(INFO, LOGGER, "Waiting 2 seconds in A")
.process((exchange -> Thread.sleep(2000)))
.log(INFO, LOGGER, "Finished waiting in A")
@dannylamb
dannylamb / gist:cea486a82d1467baf70d67bf40e8f9b9
Created December 14, 2016 14:36
transaction.log and velocity.log problems
INFO: Deploying web application archive /var/lib/tomcat7/webapps/fcrepo.war
Dec 14, 2016 2:22:08 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/fits/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/var/lib/tomcat7/webapps/fcrepo/WEB-INF/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
14:22:08,494 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
14:22:08,494 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logb