wmde / wikibase-release-pipeline

BSD 3-Clause "New" or "Revised" License
46 stars 32 forks source link

Quickstatements database #572

Closed jmformenti closed 4 months ago

jmformenti commented 6 months ago

It seems that Quickstatements needs a database for some features related with batches, for example, get a new token. I'm getting this error:

<br />
<b>Warning</b>:  parse_ini_file(/data/project/root/replica.my.cnf): Failed to open stream: No such file or directory in <b>/var/www/html/magnustools/public_html/php/ToolforgeCommon.php</b> on line <b>161</b><br />
<br />
<b>Fatal error</b>:  Uncaught Error: Class &quot;mysqli&quot; not found in /var/www/html/magnustools/public_html/php/ToolforgeCommon.php:178
Stack trace:
#0 /var/www/html/magnustools/public_html/php/common.php(35): ToolforgeCommon-&gt;openDBtool('__quickstatemen...', 'tools.labsdb', '')
#1 /var/www/html/quickstatements/public_html/quickstatements.php(201): openToolDB('quickstatements...')
#2 /var/www/html/quickstatements/public_html/quickstatements.php(396): QuickStatements-&gt;getDB()
#3 /var/www/html/quickstatements/public_html/api.php(135): QuickStatements-&gt;generateToken('Jmformenti', 1)
#4 {main}
  thrown in <b>/var/www/html/magnustools/public_html/php/ToolforgeCommon.php</b> on line <b>178</b><br />

Is there a way to support a database configuration in the current Quickstatements docker image? If not, is there any place that provides information on how to configure it (even if manually)?

GreenReaper commented 5 months ago

As it suggests there is a line openToolDB ( 'quickstatements_p' ) in the original repo which is presumably designed to open a MySQL / MariaDB database. It looks like php-mysqli would need to be installed and additional configuration done to actually hook it up to a database but all of that setup is not documented and shared with other of Wikidata's Magnus tools.

This has been looked into in T234827 although not resolved, perhaps it has something you can use.

jmformenti commented 4 months ago

Thanks @GreenReaper. After reviewing various scattered pieces of information and debugging, I figured out how to add it.

For reference, in this commit, I've added all the necessary changes: https://github.com/jmformenti/wikibase-release-pipeline/commit/5d9a4370adcca0bf99ea130f65b65c86567067f9

Now, I'm able to run batches from both the UI and command line :thumbsup:.