[core] extend kernel code

Author Message

Frederic GUEHO

Thursday 15 February 2007 4:59:30 am

I'd like to change tiny lines of code in some classes of the core of eZ Publish.

But, in order to avoid problems later when upgrading my eZ Publish version, I'd like to do all my changes in an unique extension. So that, when upgrading or re-installing my site, I only have to activate my extension.

Firstly, it seems pretty cool to me and I thought I can do that easily with eZ Publish. But now, I have to do it, I have no idea how to do that.

Any help ?

Thanks.

Fred

Kristof Coomans

Thursday 15 February 2007 6:37:02 am

I think the only solution for this is using the include_path PHP setting. If you make it look first in a dir with your patched files, and afterwards in the current directory, then you can use your own patched kernel files.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

kracker (the)

Thursday 15 February 2007 8:17:32 pm

This is a subject of keen interest for those more suited to php code modifications of the eZ publish kernel, lib aka stock eZ publish.

<i>http://ezpedia.org/wiki/en/ez/creating_and_maintaining_an_ez_publish_patch</i>

While brief and over simplified here is a starting point for others to share their experiences with this subject with everyone.

//kracker

<i>eminem - the way i am .. (instrumentals)</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Frederic GUEHO

Friday 16 February 2007 3:34:58 am

Thanks for your replies but I don't understand :
1 - the include_path recommandation
2 - the ezpedia article

Do you have a simple example for both of them (in which case to use them ? how to use them ?)

Thanks.

Claudia Kosny

Friday 16 February 2007 5:38:34 am

Hi Frederic

PHP uses the include path to find files that are included in other files with include(...) or require(...). If you change the include path, you can make sure that eZ looks first looks in whatever directory you specified, before looking in the default eZ directories.
Example:
Add this to the index.php

$path = 'my_ez_core_replacements';
set_include_path($path . PATH_SEPARATOR . get_include_path());

my_ez_core_replacements is the name of the directory where your patched files are located.

Please note that you can set the include path also in the htaccess or php.ini, which might be better, just check the PHP docu.

Now, when eZ runs a script where include_once('kernel/classes/ezcontentobjecttreenode.php') is called (which is jsut an arbitrary example), PHP will first look for the file my_ez_core_replacements/kernel/classes/ezcontentobjecttreenode.php. If it does not find the file there, it will check the other directories in the include_path.

This will not work like an extension, but you still can keep your changed files in one location and just need to change the include path of your PHP to use the new files.

Claudia

Frederic GUEHO

Wednesday 21 February 2007 4:59:22 am

Ok. Thanks.

Does my new directory need to be in the root of my install ?
Or can I put this new directory elsewhere ?

Claudia Kosny

Wednesday 21 February 2007 10:35:40 am

Hi Frederic

Afaik putting it elsewhere should be fine as long as you provide the correct folder in the setting for the include_path and the folder is accessible by PHP.

Claudia

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 15:00:12
Script start
Timing: Jan 18 2025 15:00:12
Module start 'layout'
Timing: Jan 18 2025 15:00:12
Module start 'content'
Timing: Jan 18 2025 15:00:14
Module end 'content'
Timing: Jan 18 2025 15:00:14
Script end

Main resources:

Total runtime1.0580 sec
Peak memory usage4,096.0000 KB
Database Queries73

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 587.9063152.6250
Module start 'layout' 0.00650.0033 740.531339.4453
Module start 'content' 0.00991.0465 779.9766661.6484
Module end 'content' 1.05640.0016 1,441.625016.1641
Script end 1.0580  1,457.7891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.3451160.0002
Check MTime0.00140.1283160.0001
Mysql Total
Database connection0.00070.069510.0007
Mysqli_queries0.988593.4353730.0135
Looping result0.00090.0885710.0000
Template Total1.023096.720.5115
Template load0.00240.222220.0012
Template processing1.020696.469420.5103
Template load and register function0.00020.021310.0002
states
state_id_array0.00090.081910.0009
state_identifier_array0.00230.219820.0012
Override
Cache load0.00180.1739440.0000
Sytem overhead
Fetch class attribute can translate value0.00120.112740.0003
Fetch class attribute name0.00240.223790.0003
XML
Image XML parsing0.00160.147840.0004
class_abstraction
Instantiating content class attribute0.00000.002290.0000
General
dbfile0.00210.1962240.0001
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs