Skip to content

Instantly share code, notes, and snippets.

Avatar

André R. andrerom

View GitHub Profile
@andrerom
andrerom / .gitattributes
Last active June 24, 2021 00:00
Git and how to handle line endings usage for mixed Windows and Mac/Linux clients
View .gitattributes
# Taken from: https://github.com/alexkaratarakis/gitattributes
#
# Auto detect text files and perform LF normalization so files in repo had LF and client translates to CRLF on Windows
* text=auto
# As a bonus also give hints to git on what diff to use
*.cs text diff=csharp
*.cshtml text diff=html
*.csx text diff=csharp
*.sln text eol=crlf merge=union
@andrerom
andrerom / check_row_size.sh
Last active July 16, 2020 11:26 — forked from suya55/check_row_size.sh
mysql row size checker
View check_row_size.sh
#!/bin/bash
#
# usage: mysqldump --no-data | check_row_size.sh
#
#
#
# https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html#row-size-limits
#
@andrerom
andrerom / update_paths.sql
Last active January 9, 2020 15:16
eZ Platform / Publish update var dir paths
View update_paths.sql
-- Update image paths
UPDATE ezimagefile SET filepath = REPLACE(filepath, 'var/storage', 'var/my/storage');
-- Before this you may run legacy script to cleanup dfs data to wipe out caches from the table: php bin/php/dfscleanup.php
-- Update DFS tables (only relevant if you use Clustering)
UPDATE IGNORE ezdfsfile
SET name = REPLACE(name, 'var/storage', 'var/ca/storage'),
name_trunk = REPLACE(name_trunk, 'var/storage', 'var/my/storage'),
name_hash = MD5(REPLACE(name, 'var/storage', 'var/my/storage'))
@andrerom
andrerom / rest_server_load_locations.diff
Last active December 13, 2018 16:41
eZ Platform: Starting point for adding multi load for locations for REST
View rest_server_load_locations.diff
diff --git a/doc/specifications/rest/REST-API-V2.rst b/doc/specifications/rest/REST-API-V2.rst
index 961d311f83..a561074788 100644
--- a/doc/specifications/rest/REST-API-V2.rst
+++ b/doc/specifications/rest/REST-API-V2.rst
@@ -573,6 +573,7 @@ XML Example
<rootMediaFolder media-type="application/vnd.ez.api.Location+xml" href="/api/ezp/v2/content/locations/1/43"/>
<locationByRemoteId media-type="" href="/api/ezp/v2/content/locations{?remoteId}"/>
<locationByPath media-type="" href="/api/ezp/v2/content/locations{?locationPath}"/>
+ <locationByIds media-type="application/vnd.ez.api.LocationList+xml" href="/api/ezp/v2/content/locations{?ids}"/>
<trash media-type="application/vnd.ez.api.Trash+xml" href="/api/ezp/v2/content/trash"/>
@andrerom
andrerom / liip.sh
Last active July 3, 2022 14:33
Shell command to be able to switch between MacOS liip PHP versions + set some default PHP config automatically
View liip.sh
#!/bin/sh
# This simple script lists the installed OSX PHP packages
# and lets you choose which one to activate (by changing the symlink).
# Fairly rudimentary, but it does the job (for me).
#
# Install to (*nix): /usr/local/bin/liip.sh
# Run using: sudo liip
#
# Tip: you can add an alias to your ~/.profile
@andrerom
andrerom / EZP-26748_for_5.4.diff
Created July 17, 2018 10:31
Fix EZP-26748: Wrong image URI when content name has extended UTF characters
View EZP-26748_for_5.4.diff
diff --git a/ezpublish/console b/ezpublish/console
index 6d522a9..df63c07 100644
--- a/ezpublish/console
+++ b/ezpublish/console
@@ -7,6 +7,9 @@
set_time_limit( 0 );
+// Ensure UTF-8 is used in string operations
+setlocale(LC_CTYPE, 'C.UTF-8');
@andrerom
andrerom / composer.json.diff
Last active July 3, 2018 06:37
eZ Platform kernel Symfony 4.0 "compatibility": In case someone wants to help start to fix Sf4.x support in thirdparty dependencies
View composer.json.diff
diff --git a/composer.json b/composer.json
index 4c0dac0129..609e3c807d 100644
--- a/composer.json
+++ b/composer.json
@@ -17,27 +17,23 @@
"ext-SPL": "*",
"ext-xsl": "*",
"ext-curl": "*",
- "symfony/symfony": "^3.4",
- "symfony-cmf/routing": "^1.1|^2.0",
@andrerom
andrerom / api_bc_draft.md
Last active May 24, 2019 18:04
API BC promise DRAFT PROPOSAL
View api_bc_draft.md

Intro

_Many users of eZ software expect that eZ is a reliable company with stable products they can build upon, they are large enterprise customers that build complex applications on top of eZ software. With more frequent major releases several of these customers have expressed concerns about having to change their implementation often, e.g. v5 to v1, and v1 to v2. This document is about eZ more clearly committing to what we have said in the past, and so far followed from v5 to v2; We have a BC policy that allows people to rely on eZ software for the long run.

Draft

About SemVer

eZ Platform, including all packages from eZ Systems AS are following "Semantic Versioning", aka SemVer.

However SemVer is only talking about API changes:

  1. It does not cover changes to implementation; improvements or even new features in the implementation.
@andrerom
andrerom / EZP-28008_platform_1.x.diff
Last active October 5, 2017 10:22
DEBUG SPI Persistence Cache issues on eZ Publish 5.x / eZ Platform 1.x SPI + patches
View EZP-28008_platform_1.x.diff
diff --git a/eZ/Publish/Core/Persistence/Cache/ContentHandler.php b/eZ/Publish/Core/Persistence/Cache/ContentHandler.php
index f63230c6f3..5cdbe039ca 100644
--- a/eZ/Publish/Core/Persistence/Cache/ContentHandler.php
+++ b/eZ/Publish/Core/Persistence/Cache/ContentHandler.php
@@ -146,11 +146,17 @@ public function updateMetadata($contentId, MetadataUpdateStruct $struct)
{
$this->logger->logCall(__METHOD__, array('content' => $contentId, 'struct' => $struct));
- $this->cache
- ->getItem('content', 'info', $contentId)
@andrerom
andrerom / LazyGeneratorCollection.php
Last active June 11, 2022 18:47
Lazy Collection using Generator in PHP (Example, script in bottom of file to test it)
View LazyGeneratorCollection.php
<?php
/**
* Class GeneratorCollection, allows for lazy loaded arrays using Generators withouth it's limitations.
*
* This collection class takes Generator as argument, and allows user to threat it like any kind of array. It will take
* care about storing the values returned from generator so user can iterate over it several times.
*
* NOTE: In current form only works with generators that uses integers as keys (lists).
*/