This repository has been archived by the owner on Jan 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Wrong convertion __DIR__ to temporary deployment path #45
Comments
This seems to be expected behavior and takes place on line 574 of Deploy.php. Instead of copying the contents of the file, the contents get parsed. This means all constants and methods will be parsed instead of copied over as is. This seems to cause issues. @weierophinney is there a reason the file is included instead of just having the contents copied over verbatim? |
If I comment out the contents of |
After some playing around, this is my solution. I'm not sure how flexible it is, though. protected function copyModules(array $modules, $applicationPath, $tmpDir)
{
$tmpDir = str_replace('//', '/', $tmpDir);
if (empty($modules)) {
return;
}
// copy modules
foreach ($modules as $module) {
$normalized = str_replace('\\', '/', $module);
self::recursiveCopy($applicationPath . '/module/' . $normalized, $tmpDir . '/module/' . $normalized);
}
// enable only the selected modules in the config/application.config.php
if (file_exists($tmpDir . '/config/application.config.php')) {
$config = include $tmpDir . '/config/application.config.php';
$configTest = file_get_contents($tmpDir . '/config/application.config.php');
// Remove a module if not present in $modules
$tot = count($config['modules']);
for ($i = 0; $i < $tot; $i++) {
$normalized = str_replace('\\', '/', $config['modules'][$i]);
if (is_dir($applicationPath . '/module/' . $normalized)
&& ! in_array($config['modules'][$i], $modules)
) {
unset($config['modules'][$i]);
}
}
$configExport = var_export($config, true);
$configExport = str_replace("'" . $tmpDir . '/config', "realpath(__DIR__) . '", $configExport);
file_put_contents(
$tmpDir . '/config/application.config.php',
'<?php return ' . $configExport . ';'
);
}
} |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The application.config.php was changed from:
to
The text was updated successfully, but these errors were encountered: