diff options
author | Josh Hoyt <josh@janrain.com> | 2006-09-27 00:01:41 +0000 |
---|---|---|
committer | Josh Hoyt <josh@janrain.com> | 2006-09-27 00:01:41 +0000 |
commit | 48a7695d73dba1111201efeaac8355803194a3e9 (patch) | |
tree | d0d059a634a12f5dd8a888d77589c7dd88ab0583 | |
parent | 21b4ebdcc5495e9da4d2abc7fecf98d228ea0fb2 (diff) | |
download | php-openid-48a7695d73dba1111201efeaac8355803194a3e9.zip php-openid-48a7695d73dba1111201efeaac8355803194a3e9.tar.gz php-openid-48a7695d73dba1111201efeaac8355803194a3e9.tar.bz2 |
[project @ link() doesn't exist on Windows, so implement work-around]
-rw-r--r-- | Auth/OpenID/FileStore.php | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Auth/OpenID/FileStore.php b/Auth/OpenID/FileStore.php index 2d49b77..0cc682d 100644 --- a/Auth/OpenID/FileStore.php +++ b/Auth/OpenID/FileStore.php @@ -164,17 +164,20 @@ class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore { fflush($file_obj); fclose($file_obj); - if (!link($tmp, $this->auth_key_name)) { + if (function_exists('link')) { + // Posix filesystem + $saved = link($tmp, $this->auth_key_name); + Auth_OpenID_FileStore::_removeIfPresent($tmp); + } else { + // Windows filesystem + $saved = rename($tmp, $this->auth_key_name); + } + + if (!$saved) { // The link failed, either because we lack the permission, // or because the file already exists; try to read the key // in case the file already existed. $auth_key = $this->readAuthKey(); - - if (!$auth_key) { - return null; - } else { - Auth_OpenID_FileStore::_removeIfPresent($tmp); - } } return $auth_key; |