Skip to content

Commit cd3fc51

Browse files
1 parent 41672ed commit cd3fc51

File tree

5 files changed

+102
-1
lines changed

5 files changed

+102
-1
lines changed

Framework/Config/FileIterator.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
namespace Df\Framework\Config;
3+
use Magento\Framework\Config\FileIterator as I;
4+
// 2017-07-26
5+
/** @final Unable to use the PHP «final» keyword here because of the M2 code generation. */
6+
class FileIterator extends I {
7+
/**
8+
* 2017-07-26
9+
* @param I $i
10+
* @return string[]
11+
*/
12+
static function pathsGet(I $i) {return $i->paths;}
13+
14+
/**
15+
* 2017-07-26
16+
* @param I $i
17+
* @param string[] $v
18+
* @return I
19+
*/
20+
static function pathsSet(I $i, array $v) {$i->paths = $v; return $i;}
21+
}

Framework/Module/Dir/Reader.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
namespace Df\Framework\Module\Dir;
3+
use Df\Framework\Config\FileIterator as dfI;
4+
use Magento\Framework\Config\FileIterator as I;
5+
use Magento\Framework\Module\Dir\Reader as _P;
6+
/**
7+
* 2017-07-26
8+
* @final Unable to use the PHP «final» keyword here because of the M2 code generation.
9+
* The purpose of this class is to fix the issue:
10+
* «bin/magento module:enable --all»: «The file "/composer.json" doesn't exist»
11+
* https://github.com/mage2pro/stripe/issues/8
12+
* https://mage2.pro/t/4198
13+
*
14+
* @used-by \Df\Framework\Module\PackageInfoFactory::create()
15+
*
16+
* Unfortunately, it is impossible to implement this as a plugin because of the recursion:
17+
* Step 1:
18+
* @see \Magento\Framework\Config\Reader\Filesystem::read():
19+
* $fileList = $this->_fileResolver->get($this->_fileName, $scope);
20+
* https://github.com/magento/magento2/blob/2.2.0-RC1.5/lib/internal/Magento/Framework/Config/Reader/Filesystem.php#L124
21+
* Step 2:
22+
* @see \Magento\Framework\App\Config\FileResolver::get():
23+
* $iterator = $this->_moduleReader->getConfigurationFiles($filename);
24+
* https://github.com/magento/magento2/blob/2.2.0-RC1.5/lib/internal/Magento/Framework/App/Config/FileResolver.php#L65
25+
* Step 3:
26+
* @see \Magento\Framework\Interception\PluginList\PluginList::getNext():
27+
* $this->_loadScopedData();
28+
* https://github.com/magento/magento2/blob/2.2.0-RC1.5/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php#L266
29+
* Step 4:
30+
* @see \Magento\Framework\Interception\PluginList\PluginList::_loadScopedData():
31+
* $data = $this->_reader->read($scopeCode);
32+
* https://github.com/magento/magento2/blob/2.2.0-RC1.5/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php#L298
33+
* Step 5:
34+
* @see \Magento\Framework\ObjectManager\Config\Reader\Dom\Proxy::read()
35+
* @see \Magento\Framework\Config\Reader\Filesystem::read()
36+
* https://github.com/magento/magento2/blob/2.2.0-RC1.5/lib/internal/Magento/Framework/Config/Reader/Filesystem.php#L124
37+
*/
38+
class Reader extends _P {
39+
/**
40+
* 2017-07-26
41+
* @override
42+
* @see \Magento\Framework\Module\Dir\Reader::getComposerJsonFiles()
43+
* @return I
44+
*/
45+
function getComposerJsonFiles() {$r = parent::getComposerJsonFiles(); /** @var I $r */return
46+
dfI::pathsSet($r, array_filter(dfI::pathsGet($r), function($f) {return '/composer.json' !== $f;}))
47+
;}
48+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
namespace Df\Framework\Module;
3+
use Df\Framework\Module\Dir\Reader;
4+
use Magento\Framework\Module\FullModuleList;
5+
use Magento\Framework\Module\PackageInfo;
6+
/**
7+
* 2017-07-26
8+
* @final Unable to use the PHP «final» keyword here because of the M2 code generation.
9+
* The purpose of this class is to fix the issue:
10+
* «bin/magento module:enable --all»: «The file "/composer.json" doesn't exist»
11+
* https://github.com/mage2pro/stripe/issues/8
12+
* https://mage2.pro/t/4198
13+
*/
14+
class PackageInfoFactory extends \Magento\Framework\Module\PackageInfoFactory {
15+
/**
16+
* 2017-07-26
17+
* @override
18+
* @see \Magento\Framework\Module\PackageInfoFactory::create()
19+
* @used-by \Magento\Framework\Module\DependencyChecker::__construct()
20+
* @return PackageInfo
21+
*/
22+
function create() {$om = $this->objectManager; return $om->create(PackageInfo::class, [
23+
'reader' => $om->create(Reader::class, ['moduleList' => $om->create(FullModuleList::class)])
24+
]);}
25+
}
26+

Framework/etc/di.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"
55
>
6+
<!-- 2017-07-26
7+
«bin/magento module:enable»: «The file "/composer.json" doesn't exist»
8+
https://github.com/mage2pro/stripe/issues/8
9+
https://mage2.pro/t/4198
10+
-->
11+
<preference for='Magento\Framework\Module\PackageInfoFactory' type='Df\Framework\Module\PackageInfoFactory'/>
612
<!--
713
2015-11-15
814
Цель перекрытия — устранение дефекта

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mage2pro/core"
3-
,"version": "2.9.8"
3+
,"version": "2.9.9"
44
,"description": "Mage2.PRO core package."
55
,"type": "magento2-module"
66
,"homepage": "https://mage2.pro"

0 commit comments

Comments
 (0)