SchumacherFM / wordpress-to-hugo-exporter

Hugo is static site generator written in golang. Wordpress is a tool for remote access to your server ;-) ❗️Contributions welcome!
https://gohugo.io
GNU General Public License v3.0
681 stars 95 forks source link

failing on empty directories #24

Closed robsonsobral closed 5 years ago

robsonsobral commented 8 years ago

Hi!

The loop at line 370, foreach (glob(trailingslashit($dir) . '*') as $path) { is failing to run if there are empty directories on wp-content/uploads/. I'm sorry, but I don't know how to fix it. I deleted all empty directories and filled the directory of current month with a dummy text file.

Thanks, guys.

SchumacherFM commented 7 years ago

Seems like this one has been solved. No one else reported such a problem. Otherwise please reopen or create a new issue.

weldpua2008 commented 7 years ago

Hi, I have the similar issue when I call site.com/wp-admin/export.php?type=hugo:

Warning: Invalid argument supplied for foreach() in /home/site.com/wp-content/plugins/wordpress-to-hugo-exporter-master/hugo-export.php on line 371
PKL7J§≤b?2Ùhugo-export/about/index.mdUë¡N¬@E˜˝äŸ€ö°Ï˙.L\ì–®    jå;@¡D6.˝ì“P©•¥øpflyflîÿΩôwÔ}gfiA‡%è… é>ëÀ)(ºfiSÚ0GÊ9x…ÀàÌQÔ>ˆ˙ΩÑeh;6ËÑAÿΩ √»v£∞{emd≠ÁÃ√7cjÉF¶(P1ujd&sSQ»RVôπé˚7„x2π6¯Bç6i;R’P5CJœ⁄`è3fZ8 j&UÏ.©˙0ÙPõcã\§?]•¯%HÓyW lul√‚ kÜ÷»tùŒ≤wÉY˙e˚ÄL ö∆c)؃H/P9£vt-®æÒî^∫Ó˘ìˇ—`wŸÛ5©<≥Ú:
weldpua2008 commented 7 years ago

Fixed line https://github.com/SchumacherFM/wordpress-to-hugo-exporter/blob/master/hugo-export.php#L371 foreach ( (array)glob(trailingslashit($dir) . '*') as $path) {

SchumacherFM commented 7 years ago

F*** PHP regarding glob:

On some systems it is impossible to distinguish between empty match and an error.

@weldpua2008 can you please send me a pull request with your fix?

SchumacherFM commented 5 years ago

I'm closing this as too old or maybe even fixed.