Skip to content

Instantly share code, notes, and snippets.

@elizoller
elizoller / groups.php
Last active April 3, 2023 15:03
Group module usage. I'm sure this isn't all applicable to everyone. But basically its designed to create a group for a collection when one is created. When an item is created or updated, it should update the group it belongs to.
<?php
use Drupal\group\Entity\Group;
/**
* Implements hook_node_insert().
*
* Alternatively could trigger this with a context reaction.
*/
function asu_permissions_node_insert(NodeInterface $node) {
@elizoller
elizoller / composer_d9.md
Created December 7, 2020 20:51
islandora updating to d9
  • change your composer.json to require the dev-d9_islandora version of islandora, the dev-d9 branch of islandora_defaults, and the dev-d9 branch of openseadragon.
  • remove carapace and adaptivetheme
composer require drupal/core-dev:^9.1 --dev --update-with-dependencies --no-update
composer require drupal/core-recommended:^9.1 drupal/core-composer-scaffold:^9.1 drupal/core-project-message:^9.1 --update-with-dependencies --no-update
composer update

however that'll probably fail until we don't have hook_post_action, libraries, and carapace/adaptivetheme removed i also had to do

@elizoller
elizoller / tips.md
Last active November 8, 2019 21:10
Tips for developing with Alpaca
  1. clone alpaca into /home/karaf in your vagrant vm
  2. modify java files as needed
  3. run sudo ./gradlew clean build install from /home/karaf/Alpaca to rebuild the jar's
  4. run the karaf client (./bin/client in /opt/karaf)
  5. feature:list | grep islandora (to see all the features from islandora)
  6. feature:uninstall each of those
  7. repo-list to see all of the repos
  8. repo-remove the one that says islandora
  9. repo-add your new local features file, which should be somewhere like /home/karaf/Alpaca/karaf/build/resources/main/features.xml 'repo-add file:/home/karaf/Alpaca/karaf/build/resources/main/features.xml'
  10. feature:list | grep islandora should reveal the uninstalled features
@elizoller
elizoller / toolkit_migration.md
Last active June 14, 2017 13:55
process for migrating toolkit sites
  1. SSH into server where site is currently (ie. ssh sysbeekerz@dsgsites.neu.edu)
  2. CD into directory for install (ie. cd /mnt/wordpressdata/aproudpast)
  3. Cat config file to get info (ie. cat wp-config.php)
  4. Create mysqldump file (ie. msyqldump --user=aproudpast_usr --password aproudpast > /home/sysbeekerz/aproudpast.sql) where the user name is the one listed in the wp-config file, the database name is the one in the config file and the ending path is the location where you would like sql dump file to end up. Putting in the shared user home directory means you don't actually have to move it across servers.
  5. Open another tab and SSH into the new server (ie. ssh sysbeekerz@nb9313.neu.edu)
  6. Login to mysql (ie. mysql -u root -p)
  7. Create the database (ie. CREATE DATABASE aproudpast;) Note that it is important to keep the database name the same as it was on the previous server so you do not have to update the wp-config file
  8. Use the new database (ie. USE aproudpast;)
  9. Import the dump (i
@elizoller
elizoller / resque.sh
Last active May 3, 2017 14:40
init.d script for resque, usually in /etc/init.d/resque - note that paths are specific to where the app is installed, the user refers to the user which the rails app runs under, and the environment is specified for the cap command
#!/bin/bash
#
# resque workers
#
# chkconfig: 2345 95 05
start(){
echo "starting resque workers"
su - tapas_rails -c 'cd /export/home/tapas_rails/tapas_rails/current && bundle exec cap production resque:start'
}
diff --git a/app/controllers/api/v1/search_controller.rb b/app/controllers/api/v1/search_controller.rb
index 99b2af2a..c07da0f9 100644
--- a/app/controllers/api/v1/search_controller.rb
+++ b/app/controllers/api/v1/search_controller.rb
@@ -49,6 +49,16 @@ module Api
self.solr_search_params_logic += [:limit_to_scope]
end
+ if params[:filter] == 'geo'
+ self.solr_search_params_logic += [:limit_to_has_geo]
@elizoller
elizoller / acquisitions_import.module
Created February 24, 2017 11:34
Acquisitions Import Module Snippet
<?php
function acquisitions_import_views_query_alter(&$view, &$query) {
if ($view->name == "new_book_list" && ($view->vid == 64 || $view->vid == 65)){
$special_letters = array("A", "C", "D", "J", "K", "L", "M", "P", "S", "U", "V", "Z");
$special_letters_with_children = _get_special_letter_children($special_letters);
//if the query filter contains one of the special letters in the filter then loop through all the terms in the taxo list and select all of the terms that start with the special letter
if (isset($query->where[1]['conditions'])){
foreach($query->where[1]['conditions'] as $key=>$condition){
if ($condition['field'] == "field_data_field_lc_class_taxonomy.field_lc_class_taxonomy_tid"){
if (is_array($condition['value'])){
@elizoller
elizoller / archives_space_search.html
Last active October 27, 2016 20:09
archivesspace search box
<form id="searchForm2" accept-charset="UTF-8" action="http://nb4841.neu.edu:8081/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
<input type="text" class="input-large search" placeholder="Search..." name="q" value="">
<button id="global-search-button" class="btn btn-large submit">Search</button>
</form>
@elizoller
elizoller / spreadsheet_mods.rb
Last active May 16, 2016 15:08
mods mappings to spreadsheet rows
core_file.mods.type_of_resource = row_results["type_of_resource"]
core_file.mods.genre = row_results["genre"]
# core_file.mods.genre.authority = #need authority, usually aat
core_file.mods.origin_info.copyright = row_results["copyright_date"]
core_file.mods.origin_info.date_issued = row_results["date_issued"]
core_file.mods.origin_info.publisher = row_results["publisher_name"]
core_file.mods.origin_info.place.place_term = row_results["place_of_publication"]
core_file.mods.origin_info.edition = row_results["edition"]
core_file.mods.origin_info.issuance = row_results["issuance"]
core_file.mods.origin_info.frequency = row_results["frequency"]
#!/bin/bash
echo We are going to deploy the toolkit sites now
if [ "$1" == "staging" ]; then
echo we are deploying to staging
ssh ezoller@liblab.neu.edu 'sudo su; cd /var/www/html/drstest; php composer.phar update'
elif [ "$1" == "prod" ]; then
echo we are deploying to prod
ssh sysbeekerz@dsgsites.neu.edu 'cd /mnt/wordpressdata/aproudpast/wp-content/plugins/drs-tk; echo a proud past; git pull; cd ../../themes/quest-child; git pull; cd /mnt/wordpressdata/arader2/wp-content/plugins/drs-tk; echo arader; git pull; cd ../../themes/quest-child; git pull; echo black activism; cd /mnt/wordpressdata/BlackActivism/wp-content/plugins/drs-tk; git pull; cd ../../themes/quest-child; git pull; cd /mnt/wordpressdata/bpsdeseg/wp-content/plugins/drs-tk; echo bps desegregation; git pull; cd ../../themes/quest-child; git pull; cd /mnt/wordpressdata/catskills/wp-content/plugins/drs-tk; echo catskills; git pull; cd ../../themes/quest-child; git pull; cd /mnt/wordpressdata/cerestoolkit/wp-content/plugins/drs-tk; echo toolk