Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #45 from NuCivic/rc-1.12.12.0
Browse files Browse the repository at this point in the history
RC-1.12.12.0
  • Loading branch information
dkinzer authored Dec 16, 2016
2 parents a51996f + 7bc29c9 commit 298ddb4
Show file tree
Hide file tree
Showing 10,961 changed files with 2,217,357 additions and 1,862 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .dkan_starter/.ahoy.yml
116 changes: 116 additions & 0 deletions .dkan_starter/.ahoy/site/.ahoy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
ahoyapi: v1
usage: NuCivic Data cli app for development using ahoy.
commands:
drush:
usage: Run drush via ahoy (helpful for abstraction)
cmd: ahoy cmd-proxy drush --root=docroot "{{args}}"

build:
usage: A series of commands for dkan development.
import: .ahoy/site/build.ahoy.yml
hide: true

custom:
usage: custom deploy commands (Deprecated after ahoy2)
hide: true
import: config/custom.ahoy.yml

dkan:
usage: A series of commands for dkan development.
hide: true
import: dkan/.ahoy/dkan.ahoy.yml

diagnose:
usage: A series of ahoy-docker setup diagnosis commands.
import: dkan/.ahoy/diagnose.ahoy.yml
hide: true

doctor:
usage: A series of ahoy-docker setup diagnosis commands.
import: dkan/.ahoy/diagnose.ahoy.yml
hide: true

confirm:
cmd: ahoy -f dkan/.ahoy/utils.ahoy.yml confirm {{args}}
hide: true

docker:
usage: A series of docker commands for dkan development (experimental)
import: dkan/.ahoy/docker.ahoy.yml
hide: false

init:
cmd: echo "ahoy.yml file already exists."
hide: true

cmd-proxy:
usage: abstraction for commmands.
cmd: |
if [ "$AHOY_CMD_PROXY" == "DOCKER" ]; then
ahoy docker exec "{{args}}"
else
{{args}}
fi
hide: true

ci:
usage: A series of commands to handle ci setup
import: .ahoy/site/ci.ahoy.yml
hide: true

tools:
usage: A series of commands to setup dev tools
import: .ahoy/site/tools.ahoy.yml
hide: true

debug:
usage: A series of commands to setup debugging
import: .ahoy/site/debug.ahoy.yml
hide: true

launch-checklist:
usage: A series of commands to handle pre launch checks
import: .ahoy/site/launch-checklist.ahoy.yml
hide: true

site:
usage: A series of commands for site development
import: .ahoy/site/site.ahoy.yml

utils:
hide: true
usage: A series of helper commands (hide the details)
import: .ahoy/site/utils.ahoy.yml

remote:
usage: A series of commands for site remote management
import: .ahoy/site/remote.ahoy.yml
hide: true

