Plugin dup declaration of WP_Filesystem_Base?
-
This error comes and goes for no apparent reason:
“Plugin could not be activated because it triggered a fatal error.
Fatal error: Cannot declare class WP_Filesystem_Base, because the name is already in use in /home2/moabiion/public_html/wp-admin/includes/class-wp-filesystem-base.php on line 14″ (It is declared there as expected: class WP_Filesystem_Base { … )With a custom plugin xxx.php used only on one page, I’m trying tp read an ordinary text file xxx.csv located in the same folder as xxx.php. I’m doing so with the class WP_Filesystem_Direct, an extension of WP_Filesystem_Base. To define/reference them, I use a pair of include statements:
`include ‘/home2/moabiion/public_html/wp-admin/includes/class-wp-filesystem-base.php’;
include ‘/home2/moabiion/public_html/wp-admin/includes/class-wp-filesystem-direct.php’;`I use methods from these class definitions (ie declarations) to access xxx.csv:
`$fileSystem = new WP_Filesystem_Direct(0);
$path = $fileSystem->wp_plugins_dir();
$path .= ‘xxxplugin/xxx.csv’;
$getFileResponse = $fileSystem->get_contents($path);’Often all this compiles and runs fine. Other times (as development of the plugin and website progresses) for mysterious reasons I get the error described above. Odd, because I never try to (re-)declare the two classes (-base or -direct), only instantiate and call their methods.
Perhaps an autoloader conflict? I know little about them.
Thanks for any help for this newbie!
The topic ‘Plugin dup declaration of WP_Filesystem_Base?’ is closed to new replies.