Code Duplication    Length = 14-14 lines in 2 locations

classes/PodsAPI.php 2 locations

@@ 4470-4483 (lines=14) @@
4467
        $params->id = $pod[ 'id' ];
4468
        $params->name = $pod[ 'name' ];
4469
4470
        if ( !pods_tableless() ) {
4471
            if ( 'table' == $pod[ 'storage' ] ) {
4472
                try {
4473
                    pods_query( "TRUNCATE `@wp_pods_{$params->name}`", false );
4474
                }
4475
                catch ( Exception $e ) {
4476
                    // Allow pod to be reset if the table doesn't exist
4477
                    if ( false === strpos( $e->getMessage(), 'Unknown table' ) )
4478
                        return pods_error( $e->getMessage(), $this );
4479
                }
4480
            }
4481
4482
            pods_query( "DELETE FROM `@wp_podsrel` WHERE `pod_id` = {$params->id} OR `related_pod_id` = {$params->id}", false );
4483
        }
4484
4485
        // @todo Delete relationships from tableless relationships
4486
@@ 4623-4636 (lines=14) @@
4620
        if ( $delete_all )
4621
            $this->reset_pod( $params, $pod );
4622
4623
        if ( !pods_tableless() ) {
4624
            if ( 'table' == $pod[ 'storage' ] ) {
4625
                try {
4626
                    pods_query( "DROP TABLE IF EXISTS `@wp_pods_{$params->name}`", false );
4627
                }
4628
                catch ( Exception $e ) {
4629
                    // Allow pod to be deleted if the table doesn't exist
4630
                    if ( false === strpos( $e->getMessage(), 'Unknown table' ) )
4631
                        return pods_error( $e->getMessage(), $this );
4632
                }
4633
            }
4634
4635
            pods_query( "DELETE FROM `@wp_podsrel` WHERE `pod_id` = {$params->id} OR `related_pod_id` = {$params->id}", false );
4636
        }
4637
4638
        // @todo Delete relationships from tableless relationships
4639