Skip to content

Instantly share code, notes, and snippets.


Jibran Ijaz jibran

View GitHub Profile
jibran / gist:53422800591460a5a4300aa65f98d520
Last active Sep 17, 2022
All the new stuff in Drupal 10.1.x
View gist:53422800591460a5a4300aa65f98d520
git log --oneline --reverse --no-merges --cherry-pick --right-only origin/10.0.x...origin/10.1.x
jibran / path_to_request.php
Last active Apr 13, 2021
Setup current request to the given path in Drupal 8/9
View path_to_request.php
// Setup page URL with all request parameters as current request and path.
$path = '/some-uri';
$request = Request::create($path);
$result = \Drupal::service('router.no_access_checks')->matchRequest($request);
jibran / 20-xdebug.ini
Created Nov 19, 2020
To get xdebug to work.
View 20-xdebug.ini
xdebug.max_nesting_level=256 ; Fixes debugging for D8.
View gist:ef3d1a6cfae70b60010bb4a7ec78534f
$ mysql -uroot -proot -h127.0.0.1 -Dlocal
MariaDB [local]> SELECT * FROM mysql.general_log;
MariaDB [local]> SET global general_log = 1;
MariaDB [local]> SET global log_output = 'table';
// Run Queries.
MariaDB [local]> SELECT * FROM mysql.general_log;
MariaDB [local]&gt; TRUNCATE mysql.general_log;
jibran / DrupalDependenciesTest.php
Created Feb 13, 2019
Tests Drupal dependencies are correct.
View DrupalDependenciesTest.php
* Tests Drupal dependencies are correct.
public function testDrupalDependencies() {
$excluded_packages = [
$project_lock = json_decode(file_get_contents($this->root . '/composer.lock'), TRUE);
// Drupal 8.6.9 lock file.
jibran /
Last active Jan 2, 2020
Steps to update Drupal core dependencies
git clone --branch 8.6.x
cd drupal
composer config platform.php 5.5.9
composer install
composer outdated -D
// Choose the packages to update. Let's say we want to update symfony packages.
composer update symfony/*
composer config --unset platform
composer update --lock
git add composer.lock
View bootstrap.php
* @file
* Boostrap for PHPUnit.
use Drupal\Component\Assertion\Handle;
assert_options(ASSERT_ACTIVE, FALSE);
$autoloader = __DIR__ . '/../vendor/autoload.php';
$loader = require $autoloader;
jibran /
Last active Mar 10, 2019
Install new PHP for Drupal
phpbrew install 7.3.3 +gd +zlib +zip +xml +wddx +tokenizer +sockets +session +readline +posix +pdo +pcre +pcntl +openssl +mbstring +mysql +json +iconv +hash +gettext +ftp +filter +fileinfo +exif +dom +curl +ctype +calendar +bz2
phpbrew switch php-7.3.3
phpbrew ext install xdebug
phpbrew ext install apcu
jibran / FileEntity.php
Created Mar 24, 2017
Migrating Drupal 7 File Entities to Drupal 8 Media Entities
View FileEntity.php
// modules/custom/my_custom_module/src/Plugin/migrate/source/FileEntity.php
namespace Drupal\my_custom_module\Plugin\migrate\source;
use Drupal\Core\Database\Query\Condition;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
* Drupal 7 file_entity source from database.
jibran / test.php
Created Feb 21, 2017
Drupal minimal bootstrap.
View test.php
* @file
* Drupal minimal bootstrap.
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;