fix
This commit is contained in:
+1
-1
@@ -4,6 +4,6 @@
|
||||
"namespace": "Bx\\Nullable",
|
||||
"gitUrl": "https://bitbucket.org/bellord13/bx.null/",
|
||||
"version": "1.0.0",
|
||||
"date": "2024-01-01 00:00:00",
|
||||
"date": "2025-01-01 00:00:00",
|
||||
"deps": ["wt.core"]
|
||||
}
|
||||
@@ -9,9 +9,41 @@ $data['env'] = $app->env();
|
||||
|
||||
|
||||
?>
|
||||
<table cellpadding="5" border="1" style="border-collapse: collapse; width: 100%">
|
||||
<?php
|
||||
foreach ($data as $key => $value) {
|
||||
<table cellpadding="5" border="1" style="border-collapse: collapse; width: 100%">
|
||||
<?php
|
||||
foreach ($data as $key => $value) {
|
||||
?><tr><td><?= $key ?></td><td><?= $value ?></td></tr><?php
|
||||
}
|
||||
?></table><?php
|
||||
}
|
||||
?></table>
|
||||
<br><?php
|
||||
|
||||
?><table cellpadding="5" border="1" style="border-collapse: collapse; width: 100%">
|
||||
<tr>
|
||||
<?php
|
||||
$initPhpSrc = getLocalPath('php_interface/init.php', BX_PERSONAL_ROOT);
|
||||
$src = $app->module()->getSrc();
|
||||
$html = "<div style=\"font-family: monospace; font-size: 0.9em; white-space: pre; color: grey;\">if(file_exists(\$_SERVER['DOCUMENT_ROOT'] . '$src/init.php'))
|
||||
include_once \$_SERVER['DOCUMENT_ROOT'] . '$src/init.php';</div>";
|
||||
?>
|
||||
<td>
|
||||
<?=$this->getCheckTemplate($app->isIncludeFileToInitPhp())?>
|
||||
</td>
|
||||
<td>
|
||||
Модуль подключен в init.php
|
||||
</td>
|
||||
<td width="50%">
|
||||
<?php
|
||||
if($initPhpSrc){
|
||||
?><a target="_blank" href="/bitrix/admin/fileman_file_edit.php?path=<?=urlencode($initPhpSrc)?>&full_src=Y">
|
||||
<?=$initPhpSrc?>
|
||||
</a><?php
|
||||
} else {
|
||||
?>init.php отсутствует<?php
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<?=$html?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
@@ -73,15 +73,22 @@ function _fix(ModuleEntity $newEntity, ModuleEntity $nullableEntity){
|
||||
$new_file = $orig_file;
|
||||
$cr = 0;
|
||||
$new_file = str_replace($nullableEntity->getLangPrefix(), $newEntity->getLangPrefix(), $new_file, $cr);
|
||||
$new_file = str_replace($nullableEntity->fields()->id, $newEntity->fields()->id, $new_file, $cr);
|
||||
$new_file = str_replace($nullableEntity->fields()->prefix, $newEntity->fields()->prefix, $new_file, $cr);
|
||||
$new_file = str_replace($nullableEntity->getId(), $newEntity->getId(), $new_file, $cr);
|
||||
$new_file = str_replace($nullableEntity->getPrefix(), $newEntity->getPrefix(), $new_file, $cr);
|
||||
$new_file = str_replace($nullableEntity->getNamespace(), $newEntity->getNamespace(), $new_file, $cr);
|
||||
|
||||
$lastModuleName = collect(explode('.', $newEntity->fields()->id))->last();
|
||||
$lastNullableModuleName = collect(explode('.', $nullableEntity->fields()->id))->last();
|
||||
$new_file = str_replace(
|
||||
ucfirst($nullableEntity->getProductCode()) . ': ' . ucfirst($nullableEntity->getProductCode()),
|
||||
ucfirst($newEntity->getProductCode()) . ': ' . ucfirst($newEntity->getProductCode()),
|
||||
$new_file,
|
||||
$cr
|
||||
);
|
||||
|
||||
$new_file = str_replace(ucfirst($nullableEntity->getProductCode()), ucfirst($newEntity->getProductCode()), $new_file, $cr);
|
||||
$new_file = str_replace(ucfirst($nullableEntity->getCompanyCode()), ucfirst($newEntity->getCompanyCode()), $new_file, $cr);
|
||||
$new_file = str_replace($nullableEntity->getProductCode(), $newEntity->getProductCode(), $new_file, $cr);
|
||||
$new_file = str_replace($nullableEntity->getCompanyCode(), $newEntity->getCompanyCode(), $new_file, $cr);
|
||||
|
||||
$new_file = str_replace(ucfirst($lastNullableModuleName), ucfirst($lastModuleName), $new_file, $cr);
|
||||
$new_file = str_replace(strtolower($lastNullableModuleName), strtolower($lastModuleName), $new_file, $cr);
|
||||
|
||||
|
||||
echo $cr . ' ' .$path . PHP_EOL;
|
||||
@@ -98,8 +105,9 @@ echo $newEntity->getId() . PHP_EOL;
|
||||
|
||||
copy_folder_safe($nullableEntity->getPath(), $newEntity->getPath(), true, true, [
|
||||
'.git',
|
||||
'clone.php',
|
||||
'.module.json',
|
||||
'clone.php',
|
||||
'readme.md',
|
||||
], function ($d1, &$d2) use ($nullableEntity, $newEntity){
|
||||
$lastModuleName = collect(explode('.', $newEntity->fields()->id))->last();
|
||||
$lastNullableModuleName = collect(explode('.', $nullableEntity->fields()->id))->last();
|
||||
|
||||
@@ -4,4 +4,18 @@ return [
|
||||
'MainAbstractFactory' => [
|
||||
'Bx\Nullable\Factory\NullableFactory' => ['cache' => ['hit'], 'is_collection_query' => true],
|
||||
],
|
||||
'events' => [
|
||||
'main:OnPageStart' => [
|
||||
['Bx\Nullable\Handlers\Autoloader', 'onPageStart'],
|
||||
],
|
||||
'main:OnProlog' => [
|
||||
['Bx\Nullable\Handlers\Autoloader', 'onProlog'],
|
||||
],
|
||||
'main:OnEpilog' => [
|
||||
['Bx\Nullable\Handlers\Autoloader', 'onEpilog'],
|
||||
],
|
||||
'main:OnBeforeProlog' => [
|
||||
['Bx\Nullable\Handlers\Autoloader', 'onBeforeProlog'],
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
$MESS ['bx_nullable_partner_name'] = 'CoreLion';
|
||||
$MESS ['bx_nullable_partner_uri'] = 'https://corelion.ru/';
|
||||
$MESS ['bx_nullable_module_name'] = 'Bx: Nullable';
|
||||
|
||||
@@ -11,6 +11,8 @@ use Bx\Nullable\Facade\FactoryFacade;
|
||||
|
||||
class App extends \Wt\Core\App\App
|
||||
{
|
||||
protected $includeFileToInitPhp;
|
||||
|
||||
/**
|
||||
* @param string $factoryName
|
||||
* @return FactoryFacade | DefaultFactoryFacade
|
||||
@@ -37,4 +39,13 @@ class App extends \Wt\Core\App\App
|
||||
{
|
||||
return parent::defines();
|
||||
}
|
||||
|
||||
public function isIncludeFileToInitPhp($value = null)
|
||||
{
|
||||
if(is_null($value)){
|
||||
return $this->includeFileToInitPhp;
|
||||
}
|
||||
$this->includeFileToInitPhp = $value;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Bx\Nullable\Handlers;
|
||||
|
||||
class Autoloader
|
||||
{
|
||||
public static function onPageStart(){}
|
||||
public static function onBeforeProlog(){}
|
||||
public static function onProlog(){}
|
||||
public static function onEpilog(){}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Bx\Nullable\Interfaces;
|
||||
|
||||
class ITest
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
1) создаем папку с модулем
|
||||
2) копируем и конфигурируем файл .module.json
|
||||
3) запускаем php -f clone.php ./path_to_new_module
|
||||
@@ -0,0 +1 @@
|
||||
local
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
return [
|
||||
|
||||
];
|
||||
Reference in New Issue
Block a user