public function createModuleLoader($pathToStore, $modules = [],
                                       $topModules = ['melisdbdeploy', 'meliscomposerdeploy', 'meliscore'],
                                       $bottomModules = ['MelisModuleConfig'])
    {
        $tmpFileName = 'melis.module.load.php.tmp';
        $fileName = 'melis.module.load.php';
        if ($this->checkDir($pathToStore)) {
            $coreModules = $this->getCoreModules();
            $topModules = array_reverse($topModules);
            foreach ($topModules as $module) {
                if (isset($coreModules[$module]) && $coreModules[$module]) {
                    array_unshift($modules, $coreModules[$module]);
                } else {
                    array_unshift($modules, $module);
                }

            }

            foreach ($bottomModules as $module) {
                if (isset($coreModules[$module]) && $coreModules[$module]) {
                    array_push($modules, $coreModules[$module]);
                } else {
                    array_push($modules, $module);
                }
            }

            $config = new Config($modules, true);
            $writer = new PhpArray();
            $conf = $writer->toString($config);
            $conf = preg_replace('/    \d+/u', '', $conf); // remove the number index
            $conf = str_replace('=>', '', $conf); // remove the => characters.
            file_put_contents($pathToStore . '/' . $tmpFileName, $conf);

            if (file_exists($pathToStore . '/' . $tmpFileName)) {
                // check if the array is not empty
                $checkConfig = include($pathToStore . '/' . $tmpFileName);
                if (count($checkConfig) > 1) {
                    // delete the current module loader file
                    unlink($pathToStore . '/' . $fileName);
                    // rename the module loader tmp file into module.load.php
                    rename($pathToStore . '/' . $tmpFileName, $pathToStore . '/' . $fileName);
                    // if everything went well
                    return true;
                }
            }

        }

        return false;
    }
public function createModuleLoader($pathToStore, $modules = [],
                                       $topModules = ['melisdbdeploy', 'meliscomposerdeploy', 'meliscore'],
                                       $bottomModules = ['MelisModuleConfig'])
    {
        $tmpFileName = 'melis.module.load.php.tmp';
        $fileName = 'melis.module.load.php';
        if ($this->checkDir($pathToStore)) {
            $coreModules = $this->getCoreModules();
            $topModules = array_reverse($topModules);
            foreach ($topModules as $module) {
                if (isset($coreModules[$module]) && $coreModules[$module]) {
                    array_unshift($modules, $coreModules[$module]);
                } else {
                    array_unshift($modules, $module);
                }

            }

            foreach ($bottomModules as $module) {
                if (isset($coreModules[$module]) && $coreModules[$module]) {
                    array_push($modules, $coreModules[$module]);
                } else {
                    array_push($modules, $module);
                }
            }

            $config = new Config($modules, true);
            $writer = new PhpArray();
            $conf = $writer->toString($config);
            $conf = preg_replace('/    \d+/u', '', $conf); // remove the number index
            $conf = str_replace('=>', '', $conf); // remove the => characters.
            file_put_contents($pathToStore . '/' . $tmpFileName, $conf);

            if (file_exists($pathToStore . '/' . $tmpFileName)) {
                // check if the array is not empty
                $checkConfig = include($pathToStore . '/' . $tmpFileName);
                if (count($checkConfig) > 1) {
                    // delete the current module loader file
                    unlink($pathToStore . '/' . $fileName);
                    // rename the module loader tmp file into module.load.php
                    rename($pathToStore . '/' . $tmpFileName, $pathToStore . '/' . $fileName);
                    // if everything went well
                    return true;
                }
            }

        }

        return false;
    }
public function createModuleLoader ( $ pathToStore , $ modules = [ ] , $ topModules = [ 'melisdbdeploy' , 'meliscomposerdeploy' , 'meliscore' ] , $ bottomModules = [ 'MelisModuleConfig' ] ) { $ tmpFileName = 'melis.module.load.php.tmp' ; $ fileName = 'melis.module.load.php' ; if ( $ this -> checkDir ( $ pathToStore ) ) { $ coreModules = $ this -> getCoreModules ( ) ; $ topModules = array_reverse ( $ topModules ) ; foreach ( $ topModules as $ module ) { if ( isset ( $ coreModules [ $ module ] ) && $ coreModules [ $ module ] ) { array_unshift ( $ modules , $ coreModules [ $ module ] ) ; } else { array_unshift ( $ modules , $ module ) ; } } foreach ( $ bottomModules as $ module ) { if ( isset ( $ coreModules [ $ module ] ) && $ coreModules [ $ module ] ) { array_push ( $ modules , $ coreModules [ $ module ] ) ; } else { array_push ( $ modules , $ module ) ; } } $ config = new Config ( $ modules , true ) ; $ writer = new PhpArray ( ) ; $ conf = $ writer -> toString ( $ config ) ; $ conf = preg_replace ( '/    \d+/u' , '' , $ conf ) ; // remove the number index
 $ conf = str_replace ( '=>' , '' , $ conf ) ; // remove the => characters.
 file_put_contents ( $ pathToStore . '/' . $ tmpFileName , $ conf ) ; if ( file_exists ( $ pathToStore . '/' . $ tmpFileName ) ) { // check if the array is not empty
 $ checkConfig = include ( $ pathToStore . '/' . $ tmpFileName ) ; if ( count ( $ checkConfig ) > 1 ) { // delete the current module loader file
 unlink ( $ pathToStore . '/' . $ fileName ) ; // rename the module loader tmp file into module.load.php
 rename ( $ pathToStore . '/' . $ tmpFileName , $ pathToStore . '/' . $ fileName ) ; // if everything went well
 return true ; } } } return false ; }
Creates module loader file

@param $pathToStore
@param array $modules
@param array $topModules
@param array $bottomModules

@return bool
Creates module loader file