Skip to content

Instantly share code, notes, and snippets.

View andrerom's full-sized avatar

André R. andrerom

View GitHub Profile
@andrerom
andrerom / gist:4a26757d84794d0f7e27
Created September 5, 2014 09:19
Language filtering in API Content Search
diff --git a/eZ/Publish/Core/Persistence/Legacy/Content/Search/Handler.php b/eZ/Publish/Core/Persistence/Legacy/Content/Search/Handler.php
index 1946db3..3231cee 100644
--- a/eZ/Publish/Core/Persistence/Legacy/Content/Search/Handler.php
+++ b/eZ/Publish/Core/Persistence/Legacy/Content/Search/Handler.php
@@ -103,11 +103,13 @@ class Handler implements SearchHandlerInterface
throw new NotImplementedException( "Facets are not supported by the legacy search engine." );
}
+ $translations = !empty( $fieldFilters['languages'] ) ? $fieldFilters['languages'] : null;
+
@andrerom
andrerom / EZP-23390_B.diff
Created September 28, 2014 21:17
EZP-23390 - Legacy IO loads whole file to get mime type with FS cluster handler
diff --git a/kernel/classes/clusterfilehandlers/ezfsfilehandler.php b/kernel/classes/clusterfilehandlers/ezfsfilehandler.php
index 1689b96..25a153c 100644
--- a/kernel/classes/clusterfilehandlers/ezfsfilehandler.php
+++ b/kernel/classes/clusterfilehandlers/ezfsfilehandler.php
@@ -117,7 +117,16 @@ class eZFSFileHandler implements eZClusterFileHandlerInterface
eZDebugSetting::writeDebug( 'kernel-clustering', ' clearstatcache called on ' . $this->filePath, __METHOD__ );
}
- $this->metaData = file_exists( $this->filePath ) ? stat( $this->filePath ) : false;
+ if ( file_exists( $this->filePath ) )
@andrerom
andrerom / node_cleanup_event.diff
Created March 7, 2015 12:52
Node cleanup accumulator also for events
diff --git a/kernel/classes/ezcontentcachemanager.php b/kernel/classes/ezcontentcachemanager.php
index 6dc5792..4adceeb 100644
--- a/kernel/classes/ezcontentcachemanager.php
+++ b/kernel/classes/ezcontentcachemanager.php
@@ -769,13 +769,17 @@ class eZContentCacheManager
if ( eZContentCache::inCleanupThresholdRange( $cleanupValue ) )
{
+ eZDebug::accumulatorStart( 'node_cleanup_event', '', 'Node cleanup event content/cache (' . count( $nodeList ) . ')' );
$nodeList = ezpEvent::getInstance()->filter( 'content/cache', $nodeList );
@andrerom
andrerom / sf_hard_links.diff
Last active August 29, 2015 14:23
Symfony [Filesystem]: Hard link support, could be useful for things like FOSHttpCache Sf Proxy multi tagging
@andrerom
andrerom / content_gateway.php
Last active January 27, 2016 09:43
coy relations using INSERT INTO SELECT
<?php
/**
* Batch method for copying all relation meta data for copied Content object.
*
* Is meant to be used during content copy, so assumes the following:
* - version number is the same
* - content type, and hence content type attribute is the same
* - relation type is the same
* - target relation is the same
*
@andrerom
andrerom / a - oci8.md
Last active April 30, 2017 17:38
Oracle support in eZ Platform

Todo in regards to getting Oracle support in eZ Platform

We need a few things in order to support Oracle:

  • Development:
  • kernel: There are a few places we parse database "dsn", these needs to understand oci8 dsn as well
    • Or better yet find a way to get rid of it and let doctrine parse this so we can support full doctrine dsn as used by Symfony flex
  • Oracle schema, need someone with Oracle expertise involved to see what we can optimize in the schema
  • Estimate 1-2 weeks (but you need step below to be able to verify)
  • CI: Continues Integration, aka testing of every change, this is the more tricky part. in short oracle does not allow CI services to provide Oracle as an option so we have two options:
  • A: Setup testing of this on Jenkins and buy a license
@andrerom
andrerom / php_lazy_objects.php
Last active August 7, 2020 17:19
PHP RFC: Lazy objects
<?php
/**
* Possible idea for PHP RFC (PHP language feature).
*
* Problem:
* In generic PHP applications, like Drupal, Sylius, Magento, eZ, .... It is common that end user
* finds themselves in situation where the system is either loading too much data for them, or not providing
* enough in order to solve the use case they are working on. This can be on a case by case basis even for single
* end user. In other words it very hard for the system to get that balance right for all users/cases.
@andrerom
andrerom / LazyGeneratorCollection.php
Last active November 10, 2023 14:52
Lazy Collection using Generator in PHP (Example, script in bottom of file to test it)
<?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).
*/
@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
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 / api_bc_draft.md
Last active May 24, 2019 18:04
API BC promise DRAFT PROPOSAL

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.