pool: Reddo component-like fields

This commit is contained in:
Tom Wiesing 2022-12-22 13:49:05 +01:00
parent 99983ee6db
commit 337a5fbeba
No known key found for this signature in database
48 changed files with 291 additions and 163 deletions

View file

@ -20,9 +20,10 @@ import (
// Prefixes implements reading and writing prefix
type Prefixes struct {
ingredient.Base
PHP *php.PHP
MStore *mstore.MStore
Dependencies struct {
PHP *php.PHP
MStore *mstore.MStore
}
}
var (
@ -58,7 +59,7 @@ func (prefixes *Prefixes) All(ctx context.Context, server *phpx.Server) ([]strin
func (wisski *Prefixes) database(ctx context.Context, server *phpx.Server) (prefixes []string, err error) {
// get all the ugly prefixes
err = wisski.PHP.ExecScript(ctx, server, &prefixes, listURIPrefixesPHP, "list_prefixes")
err = wisski.Dependencies.PHP.ExecScript(ctx, server, &prefixes, listURIPrefixesPHP, "list_prefixes")
if err != nil {
return nil, err
}
@ -149,7 +150,7 @@ var prefix = mstore.For[string]("prefix")
// Prefixes returns the cached prefixes from the given instance
func (wisski *Prefixes) AllCached(ctx context.Context) (results []string, err error) {
return prefix.GetAll(ctx, wisski.MStore)
return prefix.GetAll(ctx, wisski.Dependencies.MStore)
}
// Update updates the cached prefixes of this instance
@ -158,7 +159,7 @@ func (wisski *Prefixes) Update(ctx context.Context) error {
if err != nil {
return err
}
return prefix.SetAll(ctx, wisski.MStore, prefixes...)
return prefix.SetAll(ctx, wisski.Dependencies.MStore, prefixes...)
}
func (prefixes *Prefixes) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {