-
Hi, I'm trying to install the ip2location plugin properly.
I've downloaded the ip2location .BIN file database from here https://lite.ip2location.com/database-download, then uploaded it manually to the /misc folder as instructed.
IP2Location BIN Database Please upload your IP2Location BIN database to matomo/misc folder
But I still got the error message There is no IP2Location database file found in /app/code/misc.
When I go in Cloudron file manager for the Matomo app, there's a /misc folder that contains the .BIN file.
When I look into Cloudron terminal for the Matomo app, go to the /app/code/misc folder, the folder is empty.Is that a misconfiguration from the Cloudron Matomo docker image?
Any help would be appreciated.
Thank you!
-
Could be.
Does the Matomo app state missing files in/app/code/misc
?
Since normally all data is stored in/app/data/
. Is there a/app/data/misc/
? -
@BrutalBirdie there's is a /app/data/misc and the .BIN file I've uploaded with the file manager is here.
So, what are our options? Should we consider changing the path for the ip2location plugin to look for the .BIN files differently? What do you think?
If you look at how it's configured, you see it's looking into the PIWIK_DOCUMENT_ROOT path.
if ($lookupMode == 'BIN') {
if (!$file) {
$errors[] = 'There is no IP2Location database file found in ' . PIWIK_DOCUMENT_ROOT . \DIRECTORY_SEPARATOR . 'misc.';But I guess PIWIK_DOCUMENT_ROOT is /app/data and not /app/code
Right?
-
-
I've looked at the file /plugins/IP2Location/API.php that does the request. It's not calculated, so where it is?
public static function getDatabaseFile() { $files = scandir(PIWIK_DOCUMENT_ROOT . '/misc'); foreach ($files as $file) { if (preg_match('/^(IP(V6)?-COUNTRY.+|IP2LOCATION-LITE-DB[0-9]+(\.IPV6)?)\.BIN$/', $file)) { Option::set('IP2Location.BIN', $file); return $file; } } foreach ($files as $file) { if (strtoupper(substr($file, -4)) == '.BIN') { Option::set('IP2Location.BIN', $file); return $file; } } return null; } public static function getDatabaseDate($file) { if (!is_file(PIWIK_DOCUMENT_ROOT . '/misc/' . $file)) { return; } require_once PIWIK_INCLUDE_PATH . '/plugins/IP2Location/lib/IP2Location.php'; $db = new \IP2Location\Database(PIWIK_DOCUMENT_ROOT . '/misc/' . $file, \IP2Location\Database::FILE_IO); return $db->getDate(); } public static function getDatabaseSize($file) { if (!file_exists(PIWIK_DOCUMENT_ROOT . '/misc/' . $file)) { return 0; } return self::displayBytes(filesize(PIWIK_DOCUMENT_ROOT . '/misc/' . $file)); }
-
-
So I looked into an app instance and given the code link I posted, the variable will be
/app/code
and then the plugin would end up with/app/code/misc
.
This folder is read-only on Cloudron, so you won't be able to place the file there. We have to check if we can symlink thatmisc
folder also, but not sure how the implications on the updates are. -
@jfrere I opened an issue upstream - https://github.com/ip2location/ip2location-piwik/issues/91
-
@jfrere this got recently fixed - https://github.com/ip2location/ip2location-piwik/issues/91#event-11698953657
-