Skip to content

Instantly share code, notes, and snippets.

@paul-m
paul-m / dkan_harvest_to_datastore.md
Last active April 23, 2024 17:08
DKAN harvest to datastore

DKAN data flow from harvest to datastore:

graph TD
  harvestRegisterCommand(["`dkan:harvest:register`"])
  harvestRunCommand(["`dkan:harvest:run`"])
  harvestCatalog[Harvest Catalog JSON]
  harvestPlanDb[(Harvest Plan)]
  harvestProcess[[Harvest]]
  harvestRunDb[(Harvest Run)]
Here's how you find out how many git commit mentions you have in Drupal core:
First we clone Drupal:
% git clone git@git.drupal.org:project/drupal.git
After a while we then ask it how many commit mentions. Substitute your user name for Mile23.
% git log --pretty=oneline --grep Mile23 | wc -l
@paul-m
paul-m / export_terms.php
Last active October 31, 2018 19:46
Use Drush / Default Content to export a range of terms.
<?php
// Add this as a composer script for happiness inside docker.
$vocabulary_name = 'terms';
foreach (range(148,166) as $term_id) {
exec("drush dce taxonomy_term $term_id > docroot/modules/custom/YOUR_CONTENT_MODULE/content/taxonomy/$vocabulary_name-$term_id.json");
}
$ time composer -vvv require drupal/address
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /private/var/folders/_p/lfvb8ksn2p5b_yyl1sn2w4340000gq/T/composer-cacert-e78c8ab7b4432bd466e64bb942d988f6c0ac91cd785017e465bdc96d42fe9dd0.pem: valid
Executing command (/Users/paul/pj2/drupal): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: /Users/paul/.config/composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /Users/paul/pj2/drupal/vendor/composer/installed.json
Loading plugin Composer\Installers\Plugin
Loading plugin Wikimedia\Composer\MergePlugin
diff --git a/core/composer.json b/core/composer.json
index 0d103002c7..57f34b1b83 100644
--- a/core/composer.json
+++ b/core/composer.json
@@ -5,19 +5,19 @@
"license": "GPL-2.0+",
"require": {
"php": ">=5.5.9",
- "symfony/class-loader": "^3.2",
- "symfony/console": "^3.2",
# This build file is (mostlY) copy-pasted from
# https://dispatcher.drupalci.org/job/default/296858/ and is for testing Phpcs
# with a D7 contrib project with no phpcs.xml(.dist) file.
build:
codebase:
assemble_codebase:
replicate:
exclude: { }
local_dir: ''
git_branch: ''
# This is a one-liner to aid in reviewing patches on this Drupal.org meta issue:
# https://www.drupal.org/node/1811638
# You can use netbeansdrupalcomposed to gather the dependencies, which are phpcs
# and Drupal's Coder module
# https://www.drupal.org/sandbox/mile23/2197899
# Substitute any module path you want in order to check only that module.
# The resulting list will be a bit of gobbledygook in CSV, but will show you whether
# or not the patch you're evaluating successfully removed the errors we're looking for.
phpcs --standard="/path/to/drupal/coder/coder_sniffer/Drupal" --report-csv path/to/module/src/Tests | grep "should use lowerCamel"
@paul-m
paul-m / drupal_standards.sh
Last active February 1, 2016 00:10
How to evaluate drupal.org issues for this meta: https://www.drupal.org/node/1800046
# This is a one-liner to aid in reviewing patches on this Drupal.org meta issue:
# https://www.drupal.org/node/1800046
# You can use netbeansdrupalcomposed to gather the dependencies, which are phpcs
# and Drupal's Coder module
# https://www.drupal.org/sandbox/mile23/2197899
# Substitute any module path you want in order to check only that module.
# The resulting list will be a bit of gobbledygook in CSV, but will show you whether
# or not the patch you're evaluating successfully removed the errors we're looking for.
phpcs --standard="/path/to/drupal/coder/coder_sniffer/Drupal" --extensions="module/php,inc/php,php" --report-csv path/to/module/ | grep -F $'Missing param\nReturn type missing'
<?php
$loader = require_once __DIR__ . '/vendor/autoload.php';
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\YamlFileLoader;
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container);
$loader->load('core.services.yml');
@paul-m
paul-m / console.patch
Created April 7, 2014 02:21
Apply this patch, do 'composer update', then type 'php ./core/console tests:list'
diff --git a/composer.json b/composer.json
index 4526a90..b209e8c 100644
--- a/composer.json
+++ b/composer.json
@@ -23,11 +23,13 @@
"symfony-cmf/routing": "1.1.*@alpha",
"easyrdf/easyrdf": "0.8.*",
"phpunit/phpunit": "3.7.*",
- "zendframework/zend-feed": "2.2.*"
+ "zendframework/zend-feed": "2.2.*",