[pLog-svn] r6457 - plog/trunk/class/gallery/dao

Jon Daley plogworld at jon.limedaley.com
Wed May 14 10:19:40 EDT 2008


 	Can you check it into 1.2 then?  You should probably check the bug 
reports where people said it was fixed, to make sure that it doesn't break 
anything for them.  I am not sure why different people are experiencing 
different behavior.

On Wed, 14 May 2008, Mark Wu wrote:

> Actually, it is bug of 1.2 :(
>
> This fix only for those who upgrade from lifetype 1.0.x
>
> For upper case file and lower case file exist at the same system.
>
> So, we have to use File::isReadable() to see if the file exist, if not, then
> use another way ...
>
> Mark
>
>> -----Original Message-----
>> From: plog-svn-bounces at devel.lifetype.net
>> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Jon Daley
>> Sent: Wednesday, May 14, 2008 7:24 PM
>> To: LifeType Developer List
>> Subject: Re: [pLog-svn] r6457 - plog/trunk/class/gallery/dao
>>
>>  	I don't understand this change, and if it is a bug in
>> 1.2, shouldn't we fix it there?  I thought I fixed all of the
>> extension issues in 1.2.  At least the folks who complained
>> about it are now happy?
>>
>> On Wed, 14 May 2008, mark at devel.lifetype.net wrote:
>>
>>> Author: mark
>>> Date: 2008-05-14 03:03:21 -0400 (Wed, 14 May 2008) New
>> Revision: 6457
>>>
>>> Modified:
>>>   plog/trunk/class/gallery/dao/galleryresource.class.php
>>> Log:
>>> Fixed the lower/upper case error of original file  name extension.
>>>
>>> Before 1.1, we used original file extension without any
>> modification. After 1.1, we convert all the extension to lower case.
>>>
>>> So, if user upgrade from 1.0->1.1->1.2, they will get
>> problems about those old files.
>>>
>>> The best way to solve the problem is use File::isReadable
>> to check file exist or not, if the file does not exist, we
>> use the old way to get the file.
>>>
>>> Todo: Maybe we can add a system image "lost.jpg", so we
>> just return the lost.jpg if both files not exist.
>>>
>>> Modified: plog/trunk/class/gallery/dao/galleryresource.class.php
>>> ===================================================================
>>> --- plog/trunk/class/gallery/dao/galleryresource.class.php
>> 2008-05-14 06:58:19 UTC (rev 6456)
>>> +++ plog/trunk/class/gallery/dao/galleryresource.class.php
>> 2008-05-14 07:03:21 UTC (rev 6457)
>>> @@ -201,11 +201,15 @@
>>> 		/**
>>> 		 * @return the encoded name of the file in disk
>>> 		 */
>>> -        function getEncodedFileName()
>>> +        function getEncodedFileName( $encodeExtension = true )
>>>         {
>>>             $fileParts = explode( ".", $this->_fileName );
>>> -            $fileExt = strtolower($fileParts[count($fileParts)-1]);
>>> -            $encodedFileName =
>> $this->getOwnerId()."-".$this->getId().".".$fileExt;
>>> +			if( $encodeExtension )
>>> +				$fileExt =
>> strtolower($fileParts[count($fileParts)-1]);
>>> +			else
>>> +				$fileExt =
>> $fileParts[count($fileParts)-1];
>>> +
>>> +			$encodedFileName =
>>> +$this->getOwnerId()."-".$this->getId().".".$fileExt;
>>>         	return $encodedFileName;
>>>         }
>>>
>>> @@ -465,13 +469,17 @@
>>> 		 */
>>> 		function getOriginalSizeFileName()
>>> 		{
>>> -
>>> -
>>> 			$config =& Config::getConfig();
>>>
>>> 			// encoding the filename if
>> "encoded_file_name" enabled
>>> 			if( $config->getValue(
>> "resources_naming_rule" ) ==
>>> "encoded_file_name" )
>>> +			{
>>> +				$storage = new GalleryResourceStorage();
>>> +				$filePath =
>> $storage->getUserFolder( $this->getOwnerId() );
>>> 				$fileName = $this->getEncodedFileName();
>>> +				if( !File::isReadable(
>> $filePath.$fileName ) )
>>> +					$fileName =
>> $this->getEncodedFileName( false );
>>> +			}
>>> 			else
>>> 				$fileName = $this->getFileName();
>>>
>>>
>>> _______________________________________________
>>> pLog-svn mailing list
>>> pLog-svn at devel.lifetype.net
>>> http://limedaley.com/mailman/listinfo/plog-svn
>>>
>>
>> --
>> Jon Daley
>> http://jon.limedaley.com/
>>
>> The colder the X-ray table, the more of your body is required on it.
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://limedaley.com/mailman/listinfo/plog-svn
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>

-- 
Jon Daley
http://jon.limedaley.com/

If anything just cannot go wrong, it will anyway.
-- Murphy's Fifth Law


More information about the pLog-svn mailing list