Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/autoloader #38

Merged
merged 2 commits into from
Mar 25, 2025
Merged

Fix/autoloader #38

merged 2 commits into from
Mar 25, 2025

Conversation

SimonvanWijhe
Copy link
Contributor

@SimonvanWijhe SimonvanWijhe commented Mar 21, 2025

The custom autoloader is very ineffecient and should not get registered if autoloading is already handled by composer.

If classes inside this plugin are already loaded, nothing needs to be done.


if (file_exists($composerAutoload)) {
require_once $composerAutoload;
if (!class_exists(\OWC\OpenPub\Base\Foundation\Plugin::class)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moet de not operator niet weg hier?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nee, als de class al bestaat betekend dit dat de classes in deze plugin al ge-autoloaded zijn. In bedrock gebeurt dit in wp-config.php.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja in de openpub ook: https://bitbucket.org/openwebconcept/gemeente-openpub-whitelabel/src/9b555660d86c1b3a361df2a88c0548c669e3bfd3/htdocs/wp-config.php#lines-6

Maar dan wordt ie dus dubbel ingeladen, good catch zo op de vrijdag ;)


if (file_exists($composerAutoload)) {
require_once $composerAutoload;
if (!class_exists(\OWC\OpenPub\Base\Foundation\Plugin::class)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja in de openpub ook: https://bitbucket.org/openwebconcept/gemeente-openpub-whitelabel/src/9b555660d86c1b3a361df2a88c0548c669e3bfd3/htdocs/wp-config.php#lines-6

Maar dan wordt ie dus dubbel ingeladen, good catch zo op de vrijdag ;)

@SimonvanWijhe SimonvanWijhe merged commit ea180c0 into master Mar 25, 2025
2 checks passed
@SimonvanWijhe SimonvanWijhe deleted the fix/autoloader branch March 25, 2025 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants