Skip to content

Commit

Permalink
fix directory name bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nimrod-cohen committed Dec 10, 2024
1 parent bb0e505 commit a7fe1d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fv-country-blocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand Down
7 changes: 3 additions & 4 deletions includes/github-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.';
Expand All @@ -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);
}
Expand All @@ -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";
}

/**
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a7fe1d5

Please sign in to comment.