parse:
usage: ahoy parse :filpath :argument, where :argument depth is seperated by underscores.
hide: true
cmd: |
# Attribution: https://gist.github.com/epiloque/8cf512c6d64641bde388#file-yaml-sh
parse_yaml() {
local prefix=$2
local s
local w
local fs
s='[[:space:]]*'
w='[a-zA-Z0-9_]*'
fs="$(echo @|tr @ '\034')"
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s[:-]$s\(.*\)$s\$|\1$fs\2$fs\3|p" "$1" |
awk -F"$fs" '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
if (length($3) > 0) {
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
printf("%s%s%s=(\"%s\")\n", "'"$prefix"'",vn, $2, $3);
}
}' | sed 's/_=/+=/g'
}
parse_yaml {{args}}
2 changes: 2 additions & 0 deletions .dkan_starter/.ahoy/site/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor/*
composer.lock
61 changes: 61 additions & 0 deletions .dkan_starter/.ahoy/site/.mysqlscripts/sanitize.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
--
-- Scrub important information from a Drupal database.
--

-- Remove all email addresses.
UPDATE users SET mail=CONCAT('user', uid, '@example.com'), init=CONCAT('user', uid, '@example.com') WHERE uid != 0;

-- Example: Disable a module by setting its system.status value to 0.
-- UPDATE system SET status = 0 WHERE name = 'securepages';

-- Example: Update or delete variables via the variable table.
-- DELETE FROM variable WHERE name='secret_key';
-- Note that to update variables the value must be a properly serialized php array.
-- UPDATE variable SET value='s:24:"http://test.gateway.com/";' WHERE name='payment_gateway';

-- IMPORTANT: If you change the variable table, clear the variables cache.
-- DELETE FROM cache WHERE cid = 'variables';

-- Scrub url aliases for non-admins since these also reveal names
-- Add the IGNORE keyword, since a user may have multiple aliases, and without
-- this keyword the attempt to store duplicate dst values causes the query to fail.
-- UPDATE IGNORE url_alias SET dst = CONCAT('users/', REPLACE(src,'/', '')) WHERE src IN (SELECT CONCAT('user/', u.uid) FROM users u WHERE u.uid NOT IN (SELECT uid FROM users_roles WHERE rid=3) AND u.uid > 0);

-- don't leave e-mail addresses, etc in comments table.
-- UPDATE comments SET name='Anonymous', mail='', homepage='http://example.com' WHERE uid=0;

-- Scrub webform submissions.
-- UPDATE webform_submitted_data set data='*scrubbed*';

-- remove sensitive customer data from custom module
-- TRUNCATE custom_customer_lead_data;

-- USER PASSWORDS
-- Drupal 7 requires sites to generate a hashed password specific to their site. A script in the
-- docroot/scripts directory is provided for doing this. From your docroot run the following:
--
-- scripts/password-hash.sh password
--
-- this will generate a hash for the password "password". In the following statements replace
-- $REPLACE THIS$ with your generated hash.

UPDATE users SET pass = '$S$DAIFIwaPZLsfNqEZkYY1Wklf6TIQal1uObBpIPk1UDUsc6qgPi6b' WHERE uid IN (SELECT uid FROM users_roles WHERE rid=3) AND uid > 0;
UPDATE users SET name = 'admin' WHERE uid = 1;
UPDATE users SET name = 'admin' WHERE name = 'administrator';
UPDATE users SET pass = '$S$DAGmJJr.MOF1M6wTF/YEU6yBchL5kkAvaMGgvXQtVVJyD4KXmc5G' WHERE uid = 1;
UPDATE users set name = md5(name) where name <> 'admin' AND uid <> 0;

TRUNCATE flood;
TRUNCATE history;
TRUNCATE sessions;
TRUNCATE watchdog;

SELECT concat('TRUNCATE TABLE ', TABLE_NAME, ';') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'access%';

SELECT concat('TRUNCATE TABLE ', TABLE_NAME, ';') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'devel_%';

SELECT concat('TRUNCATE TABLE ', TABLE_NAME, ';') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'cache%';

SELECT concat('TRUNCATE TABLE ', TABLE_NAME, ';') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'migrate_%';

SELECT concat('TRUNCATE TABLE ', TABLE_NAME, ';') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'search_%';
42 changes: 42 additions & 0 deletions .dkan_starter/.ahoy/site/.scripts/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* Transpose config.yml to php array.
*/

include realpath(__DIR__ . '/../vendor/autoload.php');

use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Dumper;

// Setup twig.
$loader = new Twig_Loader_Filesystem(realpath(__DIR__ . '/../.templates'));
$twig = new Twig_Environment($loader, array(
'cache' => realpath(__DIR__ . '/../.cache'),
));
$twig->addFunction(new Twig_SimpleFunction('var_export', 'var_export'));

try {
// Parse yaml.
$yaml = new Parser();
$config = $yaml->parse(file_get_contents(__DIR__ . '/../../../config/config.yml'));

// Render yaml using twig template.
$context = array(
'config' => $config,
);
$output = $twig->render(
'config.php.twig',
$context
);

// Write the php file.
$file = fopen(__DIR__ . '/../../../config/config.php', 'w');
fwrite($file, $output);
} catch (Exception $e) {
echo "An error happened trying to transpose the config.yml file:\n{$e->getMessage()}\n";
} finally {
if ($file) {
fclose($file);
}
}

6 changes: 6 additions & 0 deletions .dkan_starter/.ahoy/site/.scripts/delete-all-nodes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

include_once( dirname(__FILE__) . '/utils-prune.php');

prune_nodes(0);
prune_terms(0);
3 changes: 3 additions & 0 deletions .dkan_starter/.ahoy/site/.scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eval $(ahoy parse config/config.yml)
drush --root=docroot user-password 1 --password="$private_probo_password"
drush --root=docroot user-password admin --password="$private_probo_password"
13 changes: 13 additions & 0 deletions .dkan_starter/.ahoy/site/.scripts/drush.alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
mkdir -p ~/.drush
cp -L ./assets/drush/aliases.local.php ~/.drush
name=$(ahoy utils name)
touch ~/.drush/$name.aliases.drushrc.php

echo '
<?php
// Added by NuCivic.
$aliases_local = realpath(dirname(__FILE__)) . "/aliases.local.php";
if (file_exists($aliases_local)) {
include $aliases_local;
}
' > ~/.drush/$name.aliases.drushrc.php
34 changes: 34 additions & 0 deletions .dkan_starter/.ahoy/site/.scripts/htaccess.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require 'erb'
require 'yaml'

htaccess_template = File.open("assets/templates/.htaccess.erb", "r").read

class Htaccess
attr_accessor :https_everywhere
attr_accessor :redirect_hosts
attr_accessor :prod_host

def initialize config
@redirect_hosts = set_redirect_hosts(config)
@https_everywhere = config["default"]["https_everywhere"] ? config["default"]["https_everywhere"] : false
@prod_host = config["default"]["hostname"]
end

def render(template)
ERB.new(template).result(binding)
end

private
def set_redirect_hosts config
if config["redirectDomains"]
config["redirectDomains"].map do |m| m.gsub('.', '\.'); end
else
[]
end
end

end

config = YAML.load_file("config/config.yml")
htaccess = Htaccess.new(config)
puts htaccess.render(htaccess_template);
32 changes: 32 additions & 0 deletions .dkan_starter/.ahoy/site/.scripts/overrides.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
include __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Dumper;

try {
$yaml = new Parser();
$overrides_make = $yaml->parse(file_get_contents(__DIR__ . '/../../../config/overrides.make'));
$drupal_org_make = make_parse_info_file(realpath(__DIR__ . '/../../../dkan/drupal-org.make'));

if (is_array($overrides_make) && is_array($drupal_org_make)) {
if (isset($overrides_make['projects']['drupal'])) {
unset($overrides_make['projects']['drupal']);
}
$overriden_modules = array_keys($overrides_make['projects']);
foreach ($overriden_modules as $key) {
$module_definition = array_replace_recursive(
$overrides_make['projects'][$key],
$drupal_org_make['projects'][$key]
);
$overrides_make['projects'][$key] = $module_definition;
}
$dumper = new Dumper();
$overriden_yaml = $dumper->dump($overrides_make, 4);
file_put_contents(__DIR__ . '/../../../overriden_make.make', $overriden_yaml);
}

} catch (Exception $e) {

echo "An error happened trying to override drupal-org.make:\n{$e->getMessage()}\n";
}

21 changes: 21 additions & 0 deletions .dkan_starter/.ahoy/site/.scripts/prune-database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* The purpose of this script is to delete all but N datasets and their
* resources in order to prune the size of a DKAN site database for development
* purposes.
*/

include_once( dirname(__FILE__) . '/utils-prune.php');

db_query("DELETE FROM search_api_index where server = 'dkan_acquia_solr'");
db_query("DELETE FROM search_api_index where server = 'local_solr_server'");
db_query("DELETE FROM search_api_server where machine_name = 'dkan_acquia_solr';");
db_query("DELETE FROM search_api_server where machine_name = 'local_solr_server';");
db_query("DELETE FROM search_api_index where server IS NULL");

module_load_include('inc', 'search_api', 'search_api.drush');
drush_search_api_disable();

prune_nodes();
prune_terms();

23 changes: 23 additions & 0 deletions .dkan_starter/.ahoy/site/.scripts/s3-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -e

if [ ! -f ~/.s3curl ]; then
if [[ -z "$AWS_ID" || -z "$AWS_KEY" ]]; then
echo "AWS environment variables are not set and there's no .s3curl file available. Aborting."
exit 1;
fi
fi

if [ ! -f ~/.s3curl ]; then
echo "
%awsSecretAccessKeys = (
local => {
id => '$AWS_ID',
key => '$AWS_KEY',
}
);" > ~/.s3curl
chmod 600 ~/.s3curl
else
echo ".s3curl file is available. Skipping"
fi
Loading

0 comments on commit 298ddb4

Please sign in to comment.