Page 1 of 1

table "module_news_fielddefs" breaking upgrade [solved]

Posted: Wed Apr 09, 2008 3:47 pm
by hedgomatic
Hi,

I'm upgrading to v1.2.4 from v1.0.2 (schema 25 to 29), and everything goes well aside from the following:

string(67) "Smarty error: unable to read resource: "module_db_tpl:News;summary""


on the main page.

Searching the forums, I've seen it mentioned that I'll need to create default news templates.

After creating my news template via the content->news->default template tab, I'm taken to what looks like an options screen with the following error:

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\cms_old\modules\News\function.admin_customfieldstab.php on line 9

The page then immediately refreshes and I'm back at the news templates screen. It *appears* as if the template has saved, as the content is prepopulated into the text area.


I've noticed that since around the 26 or 27 schema, two new news tables have been added, so this is probably an upgrade issue a number of people experienced around 1.1...I get similar errors upgrading to that first.

Opening up customfieldstab.php, I notice the foreach is looping through an assumed result set from one of the new tables, which looks like it should be pulling an array of IDs from existing news content, but none are available since the news in question existed before this table.

table "module_news_fielddefs" seems to be the culprit.


Any ideas greatly appreciated. Thanks.

Re: table "module_news_fielddefs" breaking upgrade

Posted: Wed Apr 09, 2008 4:47 pm
by hedgomatic
few other observations.

the first error seems to be coming from modtemplates.inc.php, on line 220:

$result = $smarty->fetch('module_db_tpl:'.$modulename.';'.$tpl_name, '', ($designation != ''?$designation:$modulename));

presumably because of the second error which comes from, as it says, the news module's function.admin_customfieldstab.php page, where it tries to get an array of rows from module_news_fielddefs, but the table is empty since it's just been created.

passing the array onto foreach without first checking that it exists is causing the error there. I'm not sure why the page auto-refreshes back to the template page though.

from the looks of it it just really, really wants data in those new tables.

Re: table "module_news_fielddefs" breaking upgrade

Posted: Fri Apr 11, 2008 5:45 pm
by hedgomatic
I managed to fix this by doing a clean install in a new directory of the latest version, then modifying the config to use my old database, then logging into the admin and upgrading the schema.

Re: table "module_news_fielddefs" breaking upgrade [solved]

Posted: Thu May 01, 2008 4:05 am
by websherpa
I'm just upgrading from 1.0.2 Maui to 1.2.4 Greenland (the ultimate procrastinator  - haven't done my taxes either) and I'm getting the same error in the Field Definitions tab:

Warning: Invalid argument supplied for foreach() in /hsphere/local/home/posseproject/posseproject.ca/modules/News/function.admin_customfieldstab.php on line 9

It looks like ther are two tables missing from my MySQL database: cms_module_news_fielddefs and cms_module_news_fieldvals but I don't know what / whether / how I should be creating these manually.

I've managed to fix most of the other nebulous (to a newbie) issues with upgrading the news module ... but this one remains a mystery.

Any help on this one? (Please, and thank you in advance.)

Wayne