Forums / Developer / [core] extend kernel code

[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

eZ debug

Timing: Jan 18 2025 10:25:52
Script start
Timing: Jan 18 2025 10:25:52
Module start 'content'
Timing: Jan 18 2025 10:25:52
Module end 'content'
Timing: Jan 18 2025 10:25:52
Script end

Main resources:

Total runtime0.1816 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 588.8203180.8438
Module start 'content' 0.00780.0050 769.6641101.9922
Module end 'content' 0.01280.1688 871.6563526.1484
Script end 0.1816  1,397.8047 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00362.0051200.0002
Check MTime0.00140.7920200.0001
Mysql Total
Database connection0.00060.346310.0006
Mysqli_queries0.131272.23651410.0009
Looping result0.00140.76751390.0000
Template Total0.168392.710.1683
Template load0.00090.491710.0009
Template processing0.167492.170710.1674
Override
Cache load0.00060.355610.0006
Sytem overhead
Fetch class attribute can translate value0.00070.406910.0007
XML
Image XML parsing0.00020.128910.0002
General
dbfile0.00221.2097200.0001
String conversion0.00000.003030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs