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 | |
| // Delete all nodes. | |
| entity_delete_multiple('node', \Drupal::entityQuery('node')->execute()); | |
| // Delete all files. | |
| entity_delete_multiple('file', \Drupal::entityQuery('file')->execute()); | |
| // Delete all taxonomy terms. | |
| entity_delete_multiple('taxonomy_term', \Drupal::entityQuery('taxonomy_term')->execute()); |
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\node\Entity\Node; | |
| /** | |
| * Before attaching a term(s) to a term reference field, | |
| * Must know: | |
| * - field_example_name: the full name of the term reference field | |
| * - tid: the term ID(s) to attach | |
| * | |
| * Keep in mind that this example uses Node::load() |
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 /* Main */ | |
| use Drupal\Core\DrupalKernel; | |
| use Symfony\Component\HttpFoundation\Request; | |
| $autoloader = require_once 'autoload.php'; | |
| $kernel = new DrupalKernel('prod', $autoloader); | |
| $request = Request::createFromGlobals(); | |
| $response = $kernel->handle($request); |
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\Core\DrupalKernel; | |
| use Symfony\Component\HttpFoundation\Request; | |
| $autoloader = require_once 'autoload.php'; | |
| $kernel = new DrupalKernel('prod', $autoloader); | |
| $request = Request::createFromGlobals(); | |
| $response = $kernel->handle($request); |
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
| # Taxonomy terms: | |
| - https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php | |
| # Menu links: | |
| - https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php | |
| # File items: | |
| - https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php | |
| # Nodes: |
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
| use Drupal\node\Entity\Node; | |
| function _svv_tools_set_author() { | |
| $user = user_load_by_name('test'); | |
| $query = \Drupal::entityQuery('node'); | |
| $nids = $query->execute(); | |
| dd($nids); | |
| foreach ($nids as $nid) { | |
| $node = Node::load($nid); | |
| $node->uid->value = $user->id(); |
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\Core\DrupalKernel; | |
| use Symfony\Component\HttpFoundation\Request; | |
| $autoloader = require_once 'autoload.php'; | |
| $kernel = new DrupalKernel('prod', $autoloader); | |
| $request = Request::createFromGlobals(); | |
| $response = $kernel->handle($request); |
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
| # Configure AWS creds | |
| aws configure | |
| # Create DNS zone dev.domain.asia | |
| aws route53 create-hosted-zone --name dev.domain.asia --caller-reference 1 | |
| dig NS dev.domain.asia | |
| # |
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 python | |
| import gzip | |
| import os | |
| import sys | |
| import re | |
| os.system("mkdir nginx-logs") | |
| os.system("cp /var/log/nginx/* nginx-logs/") | |
| INPUT_DIR = "nginx-logs" |
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
| --- | |
| - hosts: all | |
| sudo: true | |
| vars: | |
| mongodb_version: 3.0.7 | |
| tasks: | |
| - name: MongoDB | Import the public key used by the package management system | |
| apt_key: keyserver=keyserver.ubuntu.com id=7F0CEB10 | |
| - name: MongoDB | Create a list file | |
| lineinfile: dest=/etc/apt/sources.list.d/mongodb-org-3.0.list line="deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.0 multiverse" state=present create=yes |