jrGallery db_update_item listener
Jamroom Developers
Yes, that's what I'm trying too avoid, but it's many separate db_update_item triggers - from a db_update_item listener I'm not sure how to unset the flag after the last image has been updated. There's no way of telling if it's the last iteration. Also no way of passing the old gallery title (which I would have to get from the db on the first item) between iterations, so I would be getting from and then writing to the database for each image.
Here is a listener with an fdebug to the log:
function ujHotspots_db_update_item_listener($_data, $_user, $_conf, $_args, $event)
{
if (isset($_args['module']) && $_args['module'] == 'jrGallery') {
fdebug("ujHotspots_db_update_item_listener",$_data,$_args, $event);
}
return $_data;
}
And here is the output ($_data,$_args, $event) for a 2 image gallery:
Quote: (2017-12-28T20:04:42+00:00.0.68599500 : 0.012)-(mem: 2MB)-(pid: 6174)-(ip: 92.238.255.12)-(user: SteveX)-(uri: POST /gallery/update_save/__ajax=1)
|ujHotspots_db_update_item_listener|
(2017-12-28T20:04:42+00:00.0.68599500 : 0.012)-(mem: 2MB)-(pid: 6174)-(ip: 92.238.255.12)-(user: SteveX)-(uri: POST /gallery/update_save/__ajax=1)
Array
(
[gallery_title] => Banksy Gallery
[gallery_title_url] => banksy-gallery
[gallery_order] => 2
[_updated] => 1514393591
)
(2017-12-28T20:04:42+00:00.0.68599500 : 0.012)-(mem: 2MB)-(pid: 6174)-(ip: 92.238.255.12)-(user: SteveX)-(uri: POST /gallery/update_save/__ajax=1)
Array
(
[_item_id] => 1
[module] => jrGallery
[jrcore_unique_trigger_id] => 9815d1287d1054c2ac358c9460db6667
)
(2017-12-28T20:04:42+00:00.0.68599500 : 0.012)-(mem: 2MB)-(pid: 6174)-(ip: 92.238.255.12)-(user: SteveX)-(uri: POST /gallery/update_save/__ajax=1)
|db_update_item|
(2017-12-28T20:04:42+00:00.0.68698600 : 0.013)-(mem: 2MB)-(pid: 6174)-(ip: 92.238.255.12)-(user: SteveX)-(uri: POST /gallery/update_save/__ajax=1)
|ujHotspots_db_update_item_listener|
(2017-12-28T20:04:42+00:00.0.68698600 : 0.013)-(mem: 2MB)-(pid: 6174)-(ip: 92.238.255.12)-(user: SteveX)-(uri: POST /gallery/update_save/__ajax=1)
Array
(
[gallery_title] => Banksy Gallery
[gallery_title_url] => banksy-gallery
[gallery_order] => 3
[_updated] => 1514393591
)
(2017-12-28T20:04:42+00:00.0.68698600 : 0.013)-(mem: 2MB)-(pid: 6174)-(ip: 92.238.255.12)-(user: SteveX)-(uri: POST /gallery/update_save/__ajax=1)
Array
(
[_item_id] => 2
[module] => jrGallery
[jrcore_unique_trigger_id] => 002d51479d35e48108c6a997fd295506
)