Update of /cvsroot/phpwiki/phpwiki/lib/pear
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15781/pear
Modified Files:
File_Passwd.php
Log Message:
renamed DB_Session to DbSession (in CVS also)
added WikiDB->getParam and WikiDB->getAuthParam method to get rid of globals
remove leading slash in error message
added force_unlock parameter to File_Passwd (no return on stale locks)
fixed adodb session AffectedRows
added FileFinder helpers to unify local filenames and DATA_PATH names
editpage.php: new edit toolbar javascript on ENABLE_EDIT_TOOLBAR
Index: File_Passwd.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/pear/File_Passwd.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -2 -b -p -d -r1.6 -r1.7
--- File_Passwd.php 26 Apr 2004 20:44:36 -0000 1.6
+++ File_Passwd.php 27 May 2004 17:49:06 -0000 1.7
@@ -89,5 +89,16 @@ class File_Passwd {
}
- if($lock) {
+ if ($lock) {
+ //check if already locked, on some error or race condition or other user.
+ //FIXME: implement timeout as with dba
+ if (file_exists($this->lockfile)) {
+ if (isset($GLOBALS['HTTP_GET_VARS']['force_unlock'])) {
+ $this->fplock = fopen($this->lockfile, 'w');
+ flock($this->fplock, LOCK_UN);
+ fclose($this->fplock);
+ } else {
+ trigger_error('File_Passwd lock conflict: Try &force_unlock=1',E_USER_NOTICE);
+ }
+ }
$this->fplock = fopen($this->lockfile, 'w');
flock($this->fplock, LOCK_EX);
@@ -96,5 +107,5 @@ class File_Passwd {
$fp = fopen($file,'r') ;
- if( !$fp) {
+ if( !$fp ) {
return new PEAR_Error( "Couldn't open '$file'!", 1, PEAR_ERROR_RETURN) ;
}
@@ -112,5 +123,5 @@ class File_Passwd {
}
fclose($fp);
- } // end func File_Passwd()
+ }
/**
@@ -221,5 +232,5 @@ class File_Passwd {
*/
function close() {
- if($this->locked) {
+ if ($this->locked) {
foreach($this->users as $user => $pass) {
if (isset($this->cvs[$user])) {
|