Skip to content

Commit

Permalink
Ignore dot files and __MACOSX on plugin export
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloke committed May 17, 2024
1 parent ceadc57 commit 27bf50d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions textpattern/vendors/Textpattern/Plugin/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function install($plugin, $status = null, $write = true)
public function extract($plugin, $normalize = true)
{
if (strpos($plugin, '$plugin=\'') !== false) {
@ini_set('pcre.backtrack_limit', '1000000');
ini_set('pcre.backtrack_limit', '1000000');
$plugin = preg_replace('@.*\$plugin=\'([\w=+/]+)\'.*@s', '$1', $plugin);
}

Expand All @@ -198,7 +198,7 @@ public function extract($plugin, $normalize = true)
$plugin = base64_decode($plugin);

if (strncmp($plugin, "\x1F\x8B", 2) === 0) {
$plugin = @gzinflate(substr($plugin, 10));
$plugin = gzinflate(substr($plugin, 10));
}

set_error_handler(function () {}, E_WARNING|E_NOTICE);
Expand Down Expand Up @@ -747,12 +747,12 @@ protected function zipDirectory($zipArchive, $directory)
$currFile = $directory . $file;

if (is_file($currFile)) {
if ($file != '' && $file != '.' && $file != '..') {
if ($file !== '' && strpos($file, '.') !== 0) {
$zipArchive->addFile($currFile, str_replace($basedir, '', $currFile));
}
} else {
if (is_dir($currFile)) {
if ($file != '' && $file != '.' && $file != '..') {
if ($file != '' && strpos($file, '.') !== 0 && strpos($file, '__MACOSX') !== 0) {
$zipArchive->addEmptyDir(str_replace($basedir, '', $currFile));
$directory = $currFile . '/';
$this->zipDirectory($zipArchive, $directory);
Expand Down

0 comments on commit 27bf50d

Please sign in to comment.