The theme is installed on a fresh Magento-2.1.7 with no data. The system is CentOS-7.3 (VPS@godaddy), MySQL-5.6.37, PHP-5.6.31, Nginx-1.10, PHP-FPM runs as nginx:nginx, file system user is in the nginx group, directories are "g+s"-ed.
Installation steps: switch to developer mode clean, flush and disable cache, disable js/css merge/minification. ./bin/magento setup:upgrade ./bin/magento index:reindex ./bin/magento cache:clean
Now, the store front page shows up with the Magento's default template, but /admin_****** throws the following exception:
Exception #0 (Magento\Framework\Exception\FileSystemException): File "/composer.json" cannot be opened Warning!fopen(/composer.json): failed to open stream: No such file or directory
#0 /.../magento2/app/code/TemplateMonster/ThemeUpdater/Model/ThemeData.php(98): Magento\Framework\Filesystem\Driver\File->fileOpen('/composer.json', 'r')
.... 30 lines of the exception trace follow.
Obviously, it is looking for composer.json in the wrong place. The right place is $MAG_ROOT/app/design/frontend/TemplateMonster/theme###/. Here are the relevant parts of ThemeData.php and what I discovered through some hacking into them.
protected function getComposerData()
{
$path = $this->getAbsThemePath() . '/composer.json';
/*98*/ $resource = $this->_fileDriver->fileOpen($path, 'r');
...
}
The culprit is line #98. Obviously, getAbsThemePath() returns empty string instead of the theme's full path. Here it is:
public function getAbsThemePath()
{
$theme = $this->_theme->load($this->getThemeId());
$result = $this->_componentRegistrar->getPath(ComponentRegistrar::THEME, 'frontend/' . $theme->getThemePath() );
return $result;
}
public function getThemeId()
{ // should return 4, but returns ''
return $this->_scopeConfig->getValue(self::DESIGN_THEME_ID, $this->getScopeType(), $this->getScopeId() );
}
In getThemeId(): runtime arguments to getValue are ('design/theme/theme_id', 'default', null), and getThemeId() returns null (or ''). Actual theme_id in the magento_db.theme table is 4, and if I hard-code getThemeId() to return 4, then everything works. _scopeConfig is injected \Magento\Framework\App\Config\ScopeConfigInterface
Any ideas as to what's going wrong here and how to fix it?
Also, is it worth fighting with it, or should I just get another template from Template Monster (or some other vendor)?
Thank you for your advice.