Author Topic: DirectoryIterator::__construct(...): failed to open dir: No such file or direct  (Read 1907 times)

stAn99

  • Contributing Developer
  • Jr. Member
  • *
  • Posts: 81
    • One Page Checkout for Virtuemart 2
DirectoryIterator::__construct(/web/vm2/mero//test/images/availability/): failed to open dir: No such file or directory

if the directory set up in VM's "General Assets URL" is wrong, it's not possible to visit the Virtuemart configuration backend on joomla 3.5.1 (and possibly other 3.x versions) because JHtml::_('list.images', 'image'.... returns non-recoverable user error if the path does not exists.

To fix this you may need to wrap this code into a try and catch clause:

\administrator\components\com_virtuemart\views\config\tmpl\default_shopfront.php

original code:
Code: [Select]
echo JHtml::_('list.images', 'image', VmConfig::get('rised_availability'), " ", $this->imagePath);

suggested code:
Code: [Select]
try
{
echo JHtml::_('list.images', 'image', VmConfig::get('rised_availability'), " ", $this->imagePath);
}
catch (Exception $e)
{
echo '';
}

best regards, stan
----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9835
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
My current solution, directly in the layout

Code: [Select]
<?php if(!empty($this->imagePath)) {
echo JHtml::_('list.images''image'VmConfig::get('rised_availability'), " "$this->imagePath);
} else {
echo vmText::_('COM_VIRTUEMART_ADMIN_CFG_ASSETS_GENERAL_PATH_MISSING');
}
?>

I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3765
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Bug is real, but I tested DirectoryIterator in a search file (with many images), this is 2 to 3 time slower as:
opendir($path)))
      while (($file = readdir ....
So perhaps changing code is better as fix it ?

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9835
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
We can do that later, when we use the VMF, but atm it is a joomla function as far as I understood.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/