+
+ private function backup( $fileName ) {
+ $this->output( "Backing up database:\n Locking..." );
+ $this->db->query( 'BEGIN IMMEDIATE TRANSACTION', __METHOD__ );
+ $ourFile = $this->db->mDatabaseFile;
+ $this->output( " Copying database file $ourFile to $fileName... " );
+ wfSuppressWarnings( false );
+ if ( !copy( $ourFile, $fileName ) ) {
+ $err = error_get_last();
+ $this->error( " {$err['message']}" );
+ }
+ wfSuppressWarnings( true );
+ $this->output( " Releasing lock...\n" );
+ $this->db->query( 'COMMIT TRANSACTION', __METHOD__ );
+ }
+
+ private function checkSyntax() {
+ if ( !Sqlite::IsPresent() ) {
+ $this->error( "Error: SQLite support not found\n" );
+ }
+ $files = array( $this->getOption( 'check-syntax' ) );
+ $files += $this->mArgs;
+ $result = Sqlite::checkSqlSyntax( $files );
+ if ( $result === true ) {
+ $this->output( "SQL syntax check: no errors detected.\n" );
+ } else {
+ $this->error( "Error: $result\n" );
+ }
+ }