Skip to main content

Upgrade MySQL 5.7 to MySQL 8

Submitted by system on
To upgrade in Ubuntu 18.04 server. Step I: Get the upgrade command shell and check upgrade issues Get the MySQL Shell download link here: https://dev.mysql.com/downloads/shell/ This shell will assist in finding issues with the current installation. Install the MySQL upgrade shell with the command dpkg -i mysql-shell_8.0.30-1ubuntu18.04_amd64.deb
This will make available the mysqlsh command. Execute this mysqlsh command with root user to access the MySQL JS shell. mysqlsh

Export Configuration using Drupal Console into a Module

Submitted by system on
Drupal console can be used to export configuration to an existing module. Exporting Content Types : Remove UUID and Config hash. Also specify module as ji_custom in this case vendor/drupal/console/bin/drupal config:export:content:type support_ticket --remove-uuid --remove-config-hash --module=ji_custom
Exporting Custom Entity types, in this case generated using ECK module vendor/drupal/console/bin/drupal config:export:view internal_support_notes --remove-uuid --remove-config-hash --module=ji_custom

Writing Automated tests in Drupal 9

Submitted by system on
This is a start. Install PHP Unit: PHPUnit8.4+ for Drupal 9 composer require --dev phpunit/phpunit ^8.4
For the current portal, add core-dev option composer require 'drupal/core-dev:^9.5'
composer update

Drupal requires Prophecy PhpUnit when using PHPUnit 9 or greater. composer require --dev phpspec/prophecy-phpunit:^2'

Handling Issues in Migration

Submitted by system on
Fix "non-existent config entity name returned by FieldStorageConfigInterface::getBundles()" Normally it will show that a field belongs to a non existing bundle for a node, comment etcetra in log post migration. Solving a field that does not belong to non existent bundle in a node, example, field_agenda present in a non existent bundle makemeeting of node type $key_value_factory = \Drupal::service("keyvalue");
$field_map_kv_store = $key_value_factory->get("entity.definitions.bundle_field_map");
$node_map = $field_map_kv_store->get("node");

Rest API and JSON API

Submitted by system on
-- https://thebrainfiles.wearebrain.com/how-to-quickly-configure-drupal-as-a-decoupled-api-first-system-8730a3623388 https://documenter.getpostman.com/view/5459957/S1TZyFjw?version=latest#707772be-2d65-4b3a-aacc-ec3ddc9f2072 https://www.drupal.org/docs/8/modules/jsonapi/updating-existing-resources-patch https://www.drupal.org/docs/8/core/modules/jsonapi-module https://thewebtier.com/php/snippet-post-multiple-files-guzzlehttp-client/

Optimizing Images using command line

Submitted by system on
The images uploaded by users may not be of ideal size and may require compression to manage server space. There are some tools available for compressing JPG and PNG files. Please note that the owner changes to the current username for the file after compression. Please remember to change ownership if required of the file or per folder post compression. jpegoptim : Optimize a jpg image with the same name jpegoptim image.jpg
Optimize all jpg images in a folder jpegoptim *.jpg

Managing Flag Development In D8

Submitted by system on
Check if an entity has been flagged: /**@var \Drupal\flag\FlagService $flag_service */
$flag_service = \Drupal::service('flag');
$flag = $flag_service->getFlagById($flag_id);
return $flag->isFlagged($node);

Get all flagging users for an entity and flag: $flagging = $flag_service->getFlaggingUsers($entity, $flag); // $flag is optional
Flag an entity: $flag_service->flag($flag, $entity, $account); // $account is optional

SSL Certificate Using Let's Encrypt for Ubuntu

Submitted by system on
Automated creation, renewing of certificates is provided by software called certbot. To view a list of the certificates Certbot knows about, run the certificates subcommand: $> certbot certificates
Deleting certificates $> certbot delete --cert-name example.com
Install Certificates Using Apache $> sudo certbot --apache -d example.in -d www.example.in

Git Management

Submitted by system on
Associating your local repo to a repo in third party Git repository, say Bitbucket. Step 1: Switch to your repository's directory cd /path/to/your/repo
Step 2: Connect your existing repository to Bitbucket git remote add origin git@bitbucket.org:username/your-repo-name.git
// ... Series of commits...
git push -u origin master

List your existing remotes in order to get the name of the remote you want to change. git remote -v

Specify different default php version

Submitted by system on
If you are using Ubuntu and want to set a different version for php, considering multiple version of php is installed in your system sudo update-alternatives --set php /usr/bin/php7.0
Set php7.0 as the default version. -- Links: https://www.tecmint.com/install-different-php-versions-in-ubuntu/ https://jakelprice.com/article/how-to-upgrade-from-php-70-to-php-71