zotonic/zotonic — Issue #244: #238 breaks m_config:set_value/4
Author: kaos
Created: 2011-10-27 14:59:56+00:00
State: open

=SUPERVISOR REPORT==== 27-Oct-2011::16:41:05 ===
Supervisor: {<0.184.0>,z_site_sup}
Context: start_error
Reason: {'EXIT',{{case_clause,[]},
[{m_config,set_value,4},
{z_site_startup,start_link,1},
{supervisor,do_start_child,2},
{supervisor,start_children,3},
{supervisor,init_children,2},
{gen_server,init_it,6},
{proc_lib,init_p_do_apply,3}]}}
Offender: [{pid,undefined},
{name,z_site_startup},
{mfargs,
{z_site_startup,start_link,
[[{enabled,true},
{host,maberlz},
{hostname,"xxxx"},
{dbdatabase,"zotonic"},
{dbschema,"public"},
{admin_password,"xxxx"}]]}},
{restart_type,permanent},
{shutdown,5000},
{child_type,worker}]

The case only expects a 0 or 1:

case z_db:q("update config set value = $1, modified = now() where module = $2 and key = $3", [Value, Module, Key], Context) of
0 -> z_db:insert(config, [{module,Module}, {key, Key}, {value, Value}], Context);
1 -> ok
end,

but 0 is now always translated to []... so this could creep up in alot of places, right?

I suggest improving the solution of issue #238.