posix_getpwuid doesn't exist on windows
[gitphp.git] / include / gitutil.git_project_owner.php
blob:a/include/gitutil.git_project_owner.php -> blob:b/include/gitutil.git_project_owner.php
--- a/include/gitutil.git_project_owner.php
+++ b/include/gitutil.git_project_owner.php
@@ -9,10 +9,13 @@
 
 function git_project_owner($projectroot,$project)
 {
-	$data = posix_getpwuid(fileowner($projectroot . $project));
-	if (isset($data['gecos']) && (strlen($data['gecos']) > 0))
-		return $data['gecos'];
-	return $data['name'];
+	if (function_exists('posix_getpwuid')) {
+		$data = posix_getpwuid(fileowner($projectroot . $project));
+		if (isset($data['gecos']) && (strlen($data['gecos']) > 0))
+			return $data['gecos'];
+		return $data['name'];
+	} else
+		return "";
 }
 
 ?>

comments