Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Cloudron Forum

Apps | Demo | Docs | Install

Matomo iP2location issue

Scheduled Pinned Locked Moved Unsolved Matomo
8 Posts 4 Posters 49 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jfrereJ Offline
    jfrereJ Offline
    jfrere
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
  • BrutalBirdieB Offline
    BrutalBirdieB Offline
    BrutalBirdie Staff
    wrote on last edited by
    #2

    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/?

    Like my work? Consider donating a drink. Cheers!

    1 Reply Last reply
    0
  • jfrereJ Offline
    jfrereJ Offline
    jfrere
    wrote on last edited by jfrere
    #3

    @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?

    1 Reply Last reply
    0
  • BrutalBirdieB Offline
    BrutalBirdieB Offline
    BrutalBirdie Staff
    wrote on last edited by
    #4

    Hmmmm I am not fully in the picture about the app packaging of matomo so I'll redirect this to @staff

    Like my work? Consider donating a drink. Cheers!

    1 Reply Last reply
    1
  • nebulonN Offline
    nebulonN Offline
    nebulon Staff
    wrote on last edited by
    #5

    The curent packaging does not set PIWIK_DOCUMENT_ROOT at all itself. So its apparently calculated as https://github.com/matomo-org/matomo/blob/5.x-dev/console#L7
    Does that help in figuring out where the plugin then looks for the misc folder?

    1 Reply Last reply
    0
  • nebulonN nebulon marked this topic as a question on
  • jfrereJ Offline
    jfrereJ Offline
    jfrere
    wrote on last edited by
    #6

    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));
    }
    
    1 Reply Last reply
    0
  • girishG girish moved this topic from Support on
  • nebulonN Offline
    nebulonN Offline
    nebulon Staff
    wrote on last edited by
    #7

    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 that misc folder also, but not sure how the implications on the updates are.

    1 Reply Last reply
    1
  • girishG Offline
    girishG Offline
    girish Staff
    wrote on last edited by
    #8

    @jfrere I opened an issue upstream - https://github.com/ip2location/ip2location-piwik/issues/91

    1 Reply Last reply
    1

  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks