Piotras | 7 Mar 08:18

Sitegroup issue!


	Hi,

First. Tarjei, great thanks for discovering this issue!

We have serious sitegroup issue, and again it's somehow caused by midgard
logic ( legacy core ) shared between midgard-core and midgard-php.

What happens when you want to update object's sitegroup and you set sitegroup 
property with some value and call update method? Internal UPDATE_REPLIGARD 
macro is used then,  after object's record was successfully updated. 
But the problem is that this macro is not sitegroup aware!

command = mgd_format(mgd, mgd->tmp,
                               "UPDATE $s SET locked=1,author=$d,$s WHERE id=$d AND realm=$q",
                               "repligard", mgd->current_user->id, fields, id, table);

It's easy to notice that after calling update method , object's record has sitegroup value updated 
while repligard entry has still old value , so in practice this object doesn't exist.

Interesting thing is that old setsitegroup method updates sitegroup value.

   php_midgard_update(return_value,
      (*zv_table)->value.str.val,
      "sitegroup=$d", (*zv_id)->value.lval,
      (*zv_sitegroup)->value.lval);
   mgd_update_repligard(mgd_handle(), (*zv_table)->value.str.val, (*zv_id)->value.lval,
      "sitegroup=$d", (*zv_sitegroup)->value.lval);

I will review all sitegroup's related code in HEAD and in 1-7 branch tomorrow. 
Any help with testing stable branch is appreciated! 

I doubt that such issue may trigger #118 ( magic number :) , but one never knows in practice.

Piotras

Gmane