From 2e584e07da75ea7c05a690f44f1fe3877188e30f Mon Sep 17 00:00:00 2001 From: bellord13 Date: Mon, 20 May 2024 14:20:22 +0300 Subject: [PATCH] fix --- clone.php | 63 +++++++++++++++++++++++++++++++++++++++ functions/app.php | 2 +- lang/ru/install/index.php | 8 ++--- lib/ajax/bxnull.php | 2 +- 4 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 clone.php diff --git a/clone.php b/clone.php new file mode 100644 index 0000000..1edc679 --- /dev/null +++ b/clone.php @@ -0,0 +1,63 @@ +read() ) ) { + if ( $entry != '.' && $entry != '..' ) + copy_folder( "$d1/$entry", "$d2/$entry", $upd, $force ); + } + $d->close(); + } + else { + $ok = copy_safe( $d1, $d2, $upd ); + $ok = ($ok) ? "ok-- " : " -- "; + fs_log("{$ok}$d1"); + } +} //function copy_folder + +function mkdir_safe( $dir, $force ) { + if (file_exists($dir)) { + if (is_dir($dir)) return $dir; + else if (!$force) return false; + unlink($dir); + } + return (mkdir($dir, 0777, true)) ? $dir : false; +} //function mkdir_safe + +function copy_safe ($f1, $f2, $upd) { + $time1 = filemtime($f1); + if (file_exists($f2)) { + $time2 = filemtime($f2); + if ($time2 >= $time1 && $upd) return false; + } + $ok = copy($f1, $f2); + if ($ok) touch($f2, $time1); + return $ok; +} //function copy_safe + +function fs_log($str) { + return; + $log = fopen("./fs_log.txt", "a"); + $time = date("Y-m-d H:i:s"); + fwrite($log, "$str ($time)\n"); + fclose($log); +} + + +echo $newEntity->getId() . PHP_EOL; + + +copy_folder($nullEntity->getDir(), $newEntity->getDir()); diff --git a/functions/app.php b/functions/app.php index e93ad87..f4d2119 100644 --- a/functions/app.php +++ b/functions/app.php @@ -6,7 +6,7 @@ use Bx\Null\App\App; * @return App * @throws null */ -function bxNull() { +function nullApp() { $app = App::getInstance('bx.null'); return $app; } \ No newline at end of file diff --git a/lang/ru/install/index.php b/lang/ru/install/index.php index 8ba883d..72ff372 100644 --- a/lang/ru/install/index.php +++ b/lang/ru/install/index.php @@ -1,5 +1,5 @@ getResponse()->addData(['method' => 'test', 'version' => bxNull()->module()->getVersion()]); + $this->getResponse()->addData(['method' => 'test', 'version' => nullApp()->module()->getVersion()]); return $this->getResponse(); } } \ No newline at end of file