Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cristianstan/cc5494382d2064ee169dfc8954e84011 to your computer and use it in GitHub Desktop.
Save cristianstan/cc5494382d2064ee169dfc8954e84011 to your computer and use it in GitHub Desktop.
Fatal error: Uncaught Error: Call to a member function dirlist() on null in extension_wbc_importer.php:77 Helper.php
<?php
public function demoFiles() {
$this->filesystem = $this->parent->filesystem->execute( 'object' );
// $dir_array1 = $this->filesystem->dirlist( $this->demo_data_dir, false, true );
$dir_array = dirToArray($this->demo_data_dir);
----
<?php
function dirToArray($dir) {
$result = array();
$cdir = scandir($dir);
foreach ($cdir as $key => $value)
{
if (!in_array($value,array(".","..")))
{
if (is_dir($dir . DIRECTORY_SEPARATOR . $value))
{
$result[$value] = array(
'name' => $value,
'type' => 'd',
'files' => dirToArray($dir . DIRECTORY_SEPARATOR . $value),
);
}
else
{
$result[$value] = array(
'name' => $value,
'type' => 'f',
);
}
}
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment