This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Drupal\ppdx_editor\Plugin\Filter; | |
| use Drupal\Component\Utility\Html; | |
| use Drupal\Core\Entity\EntityRepositoryInterface; | |
| use Drupal\Core\Image\ImageFactory; | |
| use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | |
| use Drupal\file\FileInterface; | |
| use Drupal\filter\FilterProcessResult; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM php:7.2-apache | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends git zip openssh-client sqlite3 libsqlite3-dev | |
| # This is copied from the official Docker "drupal" image's Dockerfile. | |
| # install the PHP extensions we need | |
| RUN set -ex; \ | |
| \ | |
| if command -v a2enmod; then \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| services: | |
| php: | |
| image: tugboatqa/php:7.2-apache | |
| default: true | |
| depends: mysql | |
| commands: | |
| init: | |
| - docker-php-ext-install opcache | |
| - a2enmod headers rewrite | |
| - wget -O /usr/local/bin/drush |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Use: Create an empty directory and download this file as netlifybug.sh | |
| # Then, run "netlify link", then ./netlifybug.sh. | |
| # Use default deploy path (".") at prompts. | |
| # You should see a failed deploy first, then a successful deploy after. | |
| mkdir -p subdir | |
| touch index.html subdir/index.html | |
| RAND=$(openssl rand -base64 12) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Implements hook_metatags_attachments_alter(). | |
| * | |
| * This function allows you to define fallback tokens in case a field is empty. | |
| * | |
| * If all fallback values are empty, the tag will be empty. | |
| * | |
| * Example: [node:field_image:medium]||[node:field_legacy_image:medium]||/fallback.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @file | |
| * Allows Node to make command line requests without a web server. | |
| * | |
| * Example use with Node to POST content: | |
| * const { spawnSync } = require('child_process'); | |
| * const input = JSON.stringify({ path: '/some/path', content: 'request content' }); | |
| * spawnSync(drush, ['php:script', 'request.php', '--script-path=some/script/path'], { input: input }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Download to Drupal root (where index.php is) and run "drush scr dump.php" | |
| $storage = \Drupal::entityTypeManager()->getStorage('node'); | |
| $nodes = $storage->loadMultiple(); | |
| echo 'Processing ' . count($nodes) . ' nodes...' . "\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Drupal\Component\Graph; | |
| function chunk_graph(Graph $graph_object) { | |
| // Sort the graph by weight. | |
| $graph = $graph_object->searchAndSort(); | |
| uasort($graph, 'Drupal\Component\Utility\SortArray::sortByWeightElement'); | |
| // Ensure that graph nodes are sorted from least to most edges. | |
| $graph = array_reverse($graph); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Symfony\Component\Process\Process; | |
| // The total sleep time of this queue is 22, but it only takes ~10 seconds to | |
| // run as new commands are started as soon as another finishes and the | |
| // $concurrency limit is not met. | |
| $command_queue = [ | |
| 'sleep 1', | |
| 'sleep 1', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This script attempts to create a patch file that includes all security fixes | |
| # between two tags. | |
| # Hypothetically, you could just apply the patch to your Drupal site after the | |
| # script is finished successfully to be up to date. | |
| # Biggest successful D7 patch - 7.36 => 7.58 | |
| # Biggest successful D8 patch - 8.4.0 => 8.4.7 / 8.6.0 => 8.6.7 | |
| # WARNING: This is an experimental patch generation method and may not be | |
| # perfect. If you use this on production I take no responsibility for your |