joomlatools / joomlatools-pages

Joomlatools Pages is an easy to use page generator (for Joomla)
GNU General Public License v3.0
48 stars 9 forks source link

Path issue on Windows #536

Open Yiannistaos opened 3 years ago

Yiannistaos commented 3 years ago

Machine

Steps to reproduce the behavior

  1. Download the latest release package: com_pages_v0.19.5.zip https://github.com/joomlatools/joomlatools-pages/releases/download/v0.19.5/com_pages_v0.19.5.zip
  2. Upload the package using the Joomla installer.
  3. I've created the file C:\laragon\www\joomla\joomlatools-pages\pages\en\hi.html
  4. I've visited the URL http://joomla.test/en/hi
  5. I've got the error below.

It seems that something goes wrong with the first slash in front of C:\ => "/C:\laragon\". Please, see the error below.

Result

` RuntimeException: 'The page registry cache path "/C:\laragon\www\joomla/joomlatools-pages/cache/pages" does not exist' thrown in C:\laragon\www\joomla\components\com_pages\page\registry.php on line 550

while handling exception

RuntimeException: 'The page registry cache path "/C:\laragon\www\joomla/joomlatools-pages/cache/pages" does not exist' thrown in C:\laragon\www\joomla\components\com_pages\page\registry.php on line 550

Stacktrace

0 C:\laragon\www\joomla\components\com_pages\page\registry.php(526): ComPagesPageRegistry->storeCache('/C:\laragon\www...', Array)

1 C:\laragon\www\joomla\components\com_pages\page\registry.php(33): ComPagesPageRegistry->loadCache('/C:\laragon\www...', false)

2 C:\laragon\www\joomla\libraries\joomlatools\library\object\manager\manager.php(723): ComPagesPageRegistry->__construct(Object(KObjectConfig))

3 C:\laragon\www\joomla\libraries\joomlatools\library\object\manager\manager.php(161): KObjectManager->_instantiate(Object(KObjectIdentifier), Object(KObjectConfig))

4 C:\laragon\www\joomla\libraries\joomlatools\library\object\object.php(290): KObjectManager->getObject(Object(KObjectIdentifier), Array)

5 C:\laragon\www\joomla\components\com_pages\dispatcher\router\pages.php(16): KObject->getObject('page.registry')

6 C:\laragon\www\joomla\libraries\joomlatools\library\object\object.php(73): ComPagesDispatcherRouterPages->_initialize(Object(KObjectConfig))

7 C:\laragon\www\joomla\components\com_pages\dispatcher\router\abstract.php(42): KObject->__construct(Object(KObjectConfig))

8 C:\laragon\www\joomla\libraries\joomlatools\library\object\manager\manager.php(723): ComPagesDispatcherRouterAbstract->__construct(Object(KObjectConfig))

9 C:\laragon\www\joomla\libraries\joomlatools\library\object\manager\manager.php(161): KObjectManager->_instantiate(Object(KObjectIdentifier), Object(KObjectConfig))

`

johanjanssens commented 3 years ago

@Yiannistaos Thanks for the report. Seen this specific issue before, it's a Windows path problem related to your server setup.

I'm afraid I do not have a Windows machine at my disposal to test and fix this issue, so will need your help a bit. Can you please do the following:

  1. Open up /index.phpfile for editing and add the following code
var_dump($_SERVER['DOCUMENT_ROOT']);
echo '<br />';
var_dump(JPATH_ROOT);
echo '<br />';
var_dump(Koowa::getInstance()->getRootPath());
echo '<br />';
var_dump( KObjectManager::getInstance()->getObject('com://site/pages.config')->getSitePath('cache'));

below the last line of code:

// Execute the application.
$app->execute(); 

The result would be

....

// Execute the application.
$app->execute();

var_dump($_SERVER['DOCUMENT_ROOT']);
echo '<br />';
var_dump(JPATH_ROOT);
echo '<br />';
var_dump(Koowa::getInstance()->getRootPath());
echo '<br />';
var_dump( KObjectManager::getInstance()->getObject('com://site/pages.config')->getSitePath('cache'));

