Skip to content

Instantly share code, notes, and snippets.

View vladdancer's full-sized avatar
🖖

Vlad Moyseenko vladdancer

🖖
View GitHub Profile
@vladdancer
vladdancer / fix_db_collation.sh
Created June 18, 2024 12:51
Fix Unknown collation: 'utf8mb4_0900_ai_ci'
# Sed syntax for macOS
sed -i '' 's/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g' your_sql_file.sql
@vladdancer
vladdancer / .lando.yml
Created November 13, 2023 10:18
Install php-spx on lando
appserver:
build_as_root:
- 'mkdir -p /usr/src/php/ext && cd /usr/src/php/ext && git clone https://github.com/NoiseByNorthwest/php-spx.git spx && cd spx/ && git checkout release/latest'
- 'cd /usr/src/php/ext/spx && phpize && ./configure'
- docker-php-ext-install spx
- echo 'spx.http_enabled=1' >> /usr/local/etc/php/conf.d/docker-php-ext-spx.ini
- echo 'spx.http_key="dev"' >> /usr/local/etc/php/conf.d/docker-php-ext-spx.ini
- echo 'spx.http_ip_whitelist="*"' >> /usr/local/etc/php/conf.d/docker-php-ext-spx.ini
@vladdancer
vladdancer / acquia_drush_error.log
Last active October 21, 2023 19:19
Solution for error while running any drush command on Acquia Cloud Platform within shell script invoked by form submit function
[warning] include_once(/mnt/www/html/myproject/docroot/modules/contrib/acquia_connector/acquia_connector.module): failed to open stream: No such file or directory Extension.php:148
[warning] include_once(): Failed opening '/mnt/www/html/myproject/docroot/modules/contrib/block_style_plugins/block_style_plugins.module' for inclusion (include_path='/mnt/www/html/myprojectstg/vendor/pear/archive_tar:/mnt/www/html/myprojectstg/vendor/pear/console_getopt:/mnt/www/html/myprojectstg/vendor/pear/pear-core-minimal/src:/mnt/www/html/myprojectstg/vendor/pear/pear_exception:.:/usr/local/php7.4/lib/php') Extension.php:148
TypeError: Argument 3 passed to Drush\Drupal\Commands\config\ConfigImportCommands::__construct() must implement interface Drupal\Core\Cache\CacheBackendInterface, instance of Drupal\config_filter\Config\FilteredStorage given, called in /mnt/www/html/myprojectstg/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drush\Drupal\Commands\config\ConfigImportCommands->__construc
tmux наше все у такі часи))
https://www.makeuseof.com/install-tmux-linux/
thisComp/projects $ ssh user@remote.server
# simple rule for session name: who-did-what
remoteServer/projects/myProj $ tmux new -s migrate-update-event
tmuxSession $ drush mim migration_id --update
# Ctrl+B and type ":" and enter "detach" word
remoteServer/projects/myProj $ exit
# later, after a "sun" comes back
thisComp/projects $ ssh user@remote.server
@vladdancer
vladdancer / remove_cron_semaphore_rec.sh
Created May 12, 2023 12:18
Removing cron from semaphore
# cc Ranieri Machado, https://www.drupal.org/forum/support/post-installation/2018-10-03/attempting-to-re-run-cron-while-it-is-already-running-in#comment-13753665
drush sqlq "DELETE FROM semaphore WHERE name = 'cron';"
@vladdancer
vladdancer / recreateMigrationMapTables.drush.php
Created April 28, 2023 14:25
recreateMigrationMapTables #drupal #drush
<?php
/**
* @file
* recreateMigrationMapTables.drush.php
*
* Ensure that migrate_map_* table is created for a given migration.
*
* Usage: drush scr ./recreateMigrationMapTables.drush.php migrate_users
*
@vladdancer
vladdancer / custom_join.module
Created November 25, 2022 20:31 — forked from rubenvarela/custom_join.module
drupal 8, drupal 9 - Views - Add extra condition on join
<?php
/**
* @file
* Primary module hooks for custom_join module.
*/
use Drupal\views\Plugin\views\query\QueryPluginBase;
use Drupal\views\ViewExecutable;
@vladdancer
vladdancer / generate_classes.sh
Created November 21, 2022 20:57
Generate PicturePark PHP classes from OpenAPI spec (swagger)
#!/bin/bash -x
# Run this script from the module's root dir:
# chmod +x ./tools/generate_classes.sh && ./tools/generate_classes.sh
PP_SPEC_FILE=./tools/PictureparkSwagger.json
PP_SPEC_URL="https://api-cp-ch01.picturepark.com/docs/Rest/PictureparkSwagger.json"
if [ ! -f "$PP_SPEC_FILE" ]; then
echo "$PP_SPEC_FILE does not exist. Downloading from upstream..."
wget -O "$PP_SPEC_FILE" "$PP_SPEC_URL"
@vladdancer
vladdancer / views.view.ui_test_view_2.yml
Created November 21, 2022 14:07
test for UI patterns live preview view page
uuid: 5ffa7c73-6273-4f19-b3fa-83be724c1a19
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_image
module:
- image
- node
- ui_patterns_views
@vladdancer
vladdancer / gist:c896710a1453c8b27f82c4ac33e71509
Created November 8, 2022 14:24 — forked from jleehr/gist:7ac2a5de785881dfce99f7034547f07b
Drupal 8 - Migrate from public to private files
# Enable maintanance mode
drush state-set system.maintenance_mode 1
# Backup file field data
drush sql-query "CREATE TABLE media__field_file_bak AS SELECT * FROM media__field_file;"
drush sql-query "CREATE TABLE media_revision__field_file_bak AS SELECT * FROM media_revision__field_file;"
# Truncate file field tables (need to change storage settings)
drush sql-query "TRUNCATE media__field_file;"
drush sql-query "TRUNCATE media_revision__field_file;"