Modify a content class via script

Author Message

Jérôme Vieilledent

Saturday 07 February 2009 6:58:40 am

Hi

Does anybody know if it is possible to (easily) modify a content class with a PHP script ?
Indeed, I sometimes have to add/remove attributes in my content classes to satisfy the new needs of my clients. The problem is that I have to do this in the admin, on my dev environment, on the pre-production environment and finally on the production environment. That's annoying and it can be dangerous if you forget something...

Thanks for your help

Łukasz Serwatka

Saturday 07 February 2009 12:23:46 pm

Hi,

You can take a look on code in this contribution. It should give you some ideas how to add attributes on PHP level.

http://ez.no/developer/contribs/hacks/update_class_from_command_line

See also user comments.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

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 31 2025 03:29:18
Script start
Timing: Jan 31 2025 03:29:18
Module start 'layout'
Timing: Jan 31 2025 03:29:18
Module start 'content'
Timing: Jan 31 2025 03:29:18
Module end 'content'
Timing: Jan 31 2025 03:29:18
Script end

Main resources:

Total runtime0.0317 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.1406151.2109
Module start 'layout' 0.00580.0075 739.3516220.7031
Module start 'content' 0.01330.0167 960.0547997.8047
Module end 'content' 0.03000.0017 1,957.859429.9922
Script end 0.0316  1,987.8516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00309.4807140.0002
Check MTime0.00123.8101140.0001
Mysql Total
Database connection0.00082.582410.0008
Mysqli_queries0.005918.667230.0020
Looping result0.00000.079010.0000
Template Total0.00113.510.0011
Template load0.00092.900810.0009
Template processing0.00020.621710.0002
Override
Cache load0.00062.004410.0006
General
dbfile0.00247.554680.0003
String conversion0.00000.028640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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