Skip to content

Instantly share code, notes, and snippets.

View bdunogier's full-sized avatar

Bertrand Dunogier bdunogier

View GitHub Profile
@bdunogier
bdunogier / curl_progress.php
Created June 16, 2011 22:31
PHP/cURL download progress monitoring
<?php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );
@bdunogier
bdunogier / README.md
Created November 30, 2021 16:29
IBEXA DXP: different user content type for registration per siteaccess

Ibexa DXP has allowed multiple user content types for a while now, but there is no documented, native way to change the user content type used for registration based on the siteaccess.

image

As it turns out, it is quite easy with a bit of tweaking.

The EzSystems\EzPlatformUser\ConfigResolver\ConfigurableRegistrationContentTypeLoader service is used by the registration process to provide the user content type used for

@bdunogier
bdunogier / ezcachedmodule.php
Created September 5, 2012 12:42
Cached module extension*
<?php
class eZCachedModule
{
public static function generate( $file, $args )
{
extract( $args );
$tpl = templateInit();
$tpl->setVariable( 'value', $Params['Value'] );
@bdunogier
bdunogier / file.ini.append.php
Created September 6, 2012 11:16
SummerCamp cluster file.ini
<?php /* #?ini charset="utf-8"?
[ClusteringSettings]
FileHandler=eZDFSFileHandler
[eZDFSClusteringSettings]
MountPointPath=/opt/nfs/ezpublish
DBBackend=eZDFSFileHandlerMySQLiBackend
DBHost=localhost
DBPort=3306
@bdunogier
bdunogier / Blog post with customized fields.md
Last active July 7, 2019 19:48
eZ Platform GraphQL prototype
{
  content (id: 87) {
    fields {
      fieldDefIdentifier
      value {
        ... on TextLineFieldValue {
          value
        }
 ... on RichTextFieldValue {
ArticleContentConnection:
type: relay-connection
inherits:
- DomainContentByIdentifierConnection
config:
nodeType: ArticleContent
@bdunogier
bdunogier / GenerateAbsoluteLocationUriCommand.php
Created December 2, 2015 16:51
How to generate an absolute URI from a Location with eZ Platform
<?php
/**
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace BD\SandboxBundle\Command;
use eZ\Publish\Core\MVC\Symfony\Routing\RouteReference;
use eZ\Publish\Core\MVC\Symfony\SiteAccess;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
curl -v -X POST \
   https://localhost:8000/graphql \
   -H 'Cookie: eZSESSID21232f297a57a5a743894a0e4a801fc3=3p30i5bu4h8seeu6avubimdj4c; eZSESSID98defd6ee70dfb1dea416cecdf391f58=igsqlrp39miio4h4a1ddc7b1et' \
   -F 'operations={"query":"mutation CreateImage($name: String!, $alternativeText: String!, $file: FileUpload!) { createImage( parentLocationId: 51, input: { name: $name, image: {name: \"Son-Gohan\", alternativeText: $alternativeText, file: $file} } ) { _info { id mainLocationId } name image { fileName alternativeText uri } } }","variables":{"file": null, "name": "Gohan", "alternativeText": "Final cell battle"}}' \
   -F 'map={"0":["variables.file"]}' \
   -F "0"=@/Users/bdunogier/Documents/Capture\ d’écran\ 2019-03-07\ à\ 00.50.42.png
@bdunogier
bdunogier / ezpRestDemo.php
Created September 29, 2010 14:41
eZ Publish REST interface developer preview example
<?php
/**
* This file is a demonstration of the eZ PUblish REST API developer preview. It handles oAuth2
* authorization, and will return as-is the JSON content returned by the REST interface.
*
* It doesn't cover the whole thing, but almost, and should give you all you need to get started
* with it !
*
* It accepts a few URL parameters that just change which REST resource is used:
* - resource: the REST resource URI that should be queried: content/node/2,
@bdunogier
bdunogier / request.txt
Created September 25, 2018 07:41
eZ Platform GraphQL: domain articles with body and image
{
content
{
articles(query: { Created: { after: "yesterday" } })
{
title { text }
body { html }
image {
alternativeText
variations(identifier: "large") { uri}