[pLog-svn] r5988 - plog/branches/lifetype-1.2/class/gallery/dao
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Mon Oct 15 16:34:49 EDT 2007
Author: oscar
Date: 2007-10-15 16:34:49 -0400 (Mon, 15 Oct 2007)
New Revision: 5988
Modified:
plog/branches/lifetype-1.2/class/gallery/dao/galleryresourcestorage.class.php
Log:
Fixed an issue with the previous commit. We have to check if the resource actually has any previews/medium previews before attempting to move them or else we'll generate a warning message.
Modified: plog/branches/lifetype-1.2/class/gallery/dao/galleryresourcestorage.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/gallery/dao/galleryresourcestorage.class.php 2007-10-15 20:31:33 UTC (rev 5987)
+++ plog/branches/lifetype-1.2/class/gallery/dao/galleryresourcestorage.class.php 2007-10-15 20:34:49 UTC (rev 5988)
@@ -429,26 +429,28 @@
// check that the permissions are correct
File::chMod( $destFile, 0755 );
- // move the preview
- $fileName = $this->getPreviewsFolder( $prevOwnerId ) . $resource->getPreviewFileName();
- $destFile = $this->getPreviewsFolder( $newOwnerId ) . $resource->getPreviewFileName();
- $res = File::rename( $fileName, $destFile );
- if( !$res )
- return false;
+ // move the preview and the medium preview, but only if available
+ if( $resource->hasPreview()) {
+ $fileName = $this->getPreviewsFolder( $prevOwnerId ) . $resource->getPreviewFileName();
+ $destFile = $this->getPreviewsFolder( $newOwnerId ) . $resource->getPreviewFileName();
+ $res = File::rename( $fileName, $destFile );
+ if( !$res )
+ return false;
- // check that the permissions are correct
- File::chMod( $destFile, 0755 );
+ // check that the permissions are correct
+ File::chMod( $destFile, 0755 );
- // move the medium size preview
- $fileName = $this->getMediumSizePreviewsFolder( $prevOwnerId ) . $resource->getMediumSizePreviewFileName();
- $destFile = $this->getMediumSizePreviewsFolder( $newOwnerId ) . $resource->getMediumSizePreviewFileName();
- $res = File::rename( $fileName, $destFile );
+ // move the medium size preview
+ $fileName = $this->getMediumSizePreviewsFolder( $prevOwnerId ) . $resource->getMediumSizePreviewFileName();
+ $destFile = $this->getMediumSizePreviewsFolder( $newOwnerId ) . $resource->getMediumSizePreviewFileName();
+ $res = File::rename( $fileName, $destFile );
- if( !$res )
- return false;
+ if( !$res )
+ return false;
- // check that the permissions are correct
- File::chMod( $destFile, 0755 );
+ // check that the permissions are correct
+ File::chMod( $destFile, 0755 );
+ }
return true;
}
More information about the pLog-svn
mailing list