Then go to your home page and you should get 4 lines rendered at the bottom of the page as so:

Screenshot 2021-02-10 at 14 56 47

Please provide me those 4 lines, this gives me an idea about your paths and what could be wrong.

Yiannistaos commented 3 years ago

@johanjanssens

With the "System - Joomlatools Framework" plugin enable it doesn't display anything after $app->execute();, only the error I've mentioned in the previous message.

RuntimeException: 'The page registry cache path "/C:\laragon\www\joomla/joomlatools-pages/cache/pages" does not exist' thrown in C:\laragon\www\joomla\components\com_pages\page\registry.php on line 550

while handling exception

RuntimeException: 'The page registry cache path "/C:\laragon\www\joomla/joomlatools-pages/cache/pages" does not exist' thrown in C:\laragon\www\joomla\components\com_pages\page\registry.php on line 550

I've disable the plugin "System - Joomlatools Framework" and I've added the below code in the index.php file. You can see the paths at the comments on the right side of each line.

// Execute the application.
$app->execute();

$path = JPATH_LIBRARIES.'/joomlatools/library/koowa.php';
require_once $path;
var_dump($_SERVER['DOCUMENT_ROOT']); // string(22) "C:/laragon/www/joomla/"
var_dump(JPATH_ROOT); // string(21) "C:\laragon\www\joomla"
var_dump(Koowa::getInstance()->getRootPath()); // string(21) "C:\laragon\www\joomla"
# var_dump( KObjectManager::getInstance()->getObject('com://site/pages.config')->getSitePath('cache')); // ERROR: 0 Cannot load object from identifier: com://site/pages.config
Bodge-IT commented 3 years ago

@johanjanssens "Seen this specific issue before, it's a Windows path problem related to your server setup."
I have this too, on my standard windows 7 client and XAMPP. I gave up trying to get it to work and moved to an online setup as the location of the finished result would end up online anyway.

johanjanssens commented 3 years ago

@Bodge-IT @Yiannistaos I still don't have access to a Windows system, so a bit hard for me to work on this bug. Would love to get this one out of the way though.

Re-reading the initial report. It seems that pages cannot create the cache path and then errors out, which is to be expected. This could be a problem with the path, which was my initial hunch, or a problem with the folder permissions.

Can you try to following, add the cache path manually and see if that gets you past the error, you need to manually create this folder: /joomlatools-pages/cache

manojLondhe commented 3 years ago

My colleague had similar problem on windows. Created paths for cache folders manually, still never got it to work.

esedic commented 3 years ago

This my error log from Windows machine:

RuntimeException: 'The template cache path "/C:\laragon\www\joomla3/joomlatools-pages/cache/templates" does not exist' thrown in C:\laragon\www\joomla3\libraries\joomlatools\library\template\engine\abstract.php on line 143

while handling exception

RuntimeException: 'The page registry cache path "/C:\laragon\www\joomla3/joomlatools-pages/cache" does not exist' thrown in C:\laragon\www\joomla3\libraries\joomlatools-components\pages\page\registry.php on line 590

Stacktrace

0 C:\laragon\www\joomla3\libraries\joomlatools-components\pages\page\registry.php(566): ComPagesPageRegistry->storeCache('/C:\laragon\www...', Array)

1 C:\laragon\www\joomla3\libraries\joomlatools-components\pages\page\registry.php(33): ComPagesPageRegistry->loadCache('/C:\laragon\www...', false)

2 C:\laragon\www\joomla3\libraries\joomlatools\library\object\manager\manager.php(723): ComPagesPageRegistry->__construct(Object(KObjectConfig))

3 C:\laragon\www\joomla3\libraries\joomlatools\library\object\manager\manager.php(161): KObjectManager->_instantiate(Object(KObjectIdentifier), Object(KObjectConfig))

4 C:\laragon\www\joomla3\libraries\joomlatools\library\object\object.php(290): KObjectManager->getObject(Object(KObjectIdentifier), Array)

