thanks Simon
//Windows 9x FLOCK Alternative - Chozo4 //Passes multiple instance stress testing //http://mechresource.myvnc.com/board //Modified (breaks and returns 0 on failure, // or returns 1 on success) by Mateusz Czaplinski, 22.01.2008 function aquirelock($wp) { //Check if lock doesn't exist or our target is unwritable if(file_exists("$wp.l") || !is_writable($wp)) return 0; //create the lock - hide warnings and pass empty if already created from racing return @ fopen("$wp.l", 'x'); } function dblock($wp) { global $TotalCounterEnableChmods; //Check for lockfile handle - if empty , another process raced the lock so report a failure $ftw = aquirelock($wp); if( !$ftw ) return 0; if($TotalCounterEnableChmods) chmod($wp, 0444); //set the target file to read-only // LINE 1163 fwrite($ftw, 'lock'); //write the lockfile with 4bytes if($TotalCounterEnableChmods) chmod("$wp.l", 0444); //set the lockfile to read only (OPTIONAL) fclose($ftw); //close our lockfile clearstatcache(); //Clear the stat cache return 1; } // Note: don't call it if 'dblock()' returned 0 ! function dbexport_unlock($wp, $data, $meth) { global $TotalCounterEnableChmods; if($TotalCounterEnableChmods) chmod($wp, 0666); //Set the target file to read+write // LINE 1174 //Write the passed string to the target file then close fwrite($ftw = fopen($wp, $meth), $data); fclose($ftw); //Validate the written data ujsing a string comparison $check = file_get_contents($wp); if ($check != $data) echo "Data Mismatch - Locking FAILED!<br>"; chmod("$wp.l", 0666); //Set the lockfile to read+write (OPTIONAL) unlink("$wp.l"); //Release the lockfile by removing it } On 6 September 2012 13:30, Weldon Sams <wjs...@gmail.com> wrote: > Would you copy some of the lines around 1174 in a reply? > > Weldon > > > On Wed, Sep 5, 2012 at 5:08 AM, Simon <nzsk...@gmail.com> wrote: > >> I'm seeing lots of errors in my log >> >> [25-Aug-2012 14:33:42] PHP Warning: chmod() [<a >> href='function.chmod'>function.chmod</a>]: Operation not permitted in >> /home/ttc/public_html/pmwiki/cookbook/totalcounter.php on line 1163 >> [25-Aug-2012 14:33:42] PHP Warning: chmod() [<a >> href='function.chmod'>function.chmod</a>]: Operation not permitted in >> /home/ttc/public_html/pmwiki/cookbook/totalcounter.php on line 1174 >> >> Can anyone give me a quick heads up on what might need to be fixed? >> >> ta >> >> Simon >> > > -- ____ http://kiwiwiki.co.nz
_______________________________________________ pmwiki-devel mailing list pmwiki-devel@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-devel