sub DeletePage {
...
my $data;
for ($i= 1001; ; ++$i) {
$fname = &UserDataFilename($i);
($status, $data) = &ReadFile($fname); # (1) see to the end of bucle
%UserData = split(/$FS1/, $data, -1); # (2) see to the end of bucle
last unless scalar %UserData;
if ($UserData{'interest'}) {
%UserInterest = split(/$FS2/, $UserData{'interest'}, -1);
foreach (sort (keys (%UserInterest))) {
if ($page eq $_) {
delete $UserInterest{$page};
print $UserData{username} . '(' . T('Interest') . ')' . '
'; # optional
$UserData{'interest'} = join($FS2, %UserInterest);
$data = join($FS1, %UserData);
&WriteStringToFile($userFile, $data);
}
}
}
}
# (1) and (2) yield effect as updating some user-parameters, the next line does updating again true values (without refresh page)
&LoadUserData($UserID);
In turn, as you can observe, it can appear an "edit conflict". An admin user can be trying to modify his/her preferences and actions system (delete and rename $UserData{'interest'}) be on modifying userfiles ... --JuanmaMP
Thank you :-)