@@ -293,9 +293,9 @@ protected function sqlite_export( $file, $assoc_args ) {
293293 WP_CLI ::error ( 'Could not create temporary database file for export. ' );
294294 }
295295
296- if ( ! @ copy ( $ db_path , $ temp_db ) ) {
296+ if ( ! copy ( $ db_path , $ temp_db ) ) {
297297 // Clean up temporary file if the copy operation fails.
298- @ unlink ( $ temp_db );
298+ unlink ( $ temp_db );
299299 WP_CLI ::error ( 'Could not copy database to temporary file for export. ' );
300300 }
301301
@@ -425,10 +425,10 @@ protected function sqlite_import( $file, $assoc_args ) {
425425 // Ignore errors about unique constraints and existing indexes.
426426 $ contents = str_replace ( 'INSERT INTO ' , 'INSERT OR IGNORE INTO ' , $ contents );
427427 $ contents = preg_replace ( '/\bCREATE TABLE (?!IF NOT EXISTS\b)/i ' , 'CREATE TABLE IF NOT EXISTS ' , $ contents );
428- $ contents = preg_replace ( '/\bCREATE TRIGGER (?!IF NOT EXISTS\b)/i ' , 'CREATE TRIGGER IF NOT EXISTS ' , $ contents );
429- $ contents = preg_replace ( '/\bCREATE VIEW (?!IF NOT EXISTS\b)/i ' , 'CREATE VIEW IF NOT EXISTS ' , $ contents );
430- $ contents = preg_replace ( '/\bCREATE INDEX (?!IF NOT EXISTS\b)/i ' , 'CREATE INDEX IF NOT EXISTS ' , $ contents );
431- $ contents = preg_replace ( '/\bCREATE UNIQUE INDEX (?!IF NOT EXISTS\b)/i ' , 'CREATE UNIQUE INDEX IF NOT EXISTS ' , $ contents );
428+ $ contents = preg_replace ( '/\bCREATE TRIGGER (?!IF NOT EXISTS\b)/i ' , 'CREATE TRIGGER IF NOT EXISTS ' , ( string ) $ contents );
429+ $ contents = preg_replace ( '/\bCREATE VIEW (?!IF NOT EXISTS\b)/i ' , 'CREATE VIEW IF NOT EXISTS ' , ( string ) $ contents );
430+ $ contents = preg_replace ( '/\bCREATE INDEX (?!IF NOT EXISTS\b)/i ' , 'CREATE INDEX IF NOT EXISTS ' , ( string ) $ contents );
431+ $ contents = preg_replace ( '/\bCREATE UNIQUE INDEX (?!IF NOT EXISTS\b)/i ' , 'CREATE UNIQUE INDEX IF NOT EXISTS ' , ( string ) $ contents );
432432
433433 $ import_file = tempnam ( sys_get_temp_dir (), 'temp.db ' );
434434 file_put_contents ( $ import_file , $ contents );
0 commit comments