rename not the enroll file if not deleted

rename not the enroll file if not deleted

napisao/la Peter Easton -
Number of replies: 0
I've been having sporadic problems with the enroll file not being deleted or having to have the file recreated to do the import a second time. what I was wonder if any one has tried to create a clause in the file delete function so that if it can't delete it it would then re name the file.

would this work:
change this...
if(! @unlink($filename)) {
email_to_user(get_admin(), get_admin(), get_string("filelockedmailsubject", "enrol_flatfile"), get_string("filelockedmail", "enrol_flatfile", $filename));
$this->log .= "Error unlinking file $filename\n";
}


to...
if(! @unlink($filename)) {
rename($filename, $filename.date("U"));
email_to_user(get_admin(), get_admin(), get_string("filelockedmailsubject", "enrol_flatfile"), get_string("filelockedmail", "enrol_flatfile", $filename));
$this->log .= "Error unlinking file $filename\n";
}


if anybody has anything better please let me know.

Pete
Prosjek ocjena: -