This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All image files | |
SELECT | |
floor(filesize/1000000)*1000000 as bucket, | |
SUM(`filesize`) as bytes, | |
(SUM(`filesize`) / 1024 / 1024 / 1024 ) AS GB, | |
COUNT(*) AS COUNT, | |
RPAD('', LN(COUNT(*)), '*') AS bar | |
FROM file_managed | |
WHERE (`filemime` LIKE 'image%') AND (`status` = '1') | |
GROUP BY bucket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Load PHP class from custom module within settings.php file. | |
*/ | |
if (class_exists(ClassLoader::class)) { | |
$class_loader = new ClassLoader(); | |
$class_loader->addPsr4('Drupal\\mymodule\\', DRUPAL_ROOT . '/modules/custom/mymodule/src'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$legacy_db_key = 'project_legacy_db'; | |
// Define database connection for local lando env. | |
if (getenv('LANDO_INFO')) { | |
$lando_info = json_decode(getenv('LANDO_INFO'), TRUE); | |
$databases[$legacy_db_key]['default'] = [ | |
'database' => 'project_legacy', | |
'username' => $lando_info['database']['creds']['user'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/1987926/how-do-i-recursively-grep-all-directories-and-subdirectories | |
grep --include="*.ext" -nRHI "text" ~/projects/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/drush-ops/drush/issues/3396#issuecomment-1009268719 | |
// Bulk generate using action: https://gist.github.com/seth-shaw-unlv/bd64930fa1f75be3aba05ade34433092 | |
// accountSwitcher->switchTo(new UserSession(['uid' => 1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.drupal.org/project/workflow/issues/3016286 | |
# https://www.drupal.org/project/drupal/issues/3157105#comment-13830538 | |
process: | |
... | |
moderation_state: | |
plugin: default_value | |
default_value: published | |
process: | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if pp_media.asset.meta.type === 'image' %} | |
{{ attach_library('easy_responsive_images/resizer') }} | |
{% set srcset = [ | |
asset.sizes['400w'].url ~ ' 600w', | |
asset.sizes['900w'].url ~ ' 900w', | |
asset.sizes['3000w'].url ~ ' 3000w', | |
] %} | |
<img src="{{ src }}" data-srcset="{{ srcset|join(',')|raw }}" alt="{{ pp_media.asset.meta.alt }}" loading="lazy" /> | |
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
final class Redirect extends SqlBase { | |
/** | |
* Return list of additional redirects that doesn't exist in source db. | |
* | |
* Some redirects are not in db, but we need to add them. | |
* | |
* @return array[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* recreateMigrationMapTables.drush.php | |
* | |
* Usage: | |
* @code | |
* drush scr recreateMigrationMapTables.drush.php [MIGRATION_ID] | |
* @endcode | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check php compatibility | |
# source: https://www.specbee.com/blogs/drupal9-and-its-compatibility-with-php-8-learn-whats-new | |
vendor/bin/phpcs -p . --standard=PHPCompatibility \ | |
--runtime-set 7.4 \ | |
--extensions=php,module,install,inc \ | |
--report-full==./php7.4-compatibility.txt |