teamneusta / m2t3-magento Goto Github PK
View Code? Open in Web Editor NEWM2T3 Magento Module
License: BSD 3-Clause "New" or "Revised" License
M2T3 Magento Module
License: BSD 3-Clause "New" or "Revised" License
I started to understand how the components work together here:
https://drive.google.com/file/d/0B2YQm_aU4R-tNksxT245bXhzN1E/view?usp=sharing
Is that correct so far? Feel free to extend it ...
If the option "Use Web Server Rewrites" (path: "web/seo/use_rewrites") isn't set or set to 0 and urls are being generated via CLI, the base url contains the word "magento" instead if "index.php".
For example:
Store base url: http://magento.local/
Use rewrites: not set
Category name: foobar
Expected: http://magento.local/index.php/foobar.html
Actual: http://magento.local/magento/foobar.html
The cause of this behaviour is the following code:
// vendor/magento/module-store/Model/Store.php:677
/**
* Append script file name to url in case when server rewrites are disabled
*
* @param string $url
* @return string
*/
protected function _updatePathUseRewrites($url)
{
if ($this->getForceDisableRewrites() || !$this->getConfig(self::XML_PATH_USE_REWRITES)) {
if ($this->_isCustomEntryPoint()) {
$indexFileName = 'index.php';
} else {
$indexFileName = basename($_SERVER['SCRIPT_FILENAME']);
}
$url .= $indexFileName . '/';
}
return $url;
}
First of all, the call to "$this->getConfig(self::XML_PATH_USE_REWRITES)" returns the value 0 as string, which is then converted (via !) to a bool.
Problem here is, that even if the value is 0, it is returned as an non empty string, which in php will be converted to a true.
The next problem is, that the url generation was never built for cli/indexer use.
In case of any call of "bin/magento ..." the $_SERVER['SCRIPT_FILENAME'] will be "bin/magento".
The function basename then returns the value "magento" which is then appended to the base url.
The workaround would be to set "Use Web Server Rewrites" to true/yes
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.