I don't know where to post my question so i do it here ;)
I currently develop a full integration of Piwik into TYPO3.
TYPO3 Supports table creation during installation. To use this feature, i need the table structere as create statement.
How does Piwik create them (they must be created during installation?!), perhaps you can point me to the correct lines of code ;), so that the plugin will work with the api.
Take a look at the GeoIP plugin's SQL queries.
in GeoIP.php there is a function that handles the updates during the plugin installation. -> cool but not what I meant.
What i mean, is a API-Call or something aquivalent where i can ask piwik core for the complete database scheme to write it in the typo3 extension files.
Create Table ... ...
I want to do that to avoid the installation process, because all the data is known, and piwik should be installed automatically.
The other way around would be to set an option in the config file, that the installer has to create all the table on first startup (db-accessinformation is set already).
getTablesCreateSql() in core/Piwik.php
Important note: vipsoft is right, this is where the core tables are created.
There is something that we could do, and maybe should consider as it would be extremely powerful: provide an API to install Piwik remotely. This is a bit unusual idea, but basically in the Installation plugin, we could provide API methods that other softwares (typo3, wordpress, etc.) could call to remotely setup Piwik entirely.
The installation has 8 steps and each (approximately) could be matched into an API call.
If we do this properly, this would open a new very interesting idea: Piwik could be a real "plugin" to any software out there, and during, for example, the typo3 plugin installation (that would bundle piwik in it), typo3 would have the power to completely install Piwik.
This is somewhat a subtask of: #161
I have been suggested a few times that a very interesting direction to take for Piwik could be to allow such functionnality, as Piwik is a tool that people use aside of other tools, and it would make sense to be able to completely install Piwik remotely; let me know if this is what you are looking for.
The Installation code currently sits in the Installation Controller: https://github.com/piwik/piwik/blob/master/plugins/Installation/Controller.php and the logic could, I think, pretty easily be moved to an API.
yep, that's what i'm currently building from outside piwik ;) using some of the piwik functions.
There should be one addtional option to install plugins remotly during the installprocess. (e.g. for SingleSignOn Plugins etc.).
Additionally it should be possible to run a function directly after the configuration is read (before database initialization) so that the database setting can be directly obtained from other projects settings, without writing it into the piwik configuration file. All this will make it very easy to integrate piwik into other projects. I think this will make piwik more popular. ;))
Kay, would you like to work on these core improvements for Piwik? we would love to have your help and you could use typo3 integration as the use case to drive the changes.
In piwik, we strive to make all these things available in APIs that you can http-request. - we could move logic from the Installation/Controller.php to Installation/API.php - we could add the hook that you request, ie. after init reading and before DB initialization
please have a look at piwik core, how other plugins are built, and let us know what you think - even better, a patch that we can review and help you with!
I would do it. I've thought quite a while about http installation. I think we do not need it really. I think it can be solved easily with the hook after loading the configuration, before connecting to the database.
At this point it should be possible to paste the required data into the configuration and connect to the database and create the required tables.
All user-mapping and syncing function can be done in a Auth-Plugin. -> I've done that already in TYPO3Login.
Please tell me your opinion.
//-Reminder for me- Solved getting the create SQL for Piwik Core. Opened getting the create SQL for Piwik extensions (only direct modification via install) -> perhaps it would be better to do it like TYPO3 with ext_tables.sql where only create table definitions are allowed, which are parsed and compared to existing pages, than modifications are executed.
if you think this can be done with hooks, we can do it this way it is more simple: please provide a patch with the new hooks and we will consider.
However for more modularity, and because doing it with hooks still requires to write a piwik plugin - which is not trivial - it would be better to have it via http. Softwares written in python/asp/etc. could also install it very easily.
yep thats right. typical, many pros and cons.
for single sign on i will need a plugin already (pro hook).
I think installation with a hook will be the common case for integration with php applications. I think http installation will not be used for commonly -> but interesting for hosters and companies.
I will send the patch after this weekend.
what do you think on the following way of implementation: 1. precreate the configfile whith [install] section in it 2. run piwik -> hook found install section and install flag in config.ini 3. check things that need to be done (filesystem, database, etc.) 4. install, remove install flag from install section 5. run piwik
We have implemented this plugin, please get in touch if you are interested.
Please see and follow up in this duplicate feature request: https://github.com/piwik/piwik/issues/10257