parser

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCouldNotReadWPConfig = errors.New("could not read wp-config.php")
	ErrEmptyContents        = errors.New("empty contents")
	ErrCantFindCredentials  = errors.New("could not find credentials in wp-config.php")
	ErrCantFindPrefix       = errors.New("could not find prefix in wp-config.php")
)

Functions

This section is empty.

Types

type Emitter

type Emitter interface {
	EmitSingle(src string, fn emitter.EmitFunc) error
}

An Emitter is a simpler interface for the emitter.FileEmitter. It is used to download the wp-config.php file.

type EmitterWPConfigParser

type EmitterWPConfigParser struct {
	// contains filtered or unexported fields
}

EmitterWPConfigParser is responsible for parsing the required fields from the wp-config.php file. It uses an Emitter to download the remote file.

func NewEmitterCredentialsParser

func NewEmitterCredentialsParser(e Emitter) *EmitterWPConfigParser

NewEmitterCredentialsParser is a constructor that returns an EmitterWPConfigParser.

func (*EmitterWPConfigParser) ParseWPConfig

func (p *EmitterWPConfigParser) ParseWPConfig(publicPath types.PublicPath) (WPConfigFields, error)

ParseWPConfig is the main function of the EmitterWPConfigParser. It downloads the wp-config.php file and parses the fields we need (database credentials, table prefix) from it.

type WPConfigFields

type WPConfigFields struct {
	Credentials database.DatabaseCredentials
	Prefix      string
}

WPConfigFields holds the fields parsed from the wp-config.php file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL