mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-18 04:48:39 +00:00
Creating application routing
This commit is contained in:
parent
ab09f71e94
commit
6c961ea58e
|
|
@ -150,9 +150,15 @@ class InstallerAbstract
|
|||
*/
|
||||
private static function initRoutes(InfoManager $info)
|
||||
{
|
||||
self::installRoutes(ROOT_PATH . '/Web/Routes.php', ROOT_PATH . '/Modules/' . $info->getDirectory() . '/Admin/Routes/http.php');
|
||||
self::installRoutes(ROOT_PATH . '/Socket/Routes.php', ROOT_PATH . '/Modules/' . $info->getDirectory() . '/Admin/Routes/socket.php');
|
||||
self::installRoutes(ROOT_PATH . '/Console/Routes.php', ROOT_PATH . '/Modules/' . $info->getDirectory() . '/Admin/Routes/console.php');
|
||||
$directories = new Directory(ROOT_PATH . '/Modules/' . $info->getDirectory() . '/Admin/Routes');
|
||||
|
||||
foreach($directories as $key => $subdir) {
|
||||
if($subdir instanceOf Directory) {
|
||||
foreach($subdir as $key2 => $file) {
|
||||
self::installRoutes(ROOT_PATH . '/' . $subdir->getName() . '/' . $file->getName() . '/Routes.php', $file->getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -170,6 +176,10 @@ class InstallerAbstract
|
|||
*/
|
||||
private static function installRoutes(string $destRoutePath, string $srcRoutePath)
|
||||
{
|
||||
if(!file_exists($destRoutePath)) {
|
||||
mkdir($destRoutePath);
|
||||
}
|
||||
|
||||
if (file_exists($destRoutePath) && file_exists($srcRoutePath)) {
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
$appRoutes = include $destRoutePath;
|
||||
|
|
|
|||
|
|
@ -80,15 +80,11 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
|
|||
parent::index();
|
||||
|
||||
foreach (glob($this->path . DIRECTORY_SEPARATOR . $this->filter) as $filename) {
|
||||
// todo: handle . and ..???!!!
|
||||
if (is_dir($filename)) {
|
||||
$file = new Directory($filename);
|
||||
$file->index();
|
||||
} else {
|
||||
$file = new File($filename);
|
||||
}
|
||||
if(strpos($filename, '.') === false) {
|
||||
$file = is_dir($filename) ? new self($filename) : new File($filename);
|
||||
|
||||
$this->add($file);
|
||||
$this->add($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user