public class FindAndReplaceUpgradeOperation extends AbstractContentUpgradeOperation
UpgradeOperation
that replaces text in the content repository.
Supported YAML properties:
AbstractContentUpgradeOperation.ListFileVisitor
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_KEY_PATTERN |
static String |
CONFIG_KEY_REPLACEMENT |
protected String |
pattern
The pattern to search in the files
|
protected String |
replacement
The expression to replace in the files
|
CONFIG_KEY_INCLUDED_PATHS, includedPaths
applicationContext, commitDetails, CONFIG_KEY_COMMIT_DETAILS, contentRepository, currentVersion, dataSource, nextVersion, servletContext, studioConfiguration
Constructor and Description |
---|
FindAndReplaceUpgradeOperation() |
Modifier and Type | Method and Description |
---|---|
protected void |
doInit(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config) |
protected boolean |
shouldBeUpdated(String site,
Path file)
Indicates if the given file should be updated by this class
|
protected void |
updateFile(String site,
Path path)
Performs any needed updates on the content of the given file
|
execute, filterPaths, findIncludedPaths, readFile, writeFile
commitAllChanges, getCommitMessage, getConnection, getContentRepository, getProperty, getRepositoryPath, init, loadResource, setApplicationContext, setContentRepository, setDataSource, setServletContext, setStudioConfiguration, writeToRepo
public static final String CONFIG_KEY_PATTERN
public static final String CONFIG_KEY_REPLACEMENT
protected String pattern
protected String replacement
protected void doInit(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config)
doInit
in class AbstractContentUpgradeOperation
protected boolean shouldBeUpdated(String site, Path file)
AbstractContentUpgradeOperation
shouldBeUpdated
in class AbstractContentUpgradeOperation
site
- the site idfile
- the file to checkprotected void updateFile(String site, Path path) throws UpgradeException
AbstractContentUpgradeOperation
updateFile
in class AbstractContentUpgradeOperation
site
- the site idpath
- the file to updateUpgradeException
- if there is any error updating the fileCopyright © 2020 CrafterCMS. All rights reserved.