Open sminnee opened 7 years ago
Our quick fix is:
} else if(file_exists(BASE_PATH.'/framework/src/Core/CoreKernel.php')) {
//SS 4 OO
use SilverStripe\Control\HTTPApplication;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\CoreKernel;
require_once(BASE_PATH. '/vendor/autoload.php');
if (!file_exists($autoloadPath = BASE_PATH. '/vendor/autoload.php')) {
exit;
}
require_once $autoloadPath;
// Mock request
$request = new HTTPRequest('GET', '/');
$request->setSession(new Session([])));
$kernel = new CoreKernel(BASE_PATH);
$app = new HTTPApplication($kernel);
$app->execute($request, function (HTTPRequest $request) {
global $databaseConfig;
$output = array();
foreach($databaseConfig as $k => $v) {
$output['db_' . $k] = $v;
}
$output['assets_path'] = ASSETS_PATH;
echo serialize($output);
echo "\n";
});
exit;
} else {
The branch ss4rc1-compat
works in Dev, but I have only tested the save
command. Our sysadmins use sspak with Fabricdeploy so will ensure it works for their use-cases and report back...sometime.
Thanks to @mikenz that formed the basis of this.
see #64
This code seems to be very SS3 centric because there is no mention of
vendor/silverstripe/framework/core.php
or something like that.
https://github.com/silverstripe/sspak/blob/master/src/DataExtractor/DatabaseConnector.php#L28-L44
https://github.com/silverstripe/sspak/blob/master/src/sspak-sniffer.php relies on Core.php and global $databaseConfig. For SilverStripe 4 this will need to change.
Ideally, the pre-app-object support for SS4 will still work.