From a7fe1d5574fdedba6960b283274fe3a62dfe7494 Mon Sep 17 00:00:00 2001 From: nimrod-cohen Date: Tue, 10 Dec 2024 12:30:59 +0200 Subject: [PATCH] fix directory name bug --- fv-country-blocker.php | 2 +- includes/github-updater.php | 7 +++---- readme.md | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fv-country-blocker.php b/fv-country-blocker.php index ce2cc0c..f15eef1 100644 --- a/fv-country-blocker.php +++ b/fv-country-blocker.php @@ -3,7 +3,7 @@ * Plugin Name: FV Country Blocker * Plugin URI: https://github.com/nimrod-cohen/fv-country-blocker * Description: Block visitors from specific countries using MaxMind GeoIP database. - * Version: 1.2.1 + * Version: 1.2.2 * Author: nimrod-cohen * Author URI: https://github.com/nimrod-cohen/fv-country-blocker * License: GPL-2.0+ diff --git a/includes/github-updater.php b/includes/github-updater.php index 0a26de6..c11172f 100644 --- a/includes/github-updater.php +++ b/includes/github-updater.php @@ -23,7 +23,6 @@ class GitHubPluginUpdater { /** * This is the naming of the folder */ - const PLUGIN_DIR_NAME = 'github-updater-plugin'; private $plugin_slug; private $latest_release_cache_key; private $cache_allowed; @@ -235,7 +234,7 @@ public function process_zip_file($file_url) { unlink($tmp_file); $unzipped_dir = glob($destination . '/*', GLOB_ONLYDIR)[0]; - $new_name = $destination . '/' . GitHubPluginUpdater::PLUGIN_DIR_NAME; + $new_name = $destination . '/' . $this->plugin_slug; if (!rename($unzipped_dir, $new_name)) { return 'Error renaming the directory.'; @@ -247,7 +246,7 @@ public function process_zip_file($file_url) { if ($zip->open($new_zip_name, ZipArchive::CREATE) === true) { $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($new_name)); foreach ($iterator as $filename => $fileobject) { - $local_path = GitHubPluginUpdater::PLUGIN_DIR_NAME . "/" . substr($filename, strlen($new_name) + 1); + $local_path = $this->plugin_slug . "/" . substr($filename, strlen($new_name) + 1); if (!$fileobject->isDir()) { $zip->addFile($filename, $local_path); } @@ -268,7 +267,7 @@ public function process_zip_file($file_url) { private function get_tmp_name() { $uploads_dir = wp_upload_dir(); - return $uploads_dir['basedir'] . '/' . GitHubPluginUpdater::PLUGIN_DIR_NAME . ".zip"; + return $uploads_dir['basedir'] . '/' . $this->plugin_slug . ".zip"; } /** diff --git a/readme.md b/readme.md index 6311f3a..1d1e98c 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ Tags: country blocker, IP blocker, geo-blocking, security Requires at least: 5.0 Tested up to: 6.0 Requires PHP: 7.0 -Stable tag: 1.2.1 +Stable tag: 1.2.2 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html