Ejemplo n.º 1
0
            $gitCommit = trim(file_get_contents($gitFile));
        }
        $cacheKey = "{$gitCommit}.loader";
        if (!($paths = cache::getCached($cacheKey))) {
            $paths = ['modules' => [APP_ROOT . '/system/modules', CORE_ROOT . '/system/modules'], 'system' => []];
            $appsDir = APP_ROOT . '/apps';
            if (file_exists($appsDir)) {
                foreach (scandir($appsDir) as $appName) {
                    if ($appName[0] === '.') {
                        continue;
                    }
                    $currentModulesDir = "{$appsDir}/{$appName}/modules";
                    if (file_exists($currentModulesDir)) {
                        $paths['modules'][] = $currentModulesDir;
                    }
                    $currentModulesSystemDir = "{$appsDir}/{$appName}/system";
                    if (file_exists($currentModulesSystemDir)) {
                        $paths['system'][] = $currentModulesSystemDir;
                    }
                }
            }
            cache::setCached($cacheKey, $paths);
        }
        $loader->addPsr4('mpcmf\\modules\\', $paths['modules'], false);
        $loader->register(false);
        $loader->addPsr4('mpcmf\\system\\', $paths['system'], true);
        $loader->addPsr4('mpcmf\\', [APP_ROOT, CORE_ROOT], true);
    }
}
loader::load();