Automated database creation?

Hi, following the path of integrating piwik into anther control panel (i-mscp) I am getting stuck at this point when creating the database.
Basically I accomplished so far:
[ul]
[li] Crafted config.ini.php with user, password, db connections
[/li][li] Create specific user for this database
[/li][li] Grant the proper privileges for this user to the database
[/li][li] Create the database
[/li][/ul]

What I would like to know is what would the appropiate process to create the database enries required, since I am getting stuck in:

[quote=“Mysqli prepare error: Table ‘ispcp_piwik.piwik_option’ doesn’t exist”][/quote]

Could I automate the creation/upgrade of piwik databases when needed?

Some info about the piwik workflow:

There is this script which does some part of the job, but it only creates the database and grants the users, so it has no use for me:

Also, the headless install got pollute with typo3 configs, so don’t know how much work is left to be done:

Another thread about automation (without a solution): 301 Moved Permanently

It’s important not to create the config/config.ini.php file - at first the db details are stored in the session.
Could you look at the simplescripts/softaculous scripts for inspiration maybe?

I can’t see neither the source for simplescripts script neither scriptaculous without registering into their sites, and simplescripts requires me to set a hosting provider. Softaculous requires me to create an acount in control system I don’t have.
Could you point me to the source code of those scripts?

Sorry I don’t know if we can actually find the source codes, maybe they are private. But I know it’s possible to bypass the Installer. Maybe we need to patchPiwik to make it easier though?

[quote=matt]
Sorry I don’t know if we can actually find the source codes, maybe they are private. But I know it’s possible to bypass the Installer. Maybe we need to patchPiwik to make it easier though?[/quote]

That would be great, I don’t considerer myself as a programmer, so I don’t know how would be the best way to deal with it, what I would need (I think) would be to call:


Piwik::getTablesCreateSql();

That’s the code that seems to create/upgrade the databases when needed, I tried to create a script that would handle that, but I didn’t succed :frowning:
This is what I got so far.


<?php

define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__)=='/'?'':dirname(__FILE__));
define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);

//Required pear classes
//require "Event/Notification.php";

include('core/Piwik.php');
include('core/Db/Schema.php');
include('core/PluginsManager.php');
require('libs/Event/Dispatcher.php');
Piwik_Event_Notification:Piwik_AddAction
Piwik::getTablesCreateSql();
?>

Sorry I don’t have time to help with that advanced request unfortunately
but it’s interesting. If you need help please consider hiring pro services: http://piwik.org/consulting/

Finally worked out this part. It was my fault setting a wrong prefix on tables, after doing this, the login page just appeared.


-tables_prefix  = piwik_
+tables_prefix  = ""

Hello ;

I’m developer at IMSCP. What we want do exactly it’s to allow our customers to use your software instead of awstats for their statistics. I’ve looked a lot at your code and I must say that it’s really hard to dump any database update from it since many of them are generated on the fly according current database state. Well, I would recommend to propose a kind of CLI api for both install/update db tasks. For integration, we are using incremental process and so, it’s more easy for us to trigger a CLI command to either install or update Piwik database than ask our users to connect to piwik to do the needed job after i-MSCP install/update.

You are providing a great alternative to the awstats dinosaur and it’s always a pleasure for us to integrate such software.

Note: Sorry for my bad English, I’m french.

[attachment 906 Capturedu2012-10-2518:09:05.png]

Hello,

Thanks for your interest and integrating piwik in your software! :wink: Maybe we could improve the script, currently you can run the DB update from the CLI though, maybe that’s enough? see: Update Piwik - Analytics Platform - Matomo