The logic related to the registration of the ncc extension has been refactored. Previously, the code that registered the ncc extension was contained in the installer. However, this change moves the code that registers the ncc extension from the installer to the Utilities/Functions class. This change was made because the extension registration is not only applicable to the installer, but is also required for several other components. This fact justified the need for the logic to be located in a more generic and accessible class. The Makefile, installer, generate_build_files.php files have been updated to reflect this change. Components using these should now work properly with the changes.
68 lines
No EOL
1.7 KiB
PHP
68 lines
No EOL
1.7 KiB
PHP
<?php
|
|
|
|
// Check for NCC
|
|
if(!file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php'))
|
|
{
|
|
print('Could not find \'autoload.php\', this script is intended to be executed during the redistribution process');
|
|
exit(1);
|
|
}
|
|
|
|
/** @noinspection PhpIncludeInspection */
|
|
require(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php');
|
|
|
|
// Start script
|
|
function scanContents($dir)
|
|
{
|
|
$results = [];
|
|
|
|
foreach (scandir($dir, SCANDIR_SORT_NONE) as $key => $value)
|
|
{
|
|
$path = realpath($dir . DIRECTORY_SEPARATOR . $value);
|
|
|
|
if (!is_dir($path))
|
|
{
|
|
$results[] = str_ireplace(__DIR__ . DIRECTORY_SEPARATOR, '', $path);
|
|
}
|
|
elseif ($value !== '.' && $value !== '..')
|
|
{
|
|
/** @noinspection SlowArrayOperationsInLoopInspection */
|
|
$results = array_merge($results, scanContents($path));
|
|
}
|
|
}
|
|
|
|
return $results;
|
|
}
|
|
|
|
|
|
$excluded_files = [
|
|
'hash_check.php',
|
|
'generate_build_files.php',
|
|
'default_config.yaml',
|
|
'installer',
|
|
'checksum.bin',
|
|
'build_files',
|
|
'ncc.sh'
|
|
];
|
|
|
|
ncc\Utilities\Console::out('Creating build_files ...');
|
|
|
|
if(file_exists('build_files'))
|
|
{
|
|
unlink('build_files');
|
|
}
|
|
|
|
$build_files_content = [];
|
|
foreach(scanContents(__DIR__) as $path)
|
|
{
|
|
if(!in_array($path, $excluded_files, true))
|
|
{
|
|
$build_files_content[] = $path;
|
|
}
|
|
}
|
|
|
|
$build_files = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'build_files', 'ab+');
|
|
|
|
fwrite($build_files, implode("\n", $build_files_content));
|
|
fclose($build_files);
|
|
|
|
exit(0); |