Skip to content

Commit 5c63df1

Browse files
Copilotswissspidy
andcommitted
Remove unused $export_db tempnam() variable in sqlite_export()
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 1910138 commit 5c63df1

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

src/DB_Command_SQLite.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -288,22 +288,14 @@ protected function sqlite_export( $file, $assoc_args ) {
288288
if ( ! $this->is_sqlite3_available() ) {
289289
WP_CLI::error( 'The sqlite3 binary could not be found. Please install sqlite3 to use the export command.' );
290290
}
291-
$temp_db = tempnam( sys_get_temp_dir(), 'temp.db' );
291+
$temp_db = tempnam( sys_get_temp_dir(), 'temp.db' );
292292
if ( false === $temp_db ) {
293293
WP_CLI::error( 'Could not create temporary database file for export.' );
294294
}
295295

296-
$export_db = tempnam( sys_get_temp_dir(), 'export.db' );
297-
if ( false === $export_db ) {
298-
// Clean up any previously created temporary database file.
299-
@unlink( $temp_db );
300-
WP_CLI::error( 'Could not create temporary export file.' );
301-
}
302-
303296
if ( ! @copy( $db_path, $temp_db ) ) {
304-
// Clean up temporary files if the copy operation fails.
297+
// Clean up temporary file if the copy operation fails.
305298
@unlink( $temp_db );
306-
@unlink( $export_db );
307299
WP_CLI::error( 'Could not copy database to temporary file for export.' );
308300
}
309301

0 commit comments

Comments
 (0)