psi-4ward / news4ward

Contao Extensions: News/Blog based on contentelements
13 stars 12 forks source link

Update Helper.php #100

Closed xchs closed 5 years ago

xchs commented 5 years ago

Fix the feed share directory.

psi-4ward commented 5 years ago

pls test, I'll tag a new version on success. thanks :)

sizta commented 5 years ago

Yes, mission accomplished. xml file was successfully generated and updated in web/share/ Tested with Contao 4.4.32

fritzmg commented 5 years ago

This breaks compatibility with Contao 3. The method \Contao\StringUtil::stripRootDir is not available there.

psi-4ward commented 5 years ago

Thats really bad! Can anyone fix this please?

fritzmg commented 5 years ago

May be just do

if (class_exists(\Contao\CoreBundle\ContaoCoreBundle::class)) {
    $objRss = new \File(StringUtil::stripRootDir(System::getContainer()->getParameter('contao.web_dir')) . '/share/' . $strFile . '.xml');
} else {
    $objRss = new \File($strFile . '.xml');
}
psi-4ward commented 5 years ago

Yes smth like that. Can you prep a PR?

fritzmg commented 5 years ago

Only an untested one, since I am not actively using this extension ;). The problem came up in a community forum thread.

psi-4ward commented 5 years ago

Probably someone there could test the fix?