mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 22:18:40 +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)
|
private static function initRoutes(InfoManager $info)
|
||||||
{
|
{
|
||||||
self::installRoutes(ROOT_PATH . '/Web/Routes.php', ROOT_PATH . '/Modules/' . $info->getDirectory() . '/Admin/Routes/http.php');
|
$directories = new Directory(ROOT_PATH . '/Modules/' . $info->getDirectory() . '/Admin/Routes');
|
||||||
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');
|
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)
|
private static function installRoutes(string $destRoutePath, string $srcRoutePath)
|
||||||
{
|
{
|
||||||
|
if(!file_exists($destRoutePath)) {
|
||||||
|
mkdir($destRoutePath);
|
||||||
|
}
|
||||||
|
|
||||||
if (file_exists($destRoutePath) && file_exists($srcRoutePath)) {
|
if (file_exists($destRoutePath) && file_exists($srcRoutePath)) {
|
||||||
/** @noinspection PhpIncludeInspection */
|
/** @noinspection PhpIncludeInspection */
|
||||||
$appRoutes = include $destRoutePath;
|
$appRoutes = include $destRoutePath;
|
||||||
|
|
|
||||||
|
|
@ -80,15 +80,11 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess
|
||||||
parent::index();
|
parent::index();
|
||||||
|
|
||||||
foreach (glob($this->path . DIRECTORY_SEPARATOR . $this->filter) as $filename) {
|
foreach (glob($this->path . DIRECTORY_SEPARATOR . $this->filter) as $filename) {
|
||||||
// todo: handle . and ..???!!!
|
if(strpos($filename, '.') === false) {
|
||||||
if (is_dir($filename)) {
|
$file = is_dir($filename) ? new self($filename) : new File($filename);
|
||||||
$file = new Directory($filename);
|
|
||||||
$file->index();
|
|
||||||
} else {
|
|
||||||
$file = new File($filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->add($file);
|
$this->add($file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user