API / Minn\Cli / SearchReplaceCommand

SearchReplaceCommand final class

Minn\Cli\SearchReplaceCommand · public/minn/src/Minn/Cli/SearchReplaceCommand.php · 143 lines

`wp search-replace`: walks every string column, including serialized PHP arrays, and reports replacements the way the reference does.

Used by 1

Constants and properties

privateSKIP_TYPES = '/^(tinyint|smallint|mediumint|int|bigint|float|double|decimal|bit|date|time|datetime|timestamp|year)/i'

Public

method__invoke(array $args, array $assocArgs): void#

Searches/replaces strings in the database.

## OPTIONS

<old> : A string to search for.

<new> : Replace instances of the first string with this new string.

[<table>...] : Restrict the replacement to these tables.

[--dry-run] : Report without writing.

[--all-tables] : Search every table in the database, not only those with the site prefix.

[--report-changed-only] : Only print tables/columns that changed.

[--format=<format>] : Render output in a particular format. --- default: table options: - table - json ---

Internals 3

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatelistTables(Minn\Cli\Runtime $runtime, bool $all): array#
@return list<string>
privatestringColumns(Minn\Cli\Runtime $runtime, string $table): array#
@return list<string>
privatereplaceColumn(Minn\Cli\Runtime $runtime, string $table, string $column, string $old, string $new, bool $dry): int#