diff --git a/changelog.md b/changelog.md
index 71debf8..2aa35bb 100644
--- a/changelog.md
+++ b/changelog.md
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+# [1.6.0] - 2024-04-10
+* Added - The `slic update-dump` command to update a dump file for the current project, with an optional WordPress version update, e.g. `slic update-dump tests/_data/dump.sql latest`.
+
# [1.5.4] - 2024-04-08
* Change - Disable WordPress's automatic updating in slic containers via docker compose `WORDPRESS_CONFIG_EXTRA` defines. See comments in `.env.slic` to customize this behavior.
diff --git a/includes/polyfills.php b/includes/polyfills.php
new file mode 100644
index 0000000..2215418
--- /dev/null
+++ b/includes/polyfills.php
@@ -0,0 +1,8 @@
+up Starts containers in the stack; alias of `start`.
update Updates the tool and the images used in its services.
upgrade Upgrades the {$cli_name} repo.
+ update-dump Updates a SQL dump file. Optionally, installs a specific WordPress version..
HELP;
$help_message = colorize( $help_message_template );
diff --git a/src/commands/logs.php b/src/commands/logs.php
index 1f14b3f..a382fb1 100644
--- a/src/commands/logs.php
+++ b/src/commands/logs.php
@@ -1,13 +1,13 @@
{$cli_name} logs
+ $cli_name logs
HELP;
echo colorize( $help );
diff --git a/src/commands/update-dump.php b/src/commands/update-dump.php
new file mode 100644
index 0000000..d494361
--- /dev/null
+++ b/src/commands/update-dump.php
@@ -0,0 +1,111 @@
+$cli_name $subcommand []
+
+ EXAMPLES:
+
+ $cli_name $subcommand tests/_data/dump.sql
+ Update the dump file using slic's currently installed version of WordPress.
+
+ $cli_name $subcommand tests/_data/dump.sql latest
+ Update the WordPress version to the latest and update the dump file.
+
+ $cli_name $subcommand tests/_data/dump.sql 6.4.3
+ Update the WordPress version to 6.4.3 and update the dump file.
+ HELP;
+
+ echo colorize( $help );
+
+ return;
+}
+
+// Confirm a target has been set or show an error.
+slic_target( false );
+
+// Extract the arguments.
+$command = $args( '...' );
+$file = trim( $command[0] );
+$version = trim( $command[1] ?? '' );
+
+// Build the path inside the slic container.
+$container_path = remove_double_separators( trailingslashit( get_project_container_path() ) . $file );
+
+// Run core update if a version was provided, otherwise run core update-db.
+if ( $version ) {
+ $update_command = cli_command( [
+ 'core',
+ 'update',
+ '--force',
+ sprintf( '--version=%s', $version ),
+ ], true );
+} else {
+ $update_command = cli_command( [
+ 'core',
+ 'update-db',
+ ], true );
+}
+
+$commands = [
+ cli_command( [
+ 'cli',
+ 'cache',
+ 'clear',
+ ] ),
+ $update_command,
+ cli_command( [
+ 'db',
+ 'reset',
+ '--yes',
+ ] ),
+ cli_command( [
+ 'core',
+ 'version',
+ '--extra',
+ ], true ),
+ cli_command( [
+ 'db',
+ 'export',
+ '--add-drop-table',
+ $container_path,
+ ] ),
+];
+
+// Execute the command chain.
+foreach ( $commands as $arguments ) {
+ $result = slic_passive()( $arguments );
+
+ // 0 is success on command line.
+ if ( $result === 0 ) {
+ continue;
+ }
+
+ echo magenta( sprintf( 'Error: Command Failed: %s', implode( ' ', $arguments ) ) );
+ exit ( 1 );
+}
+
+ensure_wordpress_installed();
+
+echo green( sprintf(
+ "Success: Exported to host path '%s'.",
+ remove_double_separators( trailingslashit( get_project_local_path() ) . $file )
+) );
+
+exit( 0 );
diff --git a/src/utils.php b/src/utils.php
index ce7d53d..56919d6 100644
--- a/src/utils.php
+++ b/src/utils.php
@@ -645,3 +645,38 @@ function ensure_dir( $dir ) {
return realpath( $dir );
}
+
+/**
+ * Removes trailing directory separators.
+ *
+ * @param string $path The directory path.
+ *
+ * @return string
+ */
+function untrailingslashit( $path ) {
+ return rtrim( $path, DIRECTORY_SEPARATOR );
+}
+
+/**
+ * Appends a directory separator.
+ *
+ * @param string $path The directory path.
+ *
+ * @return string
+ */
+function trailingslashit( $path ) {
+ return untrailingslashit( $path ) . DIRECTORY_SEPARATOR;
+}
+
+/**
+ * Remove any double directory separators.
+ *
+ * @example /my-project//tests > /my-project/tests
+ *
+ * @param string $path The directory path.
+ *
+ * @return string
+ */
+function remove_double_separators( $path ) {
+ return str_replace( sprintf( '%s%s', DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR ), DIRECTORY_SEPARATOR, $path );
+}