How can I create a new attribute through a script?

Author Message

K259

Monday 11 September 2006 4:13:42 am

I have a class called article. If I add an attribute to this article in the admin-interface, I get a timeout and only some articles stored in the database get this attribute.

The solution is to add this attribute to the class, and to the existing objects of this class in the database by using a script, but how?

Are there any script for this available today for ez? I've seen many postings about this, but haven't found any links to scripts, only text that says: you have to create this in the db through a script if your database already contains too many objects of this class..then it will not work adding this in the ez admin interface.

Hope someone can help.

Kristof Coomans

Monday 11 September 2006 4:28:22 am

Hi K

I think you can use this one: http://ez.no/community/contribs/hacks/update_class_from_command_line

Enable the apply button in the class edit interface, that will make storing your temporary class version easier. In content.ini.append.php:

[ClassSettings]
ApplyButton=enabled

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

Atle Pedersen

Thursday 14 September 2006 1:04:28 am

What is the reason for this problem? PHP execution timeout? Would it solve the problem just (temporarily) increasing the timeout value?

K259

Thursday 14 September 2006 4:26:41 am

No, it will not help us so much. With too many objects, there "will be" a timeout. We already got the limit too high.

K259

Thursday 14 September 2006 4:28:05 am

Btw. Is it possible to fix this through mysql? I prefer fixing these things with sql rather than messing around with scripts and versions of classes ;)

Kristof Coomans

Thursday 14 September 2006 7:22:05 am

Hi K

I think running plain SQL queries to do this could mess up your eZ publish database more than using CLI scripts and some kernel functions.

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

Claudia Kosny

Thursday 14 September 2006 2:34:46 pm

Hello K259

Did you try the script mentioned by Kristof? I might need something like this later on and would be interested in the results you got with it.

Claudia

K259

Friday 15 September 2006 12:03:37 am

Hi Claudia!

No, I'm thinking about another solution. There have to be a better and easier way to do this.

K259

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 14:55:06
Script start
Timing: Jan 18 2025 14:55:06
Module start 'layout'
Timing: Jan 18 2025 14:55:06
Module start 'content'
Timing: Jan 18 2025 14:55:07
Module end 'content'
Timing: Jan 18 2025 14:55:07
Script end

Main resources:

Total runtime0.8382 sec
Peak memory usage4,096.0000 KB
Database Queries76

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 588.0469152.6406
Module start 'layout' 0.00640.0036 740.687539.4922
Module start 'content' 0.00990.8267 780.1797659.9531
Module end 'content' 0.83660.0015 1,440.132816.1250
Script end 0.8381  1,456.2578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4160160.0002
Check MTime0.00150.1785160.0001
Mysql Total
Database connection0.00080.101110.0008
Mysqli_queries0.771992.1000760.0102
Looping result0.00080.0956740.0000
Template Total0.801995.720.4009
Template load0.00210.251720.0011
Template processing0.799795.417220.3999
Template load and register function0.00020.022310.0002
states
state_id_array0.00150.183310.0015
state_identifier_array0.00150.175520.0007
Override
Cache load0.00180.2106320.0001
Sytem overhead
Fetch class attribute can translate value0.00110.126240.0003
Fetch class attribute name0.00120.1431100.0001
XML
Image XML parsing0.00140.161140.0003
class_abstraction
Instantiating content class attribute0.00000.0024110.0000
General
dbfile0.00300.3535220.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
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.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: 22
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs