Sort access log

kenneth
tail -n5000 access.log|awk '{print $1}' | sort | uniq -c | sort -nr | head -10

Execute Migrate programmatically

kenneth
<?php

use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateMessage;
use Drupal\migrate\MigrateExecutable;

$manager = \Drupal::service('plugin.manager.migration');
$migration_ids = ['migration_machine_name'];
foreach ($migration_ids as $migration_id) {
  $migration = $manager->createInstance($migration_id);
  // update existing entity imported.
  $migration->getIdMap()->prepareUpdate();
  $executable = new MigrateExecutable($migration, new MigrateMessage());

  try {
    // Run the migration.
    $executable->import();
  }
  ca

Drupal 9 - Forward a request within Symfony

kenneth

Prob. there are better ways or alternatives, but the next way works for me!

A route definition:

keboca.another_route:
  path: '/something/else'
  defaults:
    uri: '/valid_uri'
    _controller: '\Drupal\keboca\Controller\KController::forward'

The trick happens here:

Git "back" helper

kenneth
gitback() {
 BRANCH_NAME=${1:-$(git branch --show-current)}

 git checkout  dev &&
 git pull origin dev &&
 git remote prune origin &&
 git branch -D "$BRANCH_NAME" &&
 git remote show origin &&
 git status
}

alias git-back='gitback'

 

Subscribe to