diff --git a/src/MisuzuContext.php b/src/MisuzuContext.php index 735ccb27..3389f773 100644 --- a/src/MisuzuContext.php +++ b/src/MisuzuContext.php @@ -8,56 +8,35 @@ use Index\Db\Migration\{DbMigrationManager,DbMigrationRepo,FsDbMigrationRepo}; use Index\Http\HttpRequest; use Index\Templating\TplEnvironment; use Index\Urls\UrlRegistry; -use Misuzu\Template; -use Misuzu\Apps\AppsContext; -use Misuzu\Auth\{AuthContext,AuthInfo}; -use Misuzu\AuditLog\AuditLogData; -use Misuzu\Changelog\ChangelogData; -use Misuzu\Comments\CommentsData; -use Misuzu\Counters\CountersData; -use Misuzu\Emoticons\EmotesData; -use Misuzu\Forum\ForumContext; -use Misuzu\Messages\MessagesContext; -use Misuzu\News\NewsData; -use Misuzu\OAuth2\OAuth2Context; -use Misuzu\Perms\PermissionsData; -use Misuzu\Profile\ProfileContext; -use Misuzu\Redirects\RedirectsContext; use Misuzu\Routing\{BackedRoutingContext,RoutingContext}; -use Misuzu\Users\{UsersContext,UserInfo}; +use Misuzu\Users\UserInfo; use RPCii\HmacVerificationProvider; use RPCii\Server\{HttpRpcServer,RpcServer}; -// this class should function as the root for everything going forward -// no more magical static classes that are just kind of assumed to exist -// it currently looks Pretty Messy, but most everything else will be holding instances of other classes -// instances of certain classes should only be made as needed, -// dunno if i want null checks some maybe some kind of init func should be called first like is the case -// with the http shit class MisuzuContext { public private(set) Dependencies $deps; public private(set) TplEnvironment $templating; - public private(set) AuditLogData $auditLog; - public private(set) CountersData $counters; + public private(set) AuditLog\AuditLogData $auditLog; + public private(set) Counters\CountersData $counters; - public private(set) EmotesData $emotes; - public private(set) ChangelogData $changelog; - public private(set) NewsData $news; - public private(set) CommentsData $comments; + public private(set) Emoticons\EmotesData $emotes; + public private(set) Changelog\ChangelogData $changelog; + public private(set) News\NewsData $news; + public private(set) Comments\CommentsData $comments; - public private(set) AppsContext $appsCtx; - public private(set) AuthContext $authCtx; - public private(set) ForumContext $forumCtx; - public private(set) MessagesContext $messagesCtx; - public private(set) OAuth2Context $oauth2Ctx; - public private(set) ProfileContext $profileCtx; - public private(set) UsersContext $usersCtx; - public private(set) RedirectsContext $redirectsCtx; + public private(set) Apps\AppsContext $appsCtx; + public private(set) Auth\AuthContext $authCtx; + public private(set) Forum\ForumContext $forumCtx; + public private(set) Messages\MessagesContext $messagesCtx; + public private(set) OAuth2\OAuth2Context $oauth2Ctx; + public private(set) Profile\ProfileContext $profileCtx; + public private(set) Users\UsersContext $usersCtx; + public private(set) Redirects\RedirectsContext $redirectsCtx; - public private(set) PermissionsData $perms; - public private(set) AuthInfo $authInfo; + public private(set) Perms\PermissionsData $perms; + public private(set) Auth\AuthInfo $authInfo; public private(set) SiteInfo $siteInfo; // this probably shouldn't be available @@ -74,25 +53,25 @@ class MisuzuContext { $this->deps->register($this->config); $this->deps->register($this->env); - $this->deps->register($this->perms = new PermissionsData($dbConn)); - $this->deps->register($this->authInfo = $this->deps->constructLazy(AuthInfo::class)); + $this->deps->register($this->perms = new Perms\PermissionsData($dbConn)); + $this->deps->register($this->authInfo = $this->deps->constructLazy(Auth\AuthInfo::class)); $this->deps->register($this->siteInfo = $this->deps->constructLazy(SiteInfo::class, config: $config->scopeTo('site'))); - $this->deps->register($this->appsCtx = $this->deps->constructLazy(AppsContext::class)); - $this->deps->register($this->authCtx = $this->deps->constructLazy(AuthContext::class, config: $config->scopeTo('auth'))); - $this->deps->register($this->forumCtx = $this->deps->constructLazy(ForumContext::class)); - $this->deps->register($this->messagesCtx = $this->deps->constructLazy(MessagesContext::class)); - $this->deps->register($this->oauth2Ctx = $this->deps->constructLazy(OAuth2Context::class, config: $config->scopeTo('oauth2'))); - $this->deps->register($this->profileCtx = $this->deps->constructLazy(ProfileContext::class)); - $this->deps->register($this->usersCtx = $this->deps->constructLazy(UsersContext::class)); - $this->deps->register($this->redirectsCtx = $this->deps->constructLazy(RedirectsContext::class, config: $config->scopeTo('redirects'))); + $this->deps->register($this->appsCtx = $this->deps->constructLazy(Apps\AppsContext::class)); + $this->deps->register($this->authCtx = $this->deps->constructLazy(Auth\AuthContext::class, config: $config->scopeTo('auth'))); + $this->deps->register($this->forumCtx = $this->deps->constructLazy(Forum\ForumContext::class)); + $this->deps->register($this->messagesCtx = $this->deps->constructLazy(Messages\MessagesContext::class)); + $this->deps->register($this->oauth2Ctx = $this->deps->constructLazy(OAuth2\OAuth2Context::class, config: $config->scopeTo('oauth2'))); + $this->deps->register($this->profileCtx = $this->deps->constructLazy(Profile\ProfileContext::class)); + $this->deps->register($this->usersCtx = $this->deps->constructLazy(Users\UsersContext::class)); + $this->deps->register($this->redirectsCtx = $this->deps->constructLazy(Redirects\RedirectsContext::class, config: $config->scopeTo('redirects'))); - $this->deps->register($this->auditLog = $this->deps->constructLazy(AuditLogData::class)); - $this->deps->register($this->changelog = $this->deps->constructLazy(ChangelogData::class)); - $this->deps->register($this->comments = $this->deps->constructLazy(CommentsData::class)); - $this->deps->register($this->counters = $this->deps->constructLazy(CountersData::class)); - $this->deps->register($this->emotes = $this->deps->constructLazy(EmotesData::class)); - $this->deps->register($this->news = $this->deps->constructLazy(NewsData::class)); + $this->deps->register($this->auditLog = $this->deps->constructLazy(AuditLog\AuditLogData::class)); + $this->deps->register($this->changelog = $this->deps->constructLazy(Changelog\ChangelogData::class)); + $this->deps->register($this->comments = $this->deps->constructLazy(Comments\CommentsData::class)); + $this->deps->register($this->counters = $this->deps->constructLazy(Counters\CountersData::class)); + $this->deps->register($this->emotes = $this->deps->constructLazy(Emoticons\EmotesData::class)); + $this->deps->register($this->news = $this->deps->constructLazy(News\NewsData::class)); } public function getDbQueryCount(): int {