5 C:\laragon\www\joomla3\libraries\joomlatools-components\pages\dispatcher\router\router.php(16): KObject->getObject('page.registry')

6 C:\laragon\www\joomla3\libraries\joomlatools\library\object\object.php(73): ComPagesDispatcherRouter->_initialize(Object(KObjectConfig))

7 C:\laragon\www\joomla3\libraries\joomlatools-components\pages\dispatcher\router\abstract.php(42): KObject->__construct(Object(KObjectConfig))

8 C:\laragon\www\joomla3\libraries\joomlatools\library\object\manager\manager.php(723): ComPagesDispatcherRouterAbstract->__construct(Object(KObjectConfig))

9 C:\laragon\www\joomla3\libraries\joomlatools\library\object\manager\manager.php(161): KObjectManager->_instantiate(Object(KObjectIdentifier), Object(KObjectConfig))

10 C:\laragon\www\joomla3\libraries\joomlatools\library\object\object.php(290): KObjectManager->getObject(Object(KObjectIdentifier), Array)

11 C:\laragon\www\joomla3\libraries\joomlatools-components\pages\dispatcher\router\factory.php(75): KObject->getObject('com:pages.dispa...', Array)

12 C:\laragon\www\joomla3\libraries\joomlatools-components\pages\dispatcher\http.php(90): ComPagesDispatcherRouterFactory->resolve('pages:/', Array)

13 C:\laragon\www\joomla3\libraries\joomlatools-components\pages\event\subscriber\dispatcher.php(169): ComPagesDispatcherHttp->getRoute()

14 C:\laragon\www\joomla3\libraries\joomlatools-components\pages\event\subscriber\dispatcher.php(44): ComPagesEventSubscriberDispatcher->isDispatchable()

15 C:\laragon\www\joomla3\libraries\joomlatools\library\event\publisher\abstract.php(128): ComPagesEventSubscriberDispatcher->onAfterApplicationInitialise(Object(KEvent), Object(ComKoowaEventPublisher))

16 C:\laragon\www\joomla3\libraries\joomlatools\component\koowa\event\publisher\publisher.php(55): KEventPublisherAbstract->publishEvent(Object(KEvent), Array, Object(Joomla\CMS\Application\SiteApplication))

17 C:\laragon\www\joomla3\plugins\system\joomlatools\joomlatools.php(287): ComKoowaEventPublisher->publishEvent('onAfterApplicat...', Array, Object(Joomla\CMS\Application\SiteApplication))

18 C:\laragon\www\joomla3\plugins\system\joomlatools\joomlatools.php(202): PlgSystemJoomlatools->_proxyEvent('onAfterApplicat...')

19 C:\laragon\www\joomla3\libraries\joomla\event\event.php(70): PlgSystemJoomlatools->onAfterInitialise()

20 C:\laragon\www\joomla3\libraries\joomla\event\dispatcher.php(160): JEvent->update(Array)

21 C:\laragon\www\joomla3\libraries\src\Application\BaseApplication.php(108): JEventDispatcher->trigger('onafterinitiali...', Array)

22 C:\laragon\www\joomla3\libraries\src\Application\CMSApplication.php(674): Joomla\CMS\Application\BaseApplication->triggerEvent('onAfterInitiali...')

23 C:\laragon\www\joomla3\libraries\src\Application\SiteApplication.php(686): Joomla\CMS\Application\CMSApplication->initialiseApp(Array)

24 C:\laragon\www\joomla3\libraries\src\Application\SiteApplication.php(212): Joomla\CMS\Application\SiteApplication->initialiseApp()

25 C:\laragon\www\joomla3\libraries\src\Application\CMSApplication.php(203): Joomla\CMS\Application\SiteApplication->doExecute()

26 C:\laragon\www\joomla3\index.php(49): Joomla\CMS\Application\CMSApplication->execute()

27 {main}

I've noticed additional slash in the beginning of the path: /C:\laragon\www\joomla3/joomlatools-pages/cache