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:
authordiosmosis <benaka@piwik.pro>2015-06-26 14:51:15 +0300
committerdiosmosis <benaka@piwik.pro>2015-06-26 14:51:15 +0300
commit2f9d72d4e78c362b05631df8df34dec9c594d087 (patch)
treeb0884b1dea95dc283d2d6e2bc01b2f069beff887 /tests/PHPUnit/Framework/Fixture.php
parenta6bc74c2bf20ed97cddc28da02ecdf872932e6ca (diff)
Make sure Fixture::downloadGeoipDatabases will copy the downloaded files to /misc.
Diffstat (limited to 'tests/PHPUnit/Framework/Fixture.php')
-rw-r--r--tests/PHPUnit/Framework/Fixture.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/PHPUnit/Framework/Fixture.php b/tests/PHPUnit/Framework/Fixture.php
index f25e6f4c2d..ee3a3f863f 100644
--- a/tests/PHPUnit/Framework/Fixture.php
+++ b/tests/PHPUnit/Framework/Fixture.php
@@ -744,11 +744,14 @@ class Fixture extends \PHPUnit_Framework_Assert
throw new Exception("The file $deflatedOut is empty. Suggestion: delete it and try again.");
}
+ self::copyDownloadedGeoIp($deflatedOut, $filename);
+
// Valid geoip db found
return;
}
- Log::warning("Geoip database $outfileName is not found. Downloading from $url...");
+ echo "Geoip database $outfileName is not found. Downloading from $url...\n";
+
$dump = fopen($url, 'rb');
$outfile = fopen($outfileName, 'wb');
if(!$outfile) {
@@ -769,6 +772,16 @@ class Fixture extends \PHPUnit_Framework_Assert
throw new Exception("gunzip failed($return): " . implode("\n", $output));
}
+
+ self::copyDownloadedGeoIp($deflatedOut, $filename);
+ }
+
+ private static function copyDownloadedGeoIp($deflatedOut, $filename)
+ {
+ $realFileOut = PIWIK_INCLUDE_PATH . '/' . LocationProvider\GeoIp::$geoIPDatabaseDir . '/' . $filename;
+ if (!file_exists($realFileOut)) {
+ copy($deflatedOut, $realFileOut);
+ }
}
public static function executeLogImporter($logFile, $options, $allowFailure = false)