Skip to content

Instantly share code, notes, and snippets.

View bdunogier's full-sized avatar

Bertrand Dunogier bdunogier

View GitHub Profile
RewriteRule ^/soap.php - [L]
RewriteRule ^/webdav.php - [L]
RewriteRule ^/content/treemenu/? index_treemenu.php
RewriteRule ^/index_treemenu.php - [L]
RewriteRule ^/var/storage/.* - [L]
RewriteRule ^/var/[^/]+/storage/.* - [L]
RewriteRule ^/var/[^/]+/cache/public/.* - [L]
<VirtualHost *:80>
ServerName site.com
ServerAlias *.site.com
DocumentRoot /var/www/ezpublish
RewriteEngine On
Include conf.d/ez-rewrite.conf
</VirtualHost>
<?php
static function definition()
{
static $definition = array( "fields" => array( "id" => array( 'name' => 'ID',
'datatype' => 'integer',
'default' => 0,
'required' => true ),
"section_id" => array( 'name' => "SectionID",
'datatype' => 'integer',
'default' => 0,
@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,
<?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 / ezshardbinaryfiles.php
Created December 29, 2010 13:01
Shards binary files in ezpublish storage directory to avoid running out of iNodes
#!/usr/bin/env php
<?php
/**
* File containing the shardfiles.php script
*
* @copyright Copyright (C) 1999-2010 eZ Systems AS. All rights reserved.
* @license http://ez.no/licenses/gnu_gpl GNU GPL v2
* @version //autogentag//
* @package
*/
<?php
/**
* File containing the eZDatatypeTest class
*
* @copyright Copyright (C) 1999-2010 eZ Systems AS. All rights reserved.
* @license http://ez.no/licenses/gnu_gpl GNU GPLv2
* @package tests
*/
/**
@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 );
<?php
/**
* Tests processing of URL items found in the XML
*/
public function testProcessRelatedContent()
{
$idArray = array( 1, 2, 3 );
$version = $this->getMock( 'ezp\\Content\\Version' );
$version->id = 1;
<?php
/**
* PHP version of the rewrite rules that were previously used to enable multi-site in a cluster environnement
*
* Each site has its own file, based on its vardir subcomponent: var/plain_site/ => config.cluster/plain_site.php.
* The cluster rewrite rules send everything to index_cluster.php, for every site.
**/
if ( !$siteId = preg_match( "|^/var/([^/]+)/|", $_SERVER['SCRIPT_URL'], $m ) )
// error 404
// exit