Forums / Developer / How can I create a new attribute through a script?
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?
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.
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 ;)
Thursday 14 September 2006 7:22:05 am
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.
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
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.