I was having problems renaming monitors. If I renamed monitor named XYZ to ABC, all seemed to work. However, the link in the Events directory pointing to the Monitor ID directory, was still named XYZ. It seems the following 'if' clause in zm_actions.php was never executing.
if ( $changes['Name'] )
{
exec( escapeshellcmd( "mv ".EVENTS_PATH."/".$monitor['Name']." ".EVENTS_PATH."/".$new_monitor['Name'] ) );
}
I think the getFormChanges function is not returning an array with named keys. Consequently the item $changes['Name'] does not actually exist. $changes[n] is returned instead.
I went to getFormChanges in zm_funcs.php and changed this:
default :
{
if ( $values[$key] != $value )
{
$changes[] = "$key = '$value'";
}
break;
to this:
default :
{
if ( $values[$key] != $value )
{
$changes[$key] = "$key = '$value'";
}
break;
The code to rename the directory now attempted to execute but failed trying to find the directory to rename.
I changed
exec( escapeshellcmd( "mv ".EVENTS_PATH."/".$monitor['Name']." ".EVENTS_PATH."/".$new_monitor['Name'] ) );
to
exec( escapeshellcmd( "mv ".ZM_DIR_EVENTS."/".$monitor['Name']." ".ZM_DIR_EVENTS."/"$new_monitor['Name'] ) );
It now works. Renaming the monitor now also creates a renamed link in the events directory. I don't know if this has consequences elsewhere in the program.
Hope I'm right and hope it helps
tommy
Renamin Monitors
You would be absolutly correct (Well mostly at least, I'm no expert). PHP is really relaxed on declairing things and will create the function. I think the veriable was the key but I'll test and find out. Thank you for the report and the posible fix. I'll get this in the next rpm due out this weekend if all goes well and remove my temp hack for export events.
Regards,
Cordel
Regards,
Cordel
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact: