Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2022-02-16 02:45:52 +0300
committerGitHub <noreply@github.com>2022-02-16 02:45:52 +0300
commitbf92c8baa9534556d3062c86fad48ae75c81d65d (patch)
tree1551bc6f6ce998148ed5a18165cb18bc835eb80b
parent0753cb03397f52eeb74d03ade2cd9e68893fe684 (diff)
Check folder & permission before downloading a GeoIP database (#18799)
-rw-r--r--plugins/GeoIp2/GeoIP2AutoUpdater.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/GeoIp2/GeoIP2AutoUpdater.php b/plugins/GeoIp2/GeoIP2AutoUpdater.php
index 29bcafd975..2028e9cb83 100644
--- a/plugins/GeoIp2/GeoIP2AutoUpdater.php
+++ b/plugins/GeoIp2/GeoIP2AutoUpdater.php
@@ -14,6 +14,7 @@ use Piwik\Common;
use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\Date;
+use Piwik\Filesystem;
use Piwik\Http;
use Piwik\Log;
use Piwik\Option;
@@ -195,7 +196,14 @@ class GeoIP2AutoUpdater extends Task
public static function getTemporaryFolder($file, $isDownload = false)
{
- return \Piwik\Container\StaticContainer::get('path.tmp') . '/latest/' . $file . ($isDownload ? '.download' : '');
+ $folder = \Piwik\Container\StaticContainer::get('path.tmp') . '/latest/';
+ if (!is_dir($folder)) {
+ Filesystem::mkdir($folder);
+ }
+ if (!is_writable($folder)) {
+ throw new \Exception("GeoIP2AutoUpdater: Can't create temporary file for download.");
+ }
+ return $folder . $file . ($isDownload ? '.download' : '');
}
/**