InstallCommand
extends Command
in package
Console command: VuFind installer.
Tags
Table of Contents
- MULTISITE_DIR_BASED = 1
- MULTISITE_HOST_BASED = 2
- MULTISITE_NONE = 0
- $baseDir : string
- Base directory of VuFind installation.
- $basePath : string
- Base path for VuFind URLs.
- $host : string
- Hostname of VuFind installation (used for host-based multi-site).
- $makeBackups : bool
- Should we make backups of existing files?
- $module : string
- Custom local code module name (if any).
- $multisiteMode : int
- Active multi-site mode.
- $overrideDir : string
- Local settings directory for VuFind installation.
- $solrPort : string
- Solr port to use.
- __construct() : mixed
- Constructor
- backUpFile() : bool|string
- Back up an existing file and inform the user. Return true on success, error message otherwise.
- buildApacheConfig() : bool|string
- Generate the Apache configuration. Returns true on success, error message otherwise.
- buildDirs() : bool|string
- Build a set of directories.
- buildImportConfig() : bool|string
- Configure a SolrMarc properties file. Returns true on success, error message otherwise.
- buildModule() : bool|string
- Build the module for storing local code changes. Returns true on success, error message otherwise.
- buildModules() : bool|string
- Make sure all modules exist (and create them if they do not). Returns true on success, error message otherwise.
- buildUnixEnvironment() : bool|string
- Build the Unix-specific environment configuration. Returns true on success, error message otherwise.
- buildWindowsConfig() : bool|string
- Build the Windows-specific startup configuration. Returns true on success, error message otherwise.
- collectParameters() : int
- Collect input parameters, and return a status (0 = proceed, 1 = fail).
- configure() : void
- Configure the command.
- displaySuccessMessage() : void
- Display the final message after successful installation.
- execute() : int
- Run the command.
- failWithError() : int
- Display an error message and return a failure status.
- getApacheLocation() : void
- Display system-specific information for where configuration files are found and/or symbolic links should be created.
- getBasePath() : string
- Get a base path from the user (or return a default).
- getEnvironmentVariables() : array<string|int, mixed>
- Get an array of environment variables.
- getHost() : string
- Get the user's hostname preference.
- getInput() : string
- Fetch a single line of input from the user.
- getLinuxApacheMessage() : string
- Get instructions for editing the Apache configuration under Linux.
- getModule() : string
- Get the custom module name from the user (or blank for none).
- getMultisiteMode() : int
- Get the user's preferred multisite mode.
- getOverrideDir() : string
- Get an override directory from the user (or return a default).
- getSolrPort() : string
- Get a Solr port number from the user (or return a default).
- getWindowsApacheMessage() : string
- Get instructions for editing the Apache configuration under Windows.
- initializeOverrideDir() : bool|string
- Initialize the override directory and report success or failure.
- processParameters() : int
- Process collected parameters, and return a status (0 = proceed, 1 = fail).
- validateBasePath() : bool|string
- Validate a base path. Returns true on success, message on failure.
- validateHost() : bool|string
- Validate the user's hostname input. Returns true on success, message on failure.
- validateModule() : bool|string
- Validate the custom module name. Returns true on success, message on failure.
- validateModules() : bool|string
- Validate a comma-separated list of module names. Returns true on success, message on failure.
- validateSolrPort() : bool|string
- Validate a Solr port number. Returns true on success, message on failure.
- writeFileToDisk() : bool
- Write file contents to disk.
Constants
MULTISITE_DIR_BASED
public
mixed
MULTISITE_DIR_BASED
= 1
MULTISITE_HOST_BASED
public
mixed
MULTISITE_HOST_BASED
= 2
MULTISITE_NONE
public
mixed
MULTISITE_NONE
= 0
Properties
$baseDir
Base directory of VuFind installation.
protected
string
$baseDir
$basePath
Base path for VuFind URLs.
protected
string
$basePath
= '/vufind'
$host
Hostname of VuFind installation (used for host-based multi-site).
protected
string
$host
= ''
$makeBackups
Should we make backups of existing files?
protected
bool
$makeBackups
= true
$module
Custom local code module name (if any).
protected
string
$module
= ''
$multisiteMode
Active multi-site mode.
protected
int
$multisiteMode
= self::MULTISITE_NONE
$overrideDir
Local settings directory for VuFind installation.
protected
string
$overrideDir
$solrPort
Solr port to use.
protected
string
$solrPort
= '8983'
Methods
__construct()
Constructor
public
__construct([string|null $name = null ]) : mixed
Parameters
- $name : string|null = null
-
The name of the command; passing null means it must be set in configure()
Return values
mixed —backUpFile()
Back up an existing file and inform the user. Return true on success, error message otherwise.
protected
backUpFile(OutputInterface $output, string $filename, string $desc) : bool|string
Parameters
- $output : OutputInterface
-
Output object
- $filename : string
-
File to back up (if it exists)
- $desc : string
-
Description of file (for output message)
Return values
bool|string —buildApacheConfig()
Generate the Apache configuration. Returns true on success, error message otherwise.
protected
buildApacheConfig(OutputInterface $output) : bool|string
Parameters
- $output : OutputInterface
-
Output object
Return values
bool|string —buildDirs()
Build a set of directories.
protected
buildDirs(array<string|int, mixed> $dirs) : bool|string
Parameters
- $dirs : array<string|int, mixed>
-
Directories to build
Return values
bool|string —True on success, name of problem directory on failure
buildImportConfig()
Configure a SolrMarc properties file. Returns true on success, error message otherwise.
protected
buildImportConfig(OutputInterface $output, string $filename) : bool|string
Parameters
- $output : OutputInterface
-
Output object
- $filename : string
-
The properties file to configure
Return values
bool|string —buildModule()
Build the module for storing local code changes. Returns true on success, error message otherwise.
protected
buildModule(string $module) : bool|string
Parameters
- $module : string
-
The name of the new module (assumed valid!)
Return values
bool|string —buildModules()
Make sure all modules exist (and create them if they do not). Returns true on success, error message otherwise.
protected
buildModules() : bool|string
Return values
bool|string —buildUnixEnvironment()
Build the Unix-specific environment configuration. Returns true on success, error message otherwise.
protected
buildUnixEnvironment(OutputInterface $output) : bool|string
Parameters
- $output : OutputInterface
-
Output object
Return values
bool|string —buildWindowsConfig()
Build the Windows-specific startup configuration. Returns true on success, error message otherwise.
protected
buildWindowsConfig(OutputInterface $output) : bool|string
Parameters
- $output : OutputInterface
-
Output object
Return values
bool|string —collectParameters()
Collect input parameters, and return a status (0 = proceed, 1 = fail).
protected
collectParameters(InputInterface $input, OutputInterface $output) : int
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
Return values
int —0 for success
configure()
Configure the command.
protected
configure() : void
Return values
void —displaySuccessMessage()
Display the final message after successful installation.
protected
displaySuccessMessage(OutputInterface $output) : void
Parameters
- $output : OutputInterface
-
Output object
Return values
void —execute()
Run the command.
protected
execute(InputInterface $input, OutputInterface $output) : int
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
Return values
int —0 for success
failWithError()
Display an error message and return a failure status.
protected
failWithError(OutputInterface $output, string $msg[, int $status = 1 ]) : int
Parameters
- $output : OutputInterface
-
Output object
- $msg : string
-
Error message
- $status : int = 1
-
Error status
Return values
int —getApacheLocation()
Display system-specific information for where configuration files are found and/or symbolic links should be created.
protected
getApacheLocation(OutputInterface $output) : void
Parameters
- $output : OutputInterface
-
Output object
Return values
void —getBasePath()
Get a base path from the user (or return a default).
protected
getBasePath(InputInterface $input, OutputInterface $output) : string
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
Return values
string —getEnvironmentVariables()
Get an array of environment variables.
protected
getEnvironmentVariables() : array<string|int, mixed>
Return values
array<string|int, mixed> —getHost()
Get the user's hostname preference.
protected
getHost(InputInterface $input, OutputInterface $output) : string
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
Return values
string —getInput()
Fetch a single line of input from the user.
protected
getInput(InputInterface $input, OutputInterface $output, string $prompt) : string
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
- $prompt : string
-
Prompt to display to the user.
Return values
string —User-entered response.
getLinuxApacheMessage()
Get instructions for editing the Apache configuration under Linux.
protected
getLinuxApacheMessage() : string
Return values
string —getModule()
Get the custom module name from the user (or blank for none).
protected
getModule(InputInterface $input, OutputInterface $output) : string
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
Return values
string —getMultisiteMode()
Get the user's preferred multisite mode.
protected
getMultisiteMode(InputInterface $input, OutputInterface $output) : int
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
Return values
int —getOverrideDir()
Get an override directory from the user (or return a default).
protected
getOverrideDir(InputInterface $input, OutputInterface $output) : string
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
Return values
string —getSolrPort()
Get a Solr port number from the user (or return a default).
protected
getSolrPort(InputInterface $input, OutputInterface $output) : string
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
Return values
string —getWindowsApacheMessage()
Get instructions for editing the Apache configuration under Windows.
protected
getWindowsApacheMessage() : string
Return values
string —initializeOverrideDir()
Initialize the override directory and report success or failure.
protected
initializeOverrideDir(string $dir) : bool|string
Parameters
- $dir : string
-
Path to attempt to initialize
Return values
bool|string —processParameters()
Process collected parameters, and return a status (0 = proceed, 1 = fail).
protected
processParameters(OutputInterface $output) : int
Parameters
- $output : OutputInterface
-
Output object
Return values
int —0 for success
validateBasePath()
Validate a base path. Returns true on success, message on failure.
protected
validateBasePath(string $basePath[, bool $allowEmpty = false ]) : bool|string
Parameters
- $basePath : string
-
String to validate.
- $allowEmpty : bool = false
-
Are empty values acceptable?
Return values
bool|string —validateHost()
Validate the user's hostname input. Returns true on success, message on failure.
protected
validateHost(string $host) : bool|string
Parameters
- $host : string
-
String to check
Return values
bool|string —validateModule()
Validate the custom module name. Returns true on success, message on failure.
protected
validateModule(string $module) : bool|string
Parameters
- $module : string
-
Module name to validate.
Return values
bool|string —validateModules()
Validate a comma-separated list of module names. Returns true on success, message on failure.
protected
validateModules(string $modules) : bool|string
Parameters
- $modules : string
-
Module names to validate.
Return values
bool|string —validateSolrPort()
Validate a Solr port number. Returns true on success, message on failure.
protected
validateSolrPort(string $solrPort) : bool|string
Parameters
- $solrPort : string
-
Port to validate.
Return values
bool|string —writeFileToDisk()
Write file contents to disk.
protected
writeFileToDisk(string $filename, string $content) : bool
Parameters
- $filename : string
-
Filename
- $content : string
-
Content