Skip to content

Commit

Permalink
Don't let lower admin level locations be installed twice (#2603)
Browse files Browse the repository at this point in the history
  • Loading branch information
corsacca authored Dec 12, 2024
1 parent fe436c4 commit 38300b7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dt-mapping/mapping-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,10 @@ public function box_polygons_select_mirror() {
}

public function box_levels() {
global $wpdb;
$location_grid_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->dt_location_grid" );
$disabled = $location_grid_count > 386000;

?>
<!-- Box -->
<table class="widefat striped">
Expand All @@ -1191,8 +1195,12 @@ public function box_levels() {
(levels 3, 4, 5). Installing administrative levels will increase the database from 50k records to 380k records
</p>
<hr>
<?php if ( $disabled ) : ?>
<p><strong>All lower levels are already installed</strong></p>
<?php else : ?>
<p><a class="button" id="upgrade_button" href="<?php echo esc_url( trailingslashit( admin_url() ) ) ?>admin.php?page=<?php echo esc_attr( $this->token ) ?>&tab=levels&loop=true" disabled="true">Upgrade Away!</a></p>
<p id="show_message">LEAVE THIS PAGE OPEN UNTIL YOU SEE "FINISHED"</p>
<?php endif; ?>
</th>
</tr>
</thead>
Expand Down

0 comments on commit 38300b7

Please sign in to comment.