fix
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
require './../wt.core/include.php';
|
||||
|
||||
$curPath = __DIR__;
|
||||
$newPath = realpath($argv[1]);
|
||||
$newEntity = __getModuleEntity($newPath);
|
||||
$nullEntity = __getModuleEntity(__DIR__);
|
||||
|
||||
function copy_folder($d1, $d2, $upd = true, $force = true, $exclude = []) {
|
||||
if ( is_dir( $d1 ) ) {
|
||||
$d2 = mkdir_safe( $d2, $force );
|
||||
if (!$d2) {
|
||||
fs_log("!!fail $d2");
|
||||
return;
|
||||
}
|
||||
$d = dir( $d1 );
|
||||
while ( false !== ( $entry = $d->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());
|
||||
+1
-1
@@ -6,7 +6,7 @@ use Bx\Null\App\App;
|
||||
* @return App
|
||||
* @throws null
|
||||
*/
|
||||
function bxNull() {
|
||||
function nullApp() {
|
||||
$app = App::getInstance('bx.null');
|
||||
return $app;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?
|
||||
$MESS ['bx_null_partner_name'] = "CoreLion";
|
||||
$MESS ['bx_null_partner_uri'] = "https://corelion.ru/";
|
||||
$MESS ['bx_null_module_name'] = "Bx: Null";
|
||||
$MESS ['bx_null_module_description'] = "Null module";
|
||||
$MESS ['bx_null_partner_name'] = 'CoreLion';
|
||||
$MESS ['bx_null_partner_uri'] = 'https://corelion.ru/';
|
||||
$MESS ['bx_null_module_name'] = 'Bx: Null';
|
||||
$MESS ['bx_null_module_description'] = 'Null module';
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ class BxNull extends AAjaxHandler
|
||||
|
||||
public function test()
|
||||
{
|
||||
$this->getResponse()->addData(['method' => 'test', 'version' => bxNull()->module()->getVersion()]);
|
||||
$this->getResponse()->addData(['method' => 'test', 'version' => nullApp()->module()->getVersion()]);
|
||||
return $this->getResponse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user