From: Colin M. <mi...@us...> - 2005-09-09 16:00:36
|
Update of /cvsroot/battletorrent/bmachine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22666 Modified Files: datastore.php Log Message: first user paranoia check wasn't quite right in addNewUser Index: datastore.php =================================================================== RCS file: /cvsroot/battletorrent/bmachine/datastore.php,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** datastore.php 8 Sep 2005 20:43:14 -0000 1.49 --- datastore.php 9 Sep 2005 16:00:28 -0000 1.50 *************** *** 56,60 **** */ function getAll($file) { ! return $this->getAllLock($file, false, $junk); } --- 56,60 ---- */ function getAll($file) { ! return $this->getAllLock($file, $junk); } *************** *** 66,77 **** global $data_dir; - // global $cache; - /* - // if we don't do this, we will get the cached filetime, which could be wrong - clearstatcache(); - - if ( $hold_lock == false && isset($cache[$file]) && $cache[$file]["mtime"] == filemtime("$data_dir/$file") ) { - return $cache[$file]["data"]; - }*/ $handle = fopen("$data_dir/$file", "a+b"); --- 66,69 ---- *************** *** 91,98 **** $h = $handle; } - - // $cache[$file]["mtime"] = filemtime("$data_dir/$file"); - // $cache[$file]["data"] = bdecode( $contents ); - // return $cache[$file]["data"]; return bdecode( $contents ); --- 83,86 ---- *************** *** 104,109 **** function saveOne($file, $data, $hash) { $all = $this->getAllLock($file, true, $h); $all[$hash] = $data; ! $this->saveAll($file, $all, $h); } --- 92,101 ---- function saveOne($file, $data, $hash) { $all = $this->getAllLock($file, true, $h); + if ( !$h ) { + return false; + } + $all[$hash] = $data; ! return $this->saveAll($file, $all, $h); } *************** *** 133,141 **** fwrite($handle,bencode($data)); - /* global $cache; - $cache[$file]["mtime"] = time("$data_dir/$file"); - $cache[$file]["data"] = $data; - */ - fclose($handle); --- 125,128 ---- *************** *** 731,738 **** } - $firstuser = count($users); $isAdmin = false; ! if ( $firstuser || $newusers[$filehash]['IsAdmin'] ) { $isAdmin = true; } --- 718,724 ---- } $isAdmin = false; ! if ( count($users) == 0 || $newusers[$filehash]['IsAdmin'] ) { $isAdmin = true; } |