This commit is contained in:
2025-11-23 14:17:17 +03:00
parent 448edb8671
commit 207d793b07
2 changed files with 10 additions and 7 deletions
+6 -6
View File
@@ -11,7 +11,7 @@ $nullableEntity = __getModuleEntity(__DIR__);
function copy_folder_safe($d1, $d2, $upd = true, $force = true, $exclude = [], $handler = null) { function copy_folder_safe($d1, $d2, $upd = true, $force = true, $exclude = [], $handler = null) {
$cm = 0; $cm = 0;
str_replace($exclude, $exclude, $d1, $cm); preg_filter($exclude, $exclude, $d1, -1, $cm);
if($cm){ if($cm){
echo 'skip ' . $d1 . PHP_EOL; echo 'skip ' . $d1 . PHP_EOL;
return; return;
@@ -39,7 +39,7 @@ function copy_folder_safe($d1, $d2, $upd = true, $force = true, $exclude = [], $
function mkdir_safe( $dir, $force ) { function mkdir_safe( $dir, $force ) {
if (file_exists($dir)) { if (file_exists($dir)) {
if (is_dir($dir)) return $dir; if (is_dir($dir)) return $dir;
else if (!$force) return false; elseif (!$force) return false;
unlink($dir); unlink($dir);
} }
return (mkdir($dir, 0777, true)) ? $dir : false; return (mkdir($dir, 0777, true)) ? $dir : false;
@@ -104,10 +104,10 @@ echo $newEntity->getId() . PHP_EOL;
copy_folder_safe($nullableEntity->getPath(), $newEntity->getPath(), true, true, [ copy_folder_safe($nullableEntity->getPath(), $newEntity->getPath(), true, true, [
'.git', '/\.git$/',
'.module.json', '/\.module\.json/',
'clone.php', '/clone\.php/',
'readme.md', '/readme\.md/',
], function ($d1, &$d2) use ($nullableEntity, $newEntity){ ], function ($d1, &$d2) use ($nullableEntity, $newEntity){
$lastModuleName = collect(explode('.', $newEntity->fields()->id))->last(); $lastModuleName = collect(explode('.', $newEntity->fields()->id))->last();
$lastNullableModuleName = collect(explode('.', $nullableEntity->fields()->id))->last(); $lastNullableModuleName = collect(explode('.', $nullableEntity->fields()->id))->last();
+4 -1
View File
@@ -1,4 +1,7 @@
<?php <?php
/**
* @var array $config
*/
return [ return [
'providers' => [],
]; ];