From a11d39d8f6713c3d9c51a26e5df9cb0fe517057a Mon Sep 17 00:00:00 2001
From: paul <paul@cfc7b370-4200-0410-a6e3-cb6bdb053afe>
Date: Fri, 12 Jan 2007 06:11:35 +0000
Subject: [PATCH] Another fix for bug #2114 - after command line import, a file
 could not be added to the live mode.  There were two problems: an incorrect
 API call, and the new feature which only makes symlinks to files (to fix the
 double-disk space problem) caused problems because files_exists() didnt work
 anymore.

---
 campcaster/src/modules/storageServer/var/BasicStor.php | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/campcaster/src/modules/storageServer/var/BasicStor.php b/campcaster/src/modules/storageServer/var/BasicStor.php
index 1562ac781..10e47e502 100644
--- a/campcaster/src/modules/storageServer/var/BasicStor.php
+++ b/campcaster/src/modules/storageServer/var/BasicStor.php
@@ -93,8 +93,9 @@ class BasicStor {
         if (PEAR::isError($id)) {
             return $id;
         }
-        $storedFile = StoredFile::insert($id, $fileName,
-            $localFilePath, $metadataFilePath, $mdataLoc, $gunid, $ftype, 'StoredFile', $copyMedia);
+        $storedFile = StoredFile::Insert($id, $fileName,
+            $localFilePath, $metadataFilePath, $mdataLoc, $gunid, $ftype,
+            $copyMedia);
         if (PEAR::isError($storedFile)) {
             $res = BasicStor::RemoveObj($id);
             // catch constraint violations
@@ -380,7 +381,7 @@ class BasicStor {
         $token = StoredFile::CreateGunid();
         if (!is_null($realFname)) {
             $linkFname = $CC_CONFIG['accessDir']."/$token.$ext";
-            if (!file_exists($realFname)) {
+            if (!is_file($realFname) && !is_link($realFname)) {
                 return PEAR::raiseError(
                     "BasicStor::bsAccess: real file not found ($realFname)",
                     GBERR_FILEIO);