Digitalist-Open-Cloud / Matomo-Plugin-ExtraTools

ExtraTools is a plugin for Matomo, which provides some console commands.
https://digitalist.cloud/
GNU General Public License v3.0
26 stars 12 forks source link

site:add allows duplicates #9

Closed chriscroome closed 1 year ago

chriscroome commented 5 years ago

You can add the same site multiple times, would it be within the scope of this plugin to check for duplicates?

I have looked at doing a duplicate check prior to adding sites to work around this but have found that the php console site:list command doesn't appear to return anything?

Would I best best off reverting to running MySQL queries against the Matomo database or using the API for now?

mikkeschiren commented 5 years ago

I will look into this.

chriscroome commented 5 years ago

Thanks for fixing site:list, I wonder if you would consider if it would be useful if it had the option to return more than just the values from the idsite and name columns in the site table?

If you are interested in adding more fields I don't know if this would be best with arguments, for example:

php console site:list --main_url --urls

Or it would be best to simply send the additional data, one thing I'd be interested in is the nature of the YAML output as I'm working with Ansible, perhaps a YAML dictionary output would be a possibility from php console --no-ansi -n --format=yaml site:list?

---
sites:
  1:
    name: foo
    main_url: http://foo.example.com
    urls:
      - http://www.foo.example.com
      - http://foo.example.org
      - http://www.foo.example.org
  2:
    name: bar
    main_url: http://bar.example.com
    urls:
      - http://www.bar.example.com
      - http://bar.example.org
      - http://www.bar.example.org
mikkeschiren commented 5 years ago

Yeah, the output needs work, and think that your suggested output for yaml is the how it should be - I possible work on that later today.