bueltge / multisite-global-media

Share a media library across the WordPress Multisite network
GNU General Public License v2.0
213 stars 49 forks source link

No suitable autoloader found #143

Open wimkroegman opened 1 year ago

wimkroegman commented 1 year ago

Hi, I keep on getting a 'No suitable autoloader found' message with the 0.2.0 version. I've used the .zip file in the tagged version and tried to build via composer. Both give the same error.

Also clearing browser cache and installing new WP installs doesn't help.

When I use 0.1.0-beta, all works fine. Any suggestions?

stefthoen commented 1 year ago

I ran into the same issue. Tried forking the repo and updating the Composer installer to 2.0. Didn't work.

In the end I ran composer install in the plugin folder and added the plugin to my website's repo. I'm not happy with the 9063 files being added, but don't see how else I can use this plugin.

stefthoen commented 1 year ago

@wimkroegman I finally did get it working without including all the dependencies. I ran composer dumpautoload in the plugins folder and it created the autoload classes it needed.

ferdydurque commented 1 year ago

Hi, I'm sorry.

I tried to use composer as you mention, or downloading the zip from releases ... and set the plugins in the mu-plugins but nothing works. Is there a way to download the plugin without any use of composer?

wimkroegman commented 1 year ago

Thx @stefthoen. Will have a look at your solution.

jordanrabidou commented 1 year ago

having the same issues as the above

stefthoen commented 1 year ago

Here's a link to the fork that includes the the autoload files. I'm not planning to maintain it and keep it in sync with this repo. @ferdydurque @thebananaland

peteratomic commented 9 months ago

Don't get it. The instructions don't say anything about composer (whatever that is) being a requirement. Can someone from the developer team confirm this? Is using composer REQUIRED or not?

I have tried a regular plugin install AND placing the release (downloaded from the release page as instructed!) in the mu-plugins folder. Neither works.

"No suitable autoloader found. Multisite Global Media cannot be loaded correctly." never goes away.

stefthoen commented 9 months ago

@peteratomic this plugin hasn't been updated in a while and the main developer is unresponsive, so I don't think you'll get an answer anytime soon.

Composer is a PHP dependency manager. It's like npm for PHP. You can use Composer to pull in packages from packagist.org, but you can also use it to create an autoloader. This is a file that tells your PHP project where it can find the classes that your code needs.

If you need to use a class in another file you use to do require, or require_once. With namespacing, and file import using use, that's no longer necessary.

The developer of this plugin requires a autoload file, but forgot to include one in this codebase. You need to generate it yourself.

alevals commented 6 months ago

thanks @stefthoen !

ethaizone commented 5 months ago

Hi. I found this same issue too so here is steps that I did and it helped me. I just share in case if someone don't familiar with composer.

  1. Install this plugin with composer command. BTW I install from dev-master as I use PHP 8.2.
  2. create wp-content/mu-plugins/load.php then put content like this.
    <?php
    require_once ABSPATH.'vendor/autoload.php';
    require_once WPMU_PLUGIN_DIR.'/multisite-global-media/multisite-global-media.php';

If you do this way then it won't throw error. I tested and it works for PHP. (I found other issue on JS on latest Wordpress but it's another topic.)

BTW I think someone might aware as exists of Composer\Installers as it's required library for install plugin via composer but you won't need to worry. Composer won't load class if no one call it. so no need to worry. If someone want to prove it then you can put var_dump and die in vendor/composer/installers/src/Composer/Installers/Installer.php to test it.