Home - pierregermain/MyDrupal GitHub Wiki
MyDrupal Wiki
Must Have Wikis
- Routes and Menus
- Api Configuration
- Config Split
- DB
- DB Messenger Logger
- Forms
- Plugins
- Plugins Creation
- Services DI
- Services Creation
- Users and Roles
- Theming Themes
- Theming Modules
- Entity API - Operaciones CRUD - Entidades de configuración
- Entity API - Entidades de contenido
- Text Formats and Filters
- Files and Images
- Sistema de Búsqueda (Search)
- Translate modules
- Updating Drupal
- Automatic Tests
- Emails
- Logs
- Views
ddev
When installing ddev with drupal, if you get 403 error have a look at your docroot configuration:
$cat .ddev/config.yaml
(...)
docroot: web
(...)
Commands once installed
ddev drush uli
ddev start #to spin up the project.
ddev launch #to open your project in a browser.
ddev describe #to get project details
ddev help #to investigate commands.
ddev xdebug off|on
ddev snapshot #backup db
ddev stop
More commands Drupal specific information
Attempting to re-run cron while it is already running.
DELETE FROM semaphore WHERE name='cron'
Examples
https://git.drupalcode.org/project/examples
Cache
Sniff code
Using drupal/coder
# 1. Install coder
composer global require drupal/coder
# 2. Check the installed location (needed in next step)
composer global show -P
We assume route "~/.composer/vendor/drupal/coder"
# 3. Add this to your .bashrc (to make `phpcs` and `phpcbf` available)
export PATH="$PATH:$HOME/.composer/vendor/bin"
# 4. Register the Drupal and DrupalPractice Standards
composer global require drupal/coder:^8.3.1
composer global require dealerdirect/phpcodesniffer-composer-installer
phpcs --config-set installed_paths ~/.composer/vendor/drupal/coder/coder_sniffer
phpcbf --config-set installed_paths <path-to-code_sniffer>
# 5. Verify
phpcs -i
phpcbf -i
# 6. Have fun
cd /var/html/www/
phpcs --standard=Drupal,DrupalPractice <path-to-module>
# To Fix Errors automatically
phpcbf --standard=Drupal,DrupalPractice <path-to-module>
From IDE
- Code sniffer with coder from Drupal.org
- https://www.jetbrains.com/help/phpstorm/using-php-code-sniffer.html
Quickly
docker run -it --rm -v "%cd%":/app -w /app hussainweb/drupal-code-quality:latest phpcs --standard=Drupal,DrupalPractice,DrupalSecure --extensions=php,module,inc,install,test,profile,theme
on your directory you want to check with code sniffer I have Drupal,DrupalPractice
https://github.com/hussainweb/drupal-code-quality/blob/master/README.md
Drupal Check
Config - Unable to uninstall
Tests
vim ./core/phpunit.xml.dist
./vendor/bin/phpunit -c ./core/phpunit.xml.dist ./modules/custom/
Search through a whole database in Drupal?
(thanks to @juampynr)
drush sql-dump --ordered-dump > dump.sql
egrep -rn 'some regex' dump.sql | cut -c1-100