Announcement

#1 2021-03-06 04:48:36

silenceroom
Member
1970-01-01
2

[resolved] exclude "._" files from scan

Hello/Hi/Greetings,

I've built an installation with an NFS exported folder mounted to ./galleries/, the sync function works well and reads all the files with in the folders.

However, the original NFS folder also shared with other Mac users hence there are lots of "._" files created by the Mac Finder. Is there a way that we can exclude those files (not folder-based, the "._" file was created individually for each actual file located in the folder. For example, if there is an abc.jpg in the folder, there will be a "._abc.jpg" representatively.

Since the "._" file is not a standard photo, the Piwigo can't read them nor display on the browser, it simply counts them as another photo in the folder therefore creates lots of wrong icons in the album.

Has anybody comes with a solution to exclude those files?

Thanks
Colin

Offline

 

#2 2021-03-06 09:14:37

TOnin
Member
1970-01-01
106

Re: [resolved] exclude "._" files from scan

Hi,

1st idea
you can add (?!\.) at the begining of your $conf['sync_chars_regex'] in local configuration file: local/config/config_default.inc.php.
Piwigo Documentation » User Documentation » Advanced Use » Features » The Local Configuration (LocalFiles Editor)

For instance, replace

Code:

// permitted characters for files/directories during synchronization
$conf['sync_chars_regex'] = '/^[a-zA-Z0-9-_. ]+$/';

with

Code:

// permitted characters for files/directories during synchronization
$conf['sync_chars_regex'] = '/^(?!\.)[a-zA-Z0-9-_. ]+$/';

Consider the advantage and the drawback:
Advantage, no worry when you will update your piwigo version;
Drawback, you will get a lot of [./galleries/directory_04/._c.jpg] PWG-UPDATE-1 (wrong filename).

Thanks erAck in similar post: Home » How-To and Troubleshooting » Excluding hidden files from physical albums?


2nd idea
In admin/site_reader_local.php, line 74, replace

Code:

      if ($node == '.' or $node == '..') continue;

with

Code:

      if ($node == '.' or $node == '..' or $node[0] == '.') continue;

Consider the advantage and the drawback:
Advantage, the hidden files will be silently excluded during synchronization;
Drawback, changes may be reverted during an official piwigo update. So I think this idea is more a code improvment idea to be discussed. [Github] Piwigo issue #1359

Last edited by TOnin (2021-03-06 09:41:53)

Offline

 

#3 2021-03-06 16:04:09

silenceroom
Member
1970-01-01
2

Re: [resolved] exclude "._" files from scan

Thanks TOnin,

Thanks for the prompt solution. The 2nd solution works perfectly for me. This going to be a game-changer for our organization.



TOnin wrote:

Hi,

1st idea
you can add (?!\.) at the begining of your $conf['sync_chars_regex'] in local configuration file: local/config/config_default.inc.php.
Piwigo Documentation » User Documentation » Advanced Use » Features » The Local Configuration (LocalFiles Editor)

For instance, replace

Code:

// permitted characters for files/directories during synchronization
$conf['sync_chars_regex'] = '/^[a-zA-Z0-9-_. ]+$/';

with

Code:

// permitted characters for files/directories during synchronization
$conf['sync_chars_regex'] = '/^(?!\.)[a-zA-Z0-9-_. ]+$/';

Consider the advantage and the drawback:
Advantage, no worry when you will update your piwigo version;
Drawback, you will get a lot of [./galleries/directory_04/._c.jpg] PWG-UPDATE-1 (wrong filename).

Thanks erAck in similar post: Home » How-To and Troubleshooting » Excluding hidden files from physical albums?


2nd idea
In admin/site_reader_local.php, line 74, replace

Code:

      if ($node == '.' or $node == '..') continue;

with

Code:

      if ($node == '.' or $node == '..' or $node[0] == '.') continue;

Consider the advantage and the drawback:
Advantage, the hidden files will be silently excluded during synchronization;
Drawback, changes may be reverted during an official piwigo update. So I think this idea is more a code improvment idea to be discussed. [Github] Piwigo issue #1359

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact