Skip to content

Instantly share code, notes, and snippets.

View Zifius's full-sized avatar

Alexander Turiak Zifius

View GitHub Profile
@hostep
hostep / composer-v2-support-older-magento2-versions.md
Last active February 4, 2025 10:24
Add composer v2 support to older Magento2 versions

Add composer v2 support to older Magento2 versions

Magento 2.3.7 and 2.4.2 ship with composer v2 support out of the box but as far as I can see the only thing that needs to happen is to use some more modern versions of certain composer plugins which are used by certain dependencies of Magento.

This means we should be able to add composer v2 support to older Magento2 versions as well if we get a bit creative.

See below for diffs of the composer.json files you can apply to your projects, be sure to keep a mental note of these things, they will need to maintained by yourself in case newer versions of these modules are released. And if one day you update to Magento 2.3.7 or 2.4.2 or higher, you can remove these changes again.

⚠️ Disclaimer: use these tricks at your own risk!

@Tjitse-E
Tjitse-E / anonymize.yml
Last active January 4, 2021 11:43
Github action recipe to backup a remote DB via n98-magerun2, anonymize with Masquerade and push the file to DigitalOcean Spaces (S3)
name: Fetch DB, anonymize and upload to S3
env:
MASQUERADE_DOWNLOAD_URL: 'https://github.com/elgentos/masquerade/releases/latest/download/masquerade.phar'
DO_SPACES_HOST: 'ams3.digitaloceanspaces.com'
ANONYMIZED_DB_NAME: 'db_anonymized.sql.gz'
MYQSL_HOST: '127.0.0.1'
MYSQL_PWD: 'root'
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} # source server host
REMOTE_USER: ${{ secrets.REMOTE_USER }} # source server use
REMOTE_PORT: ${{ secrets.REMOTE_PORT }} # source server port
@peterjaap
peterjaap / generate-magento-2-php-client.sh
Last active December 5, 2019 22:04
Generate PHP client with Swagger for Magento 2 including private endpoints (make sure you have the Swagger modules installed & enabled)
#!/bin/bash
SHOP_URL=https://yourshop.url
ADMIN_USERNAME=yourusername
ADMIN_PASSWORD=yourpassword
BEARER=$(curl -XPOST -H 'Content-Type: application/json' ${SHOP_URL}/index.php/rest/V1/integration/admin/token -d '{ "username": "${ADMIN_USERNAME}", "password": "${ADMIN_PASSWORD}" }')
curl -XGET -H "Authorization: Bearer ${BEARER}" ${SHOP_URL}/rest/default/schema?services=all | tee swagger.json
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate -i /local/swagger.json -l php -o /local/
@LauLaman
LauLaman / gpg.md
Last active March 7, 2023 14:42
Use GPG to sign commits using git & PHPStorm

1 - install GPG tools : https://gpgtools.org/

2 - Create new key for your github email

3 - Add key to git on your local machine: git config --global user.signingkey YOURKEY

4 - configure git to sign all commits: git config --global commit.gpgsign true

5 - add to the bottom of ~/.gnupg/gpg.conf: (create the file if it not exists)

@herveguetin
herveguetin / run_method.php
Created May 5, 2015 09:09
Call a Magento model / method from shell
#!/usr/bin/php -f
<?php
require_once 'abstract.php';
class Herve_Run_Method extends Mage_Shell_Abstract
{
protected function _parseArgs()
{
@bradp
bradp / setup.sh
Last active April 18, 2025 02:11
New Mac Setup Script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@jsor
jsor / ddd_cqrs_event-sourcing_in_php.md
Last active July 30, 2024 11:28
DDD, CQRS and Event Sourcing in PHP

DDD, CQRS and Event Sourcing in PHP

  • Broadway - Infrastructure and testing helpers for creating CQRS and event sourced applications
  • EventCentric.Core - Event Sourcing and CQRS in PHP
  • LiteCQRS - Small convention based CQRS library for PHP
  • predaddy - Common DDD classes including an annotation driven message bus and tools for CQRS and Event Sourcing
  • ProophEventSourcing - Provides basic functionality for event-sourced aggregates
  • ProophEventStore - PHP 5.4+ EventStore Implementation
  • ProophServiceBus - PHP Enterprise Service Bus Implementation supporting CQRS and DDD
@ricardo-rossi
ricardo-rossi / ElasticSearch.sh
Last active February 25, 2025 22:09
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
@benmarks
benmarks / data-setup-config-migrate.php
Last active August 29, 2015 13:59
Basic data setup script for migrating config settings using store code.
/* @var $installer Mage_Core_Model_Resource_Setup */
/* @var $storeObj Mage_Core_Model_Store */
$installer = Mage::getResourceModel('core/setup','core_setup');
foreach (Mage::app()->getStores(false,true) as $storeCode => $storeObj) {
switch($storeCode){
case 'somecode':
$path = 'design/theme/default'; //or one of design/theme/{layout|locale|skin|template}
@SchumacherFM
SchumacherFM / README.md
Last active September 21, 2018 10:05
Avoiding database deadlocks in Magento 1.7

After having many deadlocks due to a high order volumne I've applied the these fixes to the core. Some can be found in a Magento forum. Before the fixes we could only process 1 order every 5-10 secs. Updating to Magento 1.8 is currently not an option but in 1-2 months.

1st Deadlock

Mage_Sales_Model_Abstract::_afterSave must be removed and replaced with afterCommitCallback. This is important to move the grid update (of sales_flat_order_grid) out of the transaction.

2nd Deadlock

Rewrite the method of the Mage_CatalogInventory_Model_Observer::reindexQuoteInventory() to remove the price reindexing from the transaction. That index process will also be fired in event sales_model_service_quote_submit_success.