Bug #16419

Upload to TER always transfers hidden or system files

Added by Peter Russ about 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Should have
Category:
Extension Manager
Target version:
-
Start date:
2006-08-01
Due date:
% Done:

0%

TYPO3 Version:
4.0
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When uploading an extension to TER all files and directories are uploaded to TER even if they are hidden or only used by system (e.g. Windows).

This diff provides an additional checkbox 'Exclude hidden files'. When this is set, hidden files or folders or files in hidden folders are excluded from upload.

Please check and forward ideas and comments.

FYI:
The diff is against typo3/mod/tools/em/class.em_index.php
(issue imported from #M3961)

class.em_index.php View (213 KB) Administrator Admin, 2006-08-01 18:59

class.em_index.diff View (3.05 KB) Administrator Admin, 2006-08-03 09:47

class.em_index.060804.org.diff View (7.43 KB) Administrator Admin, 2006-08-04 13:49

class.em_index.060804.diff.diff View (6.3 KB) Administrator Admin, 2006-08-04 13:49

patch_em_dot_svn_cvs.patch View (2.38 KB) Administrator Admin, 2006-08-14 14:38

patch_em_dot_svn_cvs-v2.patch View (2.52 KB) Administrator Admin, 2006-09-25 12:54

exclude-in-EM.patch View (6.52 KB) Administrator Admin, 2006-10-14 10:36

exclude-in-EM-v2.patch View (6.68 KB) Administrator Admin, 2006-10-19 22:50

exclude-in-EM-v3.patch View (7.09 KB) Administrator Admin, 2006-12-12 18:16


Related issues

Duplicated by TYPO3 Core - Feature #16539: .svn ignore option Closed 2006-09-08

History

#1 Updated by Karsten Dambekalns about 13 years ago

Oh, yes. Very naughty behaviour...

#2 Updated by Peter Russ about 13 years ago

Just saw, that I uploaded the complete class instead of only the diff.
Mea culpa!

#3 Updated by Ernesto Baschny about 13 years ago

And additionally we might want to skip CVS/.svn directories in that process too. :)

#4 Updated by Stefan Geith about 13 years ago

.svn directories are hidden ...

#5 Updated by Ernesto Baschny about 13 years ago

ok, but CVS not. :)

#6 Updated by Peter Russ about 13 years ago

depends on the system you are aiming:

Windows: FAT/NTFS atrrib flags H and S are checked. CVS on WIN is hidden ;-)

Linux: any file or folder starting with '.' is hidden and therefore excluded. On .NIX the cvs folder is .cvs

;-)

#7 Updated by Ernesto Baschny about 13 years ago

False: on Unix the CVS folder is also "CVS" (at least in all versions I have worked with), so its not "hidden" and have to be considered separately.

#8 Updated by Peter Russ about 13 years ago

That can be fixed and it will ;-)

#9 Updated by Peter Russ about 13 years ago

Added support to exclude folders and files by extensions.
Therefore a general setup can be done in localconf.php. Further TSCONFIG on user base can be set:

Setup in localconf.php (Example)
$TYPO3_CONF_VARS['EXT']['uploadTer']['excludePath']='CVS,SVN';
$TYPO3_CONF_VARS['EXT']['uploadTer']['excludeExt']='bak,tmp';

Setup in User TSCONFIG (Example)
EXT{
uploadTer{
excludePath=
excludeExt=bak,sec
}
}

User TSCONFIG always overules general setting.
In this example excludePath is resetted and excludeExt is set to bak and sec

Attached 2 diff.
class.em_index.060804.org.diff is against fresh settup
class.em_index.060804.diff.diff is against diff provided Aug 03.

Please test and comment

#10 Updated by Peter Niederlag about 13 years ago

I am having some little(!) trouble cleanly testing the patch 'class.em_index.060804.org.diff' due to the following lines:

- * $Id: class.em_index.php,v 1.1 2006/08/01 12:04:25 pruss Exp $
+ * $Id: class.em_index.php,v 1.2 2006/08/03 11:33:04 pruss Exp $

These ^ ^ lines from the diff won't apply. Other than that: looks nice and I will test it now....

#11 Updated by Peter Niederlag about 13 years ago

hmm, just noticed it adds the 'hidden option' only to the "upload to TER" dialog.

However I would rather appreciate if it would also be considered in the regular "backup/delete" / ordinary "download extension as file" functions.

#12 Updated by Peter Russ about 13 years ago

I expected that this would come up ;-)

But will take some time as I will be out of the office for one week.

Regs. Peter.

#13 Updated by Sebastian Kurfuerst about 13 years ago

keyword:t3dd06

#14 Updated by Stefan Geith about 13 years ago

Maybe, we should include an optional paramter to
class.t3lib_div.php->getAllFilesAndFoldersInPath(...,$excludeDirs='')
and modify class.em_index.php to use this
with paramters getAllFilesAndFoldersInPath(...,'.svn,CVS')

This works on my Installation;
I include the diff-File 'patch_em_dot_svn_cvs.patch' (just for testing)

#15 Updated by Stefan Geith almost 13 years ago

There is a bug in the patch:
Instead of
$fileArr=t3lib_div::getAllFilesAndFoldersInPath(...$regDirs,$recursivityLevels-1);
(in patch line 19) it must read
$fileArr=t3lib_div::getAllFilesAndFoldersInPath(...$regDirs,$recursivityLevels-1,$excludeDirs);

So that exludeDirs are also excluded in subdirectories

#16 Updated by Karsten Dambekalns almost 13 years ago

Hi, I just looked at those two approaches, and I think the simpler one is more likely to make it into the core. Peter (Russ), your patch doesn't follow the CGL at all, by the way...

I'll probably combine those two approaches somehow.

#17 Updated by Karsten Dambekalns almost 13 years ago

I uploaded exclude-in-EM.patch which changes t3lib_div to make exclusion possible, adds two settings to config_default.php and changes the EM exclude the configured files when packaging stuff.

  • do we need those two separate settings?
  • how strong is the need for wildcards?

#18 Updated by Karsten Dambekalns almost 13 years ago

I just did a test with the ADOdb extension. No files were missing that should have been there (i.e. only the .svn folders were gone). More interesting: the exported file was less than half in size, as SVN stores a local copy of the original for faster operation - so this isn't only about convenience!

#19 Updated by Michael Stucki almost 13 years ago

One setting is enough, please merge them.
About wildcards: Yes these would probably be useful. Why not use a regular expression here?

The regex should search from the beginning (^) to till the end ($) of the strings. In this case the example below will filter all CVS directories, files beginning with a dot (hidden files) and temporary files (*~):

excludeForPackaging' => '(CVS|\..*|.*~)'

#20 Updated by Karsten Dambekalns almost 13 years ago

Ok, I'll merge the settings.

On wildcards: Of course I thought about using regexp, but since this can be considered as user input, it should run through preg_quote(). Then this escapes all the magic stuff, of course, rendering this useless. Do we consider the localconf.php file trusted?

Obviously we do, just to make sure...

#21 Updated by Michael Stucki almost 13 years ago

localconf.php can contain any kind of PHP code, therefore it is of course trusted.

#22 Updated by Karsten Dambekalns almost 13 years ago

Ok, here is a new patch, one setting, preg-enabled, works here just fine.

#23 Updated by Karsten Dambekalns almost 13 years ago

The proposed patch is now on the core team for approval...

#24 Updated by Karsten Dambekalns almost 13 years ago

Has been committed to SVN on Dec 13th.

Also available in: Atom PDF