| @@ -162,15 +162,9 @@ | ||
| 162 | 162 | 'callback' => array($this, 'rest_replace'), |
| 163 | 163 | 'permission_callback' => array($this->core, 'can_access_settings') |
| 164 | 164 | )); |
| 165 | 165 | |
| 166 | - register_rest_route($this->namespace, '/snippets/delete_duplicates', array( | |
| 167 | - 'methods' => 'POST', | |
| 168 | - 'callback' => array($this, 'rest_delete_duplicates'), | |
| 169 | - 'permission_callback' => array($this->core, 'can_access_settings') | |
| 170 | - )); | |
| 171 | 166 | |
| 172 | - | |
| 173 | 167 | // SNIPPETS ENDPOINTS |
| 174 | 168 | $snippets = $this->snippet->select( |
| 175 | 169 | null, // offset |
| 176 | 170 | -1, // limit |
| @@ -808,17 +802,8 @@ | ||
| 808 | 802 | $result[] = $this->snippet->insert( $snippet ); |
| 809 | 803 | } |
| 810 | 804 | |
| 811 | 805 | return new WP_REST_Response([ 'success' => true, 'data' => $result ], 200); |
| 812 | - } catch (Exception $e) { | |
| 813 | - return new WP_REST_Response( ['success' => false, 'message' => $e->getMessage() ], 500 ); | |
| 814 | - } | |
| 815 | - } | |
| 816 | - | |
| 817 | - public function rest_delete_duplicates() { | |
| 818 | - try { | |
| 819 | - $result = $this->snippet->delete_duplicates(); | |
| 820 | - return new WP_REST_Response([ 'success' => true, 'data' => [ 'deleted' => $result ] ], 200); | |
| 821 | 806 | } catch (Exception $e) { |
| 822 | 807 | return new WP_REST_Response( ['success' => false, 'message' => $e->getMessage() ], 500 ); |
| 823 | 808 | } |
| 824 | 809 | } |