[Linpha-cvs] SF.net SVN: linpha: [4427] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-03-22 19:10:33
|
Revision: 4427 Author: fangehrn Date: 2006-03-22 11:10:20 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4427&view=rev Log Message: ----------- * checked if bug with fatal error on not readable also exists in linpha2 -> does not * added "lost+found" to ignore filelist * documented import methods Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.import.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-21 23:14:00 UTC (rev 4426) +++ trunk/linpha2/ChangeLog 2006-03-22 19:10:20 UTC (rev 4427) @@ -1,4 +1,10 @@ 2006-03-22 flo + * checked if bug with fatal error on not readable also exists in linpha2 + -> does not + * added "lost+found" to ignore filelist + * documented import methods + +2006-03-21 flo * finished browse by date feature 2006-03-20 flo Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-03-21 23:14:00 UTC (rev 4426) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-03-22 19:10:20 UTC (rev 4427) @@ -20,6 +20,11 @@ class linImport { +/** + * update selected directory + * add new dirs/files, delete old ones + * if recursive, all sub directories are checked too! + */ function updateDir($parent_id, $recursive) { /** @@ -82,7 +87,6 @@ */ foreach($array_new AS $value) { - /** * no output as it would occur on each view! */ @@ -146,52 +150,9 @@ } } -function addNew( $parent_id , $dirname , $recursive) -{ - $d = dir( $dirname ); - - while( false !== ($entry = $d->read() ) ) - { - $ext = linFilesys::getFileExtFromPath($entry); - if($entry == '.' OR $entry == '..') - { - //no output - } - elseif($entry{0} == '.') - { - linSysLog('hidden'); - } - elseif( in_array( $entry, linImport::getIgnoreFilelist() ) ) - { - linSysLog('ignore'); - } - elseif( in_array($ext, linImport::getIgnoreFileext() ) ) - { - linSysLog('ignore'); - } - elseif( !is_readable( $dirname.$entry) ) - { - linSysLog('not readable'); - } - /** - * no need for is_link as links are detected correctly with is_file, is_dir and is_readable ! - * elseif( is_link ($name.'/'.$entry ) ) - { - echo 'link'; - }*/ - elseif( is_file( $dirname.$entry ) ) - { - linImport::addNewFile( $parent_id, $dirname , $entry ); - } - elseif( is_dir( $dirname.$entry ) ) - { - linImport::addNewDir( $parent_id , $dirname , $entry , $recursive); - } - } - $d->close(); - -} // end function addNew - +/** + * import new file, calc md5sum, delete thumbnail if one already exists with the same id, update number of photo of parent folder + */ function addNewFile( $parent_id , $dirname , $filename ) { linSysLog('new file '.$dirname.$filename.'<br />'); @@ -242,6 +203,9 @@ } } +/** + * import new directory + */ function addNewDir( $parent_id , $dirname , $filename , $recursive) { linSysLog('new dir '.$dirname .$filename.'<br />'); @@ -258,11 +222,62 @@ if($recursive) { - linImport::addNew( $inserted_id , $dirname.$filename.'/' , $recursive); + linImport::addNewSubEntry( $inserted_id , $dirname.$filename.'/' , $recursive); } } /** + * add new subdir/subfile + * only called from addNewDir() + */ +function addNewSubEntry( $parent_id , $dirname , $recursive) +{ + $d = dir( $dirname ); + + while( false !== ($entry = $d->read() ) ) + { + $ext = linFilesys::getFileExtFromPath($entry); + if($entry == '.' OR $entry == '..') + { + //no output + } + elseif($entry{0} == '.') + { + linSysLog('hidden'); + } + elseif( in_array( $entry, linImport::getIgnoreFilelist() ) ) + { + linSysLog('ignore'); + } + elseif( in_array($ext, linImport::getIgnoreFileext() ) ) + { + linSysLog('ignore'); + } + elseif( !is_readable( $dirname.$entry) ) + { + linSysLog('not readable'); + } + /** + * no need for is_link as links are detected correctly with is_file, is_dir and is_readable ! + * elseif( is_link ($name.'/'.$entry ) ) + { + echo 'link'; + }*/ + elseif( is_file( $dirname.$entry ) ) + { + linImport::addNewFile( $parent_id, $dirname , $entry ); + } + elseif( is_dir( $dirname.$entry ) ) + { + linImport::addNewDir( $parent_id , $dirname , $entry , $recursive); + } + } + $d->close(); + +} // end function addNew + + +/** * recursive delete entry * * @todo delete other stuff too! (permissions, exif? iptc? comments?) @@ -348,7 +363,7 @@ */ function getIgnoreFilelist() { - return Array('CVS','Thumbs.db','ZbThumbnail.info'); + return Array('CVS','Thumbs.db','ZbThumbnail.info','lost+found'); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |