diff --git a/lib/class.php b/lib/class.php index d9c06d9..1e40748 100644 --- a/lib/class.php +++ b/lib/class.php @@ -198,6 +198,8 @@ public function viewPackagePage(){ public function newRelease(){ global $wpdb; + $this->log('New release attempted.'); + $package = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}wup_packages WHERE `deployKey` = '{$_POST['deployKey']}'", 'ARRAY_A'); if(!isset($package)){ @@ -256,6 +258,17 @@ public function newRelease(){ $meta = WshWordPressPackageParser::parsePackage($_FILES['release']['tmp_name'], true); + $version = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}wup_versions WHERE `packageId` = '{$package['id']}' AND `version` = '{$meta['header']['Version']}' ORDER BY `id` DESC LIMIT 1", 'ARRAY_A'); + if(isset($version)){ + $this->log('Version ' . $meta['header']['Version'] . ' already exists'); + + echo(json_encode(array( + 'error' => 'Version ' . $meta['header']['Version'] . ' already exists' + ))); + + return; + } + move_uploaded_file( $_FILES['release']['tmp_name'], wp_upload_dir()['basedir'] . '/wup-releases/' . $package['slug'] . '/' . $meta['header']['Version'] . '.zip' diff --git a/lib/tables/domains.php b/lib/tables/domains.php index 4eda398..fa03636 100644 --- a/lib/tables/domains.php +++ b/lib/tables/domains.php @@ -96,7 +96,7 @@ public function prepare_items(){ //$this->process_bulk_action(); - $per_page = $this->get_items_per_page('packages_per_page', 5); + $per_page = $this->get_items_per_page('packages_per_page', 20); $current_page = $this->get_pagenum(); $total_items = self::record_count($this->packageId); diff --git a/lib/tables/packages.php b/lib/tables/packages.php index 8102d36..a3061c7 100644 --- a/lib/tables/packages.php +++ b/lib/tables/packages.php @@ -101,7 +101,7 @@ public function prepare_items() { //$this->process_bulk_action(); - $per_page = $this->get_items_per_page('packages_per_page', 5); + $per_page = $this->get_items_per_page('packages_per_page', 30); $current_page = $this->get_pagenum(); $total_items = self::record_count(); diff --git a/wp-update-provider.php b/wp-update-provider.php index bbff17d..8b3af5b 100644 --- a/wp-update-provider.php +++ b/wp-update-provider.php @@ -2,7 +2,7 @@ /** * Plugin Name: WP Update Provider * Description: Provides an update server for WordPress plugins & themes, and manages sites that are updating. -* Version: 0.1.4 +* Version: 0.1.5 * Author: Ed-IT Solutions * Author URI: http://www.ed-itsolutions.com * Image: https://raw.githubusercontent.com/Ed-ITSolutions/wp-update-provider/master/docs/logo.png