Skip to content

Commit ea180c0

Browse files
committed
(fix): only require autoload.php if not already loaded
1 parent 5f2cc8c commit ea180c0

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

openpub-base.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,20 @@
2020
die;
2121
}
2222

23-
/**
24-
* Manual loaded file: the autoloader.
25-
*/
26-
require_once __DIR__ . '/autoloader.php';
27-
$autoloader = new OWC\OpenPub\Base\Autoloader();
28-
2923
/**
3024
* Not all the members of the OpenWebconcept are using composer in the root of their project.
3125
* Therefore they are required to run a composer install inside this plugin directory.
3226
* In this case the composer autoload file needs to be required.
27+
*
28+
* If this plugin is not installed with composer a custom autoloader is used.
3329
*/
34-
$composerAutoload = __DIR__ . '/vendor/autoload.php';
35-
36-
if (file_exists($composerAutoload)) {
37-
require_once $composerAutoload;
30+
if (!class_exists(\OWC\OpenPub\Base\Foundation\Plugin::class)) {
31+
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
32+
require_once __DIR__ . '/vendor/autoload.php';
33+
} else {
34+
require_once __DIR__ . '/autoloader.php';
35+
$autoloader = new \OWC\OpenPub\Base\Autoloader();
36+
}
3837
}
3938

4039
/**

0 commit comments

Comments
 (0)