Created
August 10, 2023 13:28
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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