-
Notifications
You must be signed in to change notification settings - Fork 7
/
registration.php
30 lines (26 loc) · 1.09 KB
/
registration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
* @package FishPig_WordPress_Yoast
* @author Ben Tideswell (ben@fishpig.com)
* @url https://fishpig.co.uk/magento/wordpress-integration/yoast/
*/
// phpcs:ignoreFile -- long lines
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'FishPig_WordPress_Yoast',
__DIR__
);
// Protection against installing module in incorrect directory
$currentLocation = __DIR__;
if (strpos($currentLocation, 'app' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR) !== false) {
$relativeLocation = 'app' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'FishPig' . DIRECTORY_SEPARATOR . 'WordPress_Yoast';
if (strpos($currentLocation, $relativeLocation) === false) {
throw new \Exception(sprintf(
"%s is installed in the wrong folder. Please install the module in %s and make sure that you use the correct capitalisation of the module name (%s).",
"FishPig_WordPress_Yoast",
$relativeLocation,
'FishPig' . DIRECTORY_SEPARATOR . 'WordPress_Yoast'
));
}
}