Documentation ¶
Index ¶
Constants ¶
const SELECT_SITE_URL_STMT = "SELECT option_value FROM %s WHERE option_name = 'siteurl';"
This is the SQL statement used to select the site url from the database.
Variables ¶
var ( ErrCannotCreateClient = errors.New("cannot create client") ErrCannotDetermineSiteInfo = errors.New("cannot determine site info") ErrCannotBuildOperations = errors.New("cannot build operations") ErrCannotCreateZipFile = errors.New("cannot create zip file") ErrCannotRunOperations = errors.New("cannot run operations") )
var ErrCannotParseWPConfig = errors.New("error parsing wp-config.php file")
var ErrNoOperations = errors.New("no operations to run")
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is responsible for building the operations that will be run by the Runner.
type OperationsBuilder ¶
type OperationsBuilder interface {
Build(info SiteInfo) ([]operations.Operation, error)
}
OperationsBuilder builds all the operations needed to package a WordPress site. They will be run by the OperationsRunner.
type OperationsRunner ¶
type OperationsRunner interface {
Run(operations []operations.Operation, writer io.Writer) error
}
OperationsRunner runs all the operations needed to package a WordPress site. The operations are first built by the OperationsBuilder. Typically, the writer would be a zip file to output to.
type Packager ¶
type Packager struct {
// contains filtered or unexported fields
}
Packager is the orchestrator of the packaging process. It uses an OperationsBuilder to build the operations, and an OperationsRunner to run them. It is also responsible for creating the zip file to output to.
func NewPackager ¶
func NewPackager(sshCredentials sftp.SSHCredentials, siteUrl types.SiteUrl, publicPath types.PublicPath) (*Packager, error)
NewPackager is the constructor for Packager. It will create the default implementations of OperationsBuilder and OperationsRunner.
type Runner ¶
type Runner struct{}
Runner is responsible for running the operations that will create the zip archive. It runs the operations sequentially, and writes the files that they send one by one into the zip archive.
type RuntimePrompter ¶
type RuntimePrompter struct{}
RuntimePrompter is a Prompter that prompts the user at runtime for input.
func (*RuntimePrompter) Prompt ¶
func (p *RuntimePrompter) Prompt(question string) string
Prompt prompts the user with the given question and returns their response.
func (*RuntimePrompter) PromptForPassword ¶
func (p *RuntimePrompter) PromptForPassword(question string) string
PromptForPassword prompts the user for input without echoing the input to the terminal.
type SiteInfo ¶
type SiteInfo struct {
// contains filtered or unexported fields
}
SiteInfo contains all the information needed to package a WordPress site.
func DetermineSiteInfo ¶
func DetermineSiteInfo(siteUrl types.SiteUrl, publicPath types.PublicPath, parser WPConfigParser, runner sftp.RemoteCommandRunner, prompter Prompter) (SiteInfo, error)
DetermineSiteInfo determines the site info needed to package a WordPress site. Some of the information is determined at runtime, such as the database credentials.
type WPConfigParser ¶
type WPConfigParser interface {
ParseWPConfig(publicPath types.PublicPath) (parser.WPConfigFields, error)
}