Re: [Wikitech-l] Storing some values in the DB

2020-01-27 Thread Thiemo Kreuz
Again. What exactly are you trying to store? How often is it suspected
to change? Who will be allowed to change it? Why not make it
configuration via LocalSettings.php? What is the problem with an extra
table?

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Storing some values in the DB

2020-01-27 Thread Jeroen De Dauw
Hey,

> Why are you so reluctant to create a table?

It complicates extension installation and adds yet another thing to
maintain. Which is a bit silly for a handful of values. I was hoping
MediaWiki would have a generic table to put such things already. Page_props
is exactly that, just bound to specific pages.

Cheers

--
Jeroen De Dauw | www.EntropyWins.wtf 
Professional wiki hosting and services: www.Professional.Wiki

Software Crafter | Speaker | Entrepreneur | Open Source and Wikimedia
contributor ~=[,,_,,]:3
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Storing some values in the DB

2020-01-27 Thread Thiemo Kreuz
Jeroen, can you please provide more context? What exactly are you
trying to store? Why? How often? When will it be changed? By whom?

As of now the rather vague explanation provided make it sound like
it's a configuration flag, and should go into LocalSettings.php as a
$wgYourExtensionYourConfig = 23; variable.

https://www.mediawiki.org/wiki/Manual:Database_layout provides an
overview of the database tables that come with MediaWiki.

You are free to create a new table any time you want. Even if it's
only going to store 3 rows, that should be fine. I'm not aware of a
reason to not do this. Wikibase, for example, contains a table
wb_id_counters that is not meant to store new rows, but only a
strictly limited set of rows. You can copy the update mechanism
related to that table, if you like.

Kind regards
Thiemo

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Storing some values in the DB

2020-01-27 Thread Jeroen De Dauw
Hey Kosta,

The values in my extension are not user specific. It is really just a
handful of values for the entire wiki.

One approach I'm considering is to abuse the page props table and have the
values "linked to page" with ID 1 billion (or -1) or so. I'm not sure how
safe that is though. The data would only be stored in the database, so not
losing it due to the running of some maintenance process is important.

Cheers

--
Jeroen De Dauw | www.EntropyWins.wtf 
Professional wiki hosting and services: www.Professional.Wiki

Software Crafter | Speaker | Entrepreneur | Open Source and Wikimedia
contributor ~=[,,_,,]:3


On Mon, 27 Jan 2020 at 12:30, Kosta Harlan  wrote:

> Hi,
>
> On 1/27/20 12:13 PM, Jeroen De Dauw wrote:
> > Hey,
> >
> > I have a MediaWiki extension in which I'd like to store a handful of
> > values. Example:
> >
> > * Cats 42
> > * Ravens 23
> > * Goats 0
> >
> > The most obvious thing to do would be to add a new database table with a
> > string and an integer column. However I'd like to avoid the need to run
> > update.php to install this extension. Is there some place in the
> MediaWiki
> > DB schema where I can put a few values like these? They could even be in
> a
> > single serialized blob (though preferably can be looked up by string
> key).
>
> You want to store these values per-user, I'm assuming? This is probably
> of interest then: https://phabricator.wikimedia.org/T128602
>
> In GrowthExperiments extension we store small bits of data like that as
> serialized blobs in hidden user preferences, but this isn't great, among
> other reasons because the values are delivered on on each page load
> whether you want them or not.
>
> Kosta
>
> >
> > Cheers
> >
> > --
> > Jeroen De Dauw | www.EntropyWins.wtf 
> > Professional wiki hosting and services: www.Professional.Wiki
> > 
> > Software Crafter | Speaker | Entrepreneur | Open Source and Wikimedia
> > contributor ~=[,,_,,]:3
> > ___
> > Wikitech-l mailing list
> > Wikitech-l@lists.wikimedia.org
> > https://lists.wikimedia.org/mailman/listinfo/wikitech-l
> >
>
> ___
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Storing some values in the DB

2020-01-27 Thread Kosta Harlan

Hi,

On 1/27/20 12:13 PM, Jeroen De Dauw wrote:

Hey,

I have a MediaWiki extension in which I'd like to store a handful of
values. Example:

* Cats 42
* Ravens 23
* Goats 0

The most obvious thing to do would be to add a new database table with a
string and an integer column. However I'd like to avoid the need to run
update.php to install this extension. Is there some place in the MediaWiki
DB schema where I can put a few values like these? They could even be in a
single serialized blob (though preferably can be looked up by string key).


You want to store these values per-user, I'm assuming? This is probably 
of interest then: https://phabricator.wikimedia.org/T128602


In GrowthExperiments extension we store small bits of data like that as 
serialized blobs in hidden user preferences, but this isn't great, among 
other reasons because the values are delivered on on each page load 
whether you want them or not.


Kosta



Cheers

--
Jeroen De Dauw | www.EntropyWins.wtf 
Professional wiki hosting and services: www.Professional.Wiki

Software Crafter | Speaker | Entrepreneur | Open Source and Wikimedia
contributor ~=[,,_,,]:3
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l



___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] Storing some values in the DB

2020-01-27 Thread Jeroen De Dauw
Hey,

I have a MediaWiki extension in which I'd like to store a handful of
values. Example:

* Cats 42
* Ravens 23
* Goats 0

The most obvious thing to do would be to add a new database table with a
string and an integer column. However I'd like to avoid the need to run
update.php to install this extension. Is there some place in the MediaWiki
DB schema where I can put a few values like these? They could even be in a
single serialized blob (though preferably can be looked up by string key).

Cheers

--
Jeroen De Dauw | www.EntropyWins.wtf 
Professional wiki hosting and services: www.Professional.Wiki

Software Crafter | Speaker | Entrepreneur | Open Source and Wikimedia
contributor ~=[,,_,,]:3
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l