Posts

Composer commands

Installing composer packages behind proxy Dont try to install composer packages with sudo. export HTTPS_PROXY_REQUEST_FULLURI=false Other commands: 1. use  composer prohibits package-name to find out the dependency issue with installing that package 2. use composer info package-name to find out what other libraries that package requires If http request failing then force using https. > composer config -g repo.packagist composer https://packagist.org https://github.com/composer/composer/issues/5656#issuecomment-246103054 Install dev modules. Example: local: composer require --dev 'drupal/devel:^4.0' prod:  composer install --no-dev Install new modules: https://stackoverflow.com/questions/15212381/composer-how-can-i-install-another-dependency-without-updating-old-ones Composer cheatsheet https://devhints.io/composer In docker composer If you cant run composer https://stackoverflow.com/questions/28721699/root-password-inside-a-docker-container

PHP Compatability checker

PHPcompatability checker: https://www.drupal.org/node/2924272   https://github.com/PHPCompatibility/PHPCompatibility phpcs - p . -- standard = PHPCompatibility -- extensions = module / php , inc / php , install / php , php / php -- runtime - set testVersion 7.1

Revert a particular git commit

Assume that you commit a change, pushed and there is also a merge commit. Now you want to revert that particular commit. Do the following > git revert <that_particular_merge_hash> -m 1 This automatically creates a commit with the reverted changes. Now push again.

Configuration management in Drupal8

Better source: https://www.slideshare.net/nuvoleweb/advanced-configuration-management-with-config-split-et-al How to (in short): Create one split in local Keep it disabled Enable via config override Enable all the dev modules that you want drush cex => it will  update sync folder and respective split folder(the one which is active) Note: Next export all the configuration (with `drush cex` for drush >= 8.1.10 and `drush csex` for older versions of drush).

Set up Drupal8 development site locally from production clone

1. Dump the production db and import locally prodsite > drush sql-dump > /nonwebrootpath/prod.sql 2. Clone the code and files of production locally Assume you are making production clone site in local folder "devsite" 3. Change the sites/default/setttings.php a) change db name in  databases [ 'default' ][ 'default' ] b) 4. Create database  devsite> drush sql-create --db-url=mysql://root:mysqlpassword@localhost/test860 5. Import database devsite> drush sql-query --file=/nonwebrootpath/prod.sql 6. Clear cache devsite> drush cache-rebuild

Find the version of package before installing in Ubuntu

apt-get -s install <package> Example: apt-get -s install php NOTE: This is only a simulation! apt-get needs root privileges for real execution. Keep also in mind that locking is deactivated, so don't depend on the relevance to the real current situation! Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: php-common php7.0 php7.0-cli php7.0-common php7.0-fpm php7.0-json php7.0-opcache php7.0-readline Suggested packages: php-pear The following NEW packages will be installed: php php-common php7.0 php7.0-cli php7.0-common php7.0-fpm php7.0-json php7.0-opcache php7.0-readline 0 upgraded, 9 newly installed, 0 to remove and 35 not upgraded. Inst php-common (1:35ubuntu6.1 Ubuntu:16.04/xenial-updates [all]) Inst php7.0-common (7.0.30-0ubuntu0.16.04.1 Ubuntu:16.04/xenial-updates, Ubuntu:16.04/xenial-security [amd64]) Inst php7.0-json (7.0.30-0ubuntu0.16.04.1 Ub...

All about views handlers code

The header, footer in views is called "view area" For example, you need to write views handlers to conditionally display header, footer. class views_handler_area_spellcheck extends views_handler_area { } Example module to look for is search_api_spellcheck