TimedMediaHandler does not support PostgreSQL
Closed, ResolvedPublic

Description

I tried to install TimeMediaHandler on our internal wiki, but it failed for several reasons:

TimedMediaHandler.sql is MySQL only. No Problem, I rewrote it to conform to PostgreSQL:

CREATE TABLE /*_*/transcode (
	transcode_id SERIAL NOT NULL,
	transcode_image_name VARCHAR(255) NOT NULL,
	transcode_key VARCHAR(48) NOT NULL,
	transcode_error longtext NOT NULL,
	transcode_time_addjob VARCHAR(14) NULL,
	transcode_time_startwork VARCHAR(14) NULL,
	transcode_time_success VARCHAR(14) NULL,
	transcode_time_error VARCHAR(14) NULL,
	transcode_final_bitrate INT NOT NULL
) /*$wgDBTableOptions*/;

CREATE INDEX /*i*/transcode_time_inx ON /*_*/transcode( transcode_time_addjob ,transcode_time_startwork , transcode_time_success, transcode_time_error );
CREATE INDEX /*i*/transcode_key_idx ON /*_*/transcode( transcode_key );

CREATE UNIQUE INDEX /*i*/transcode_name_key ON /*_*/transcode (transcode_image_name,transcode_key);

Now if I try to upload a file I get this exception:

[02a6c44e6268ccd9ea6e7af1] /index.php/Spezial:Hochladen Error from line 1091 of /var/www/html/includes/specials/SpecialUpload.php: Call to a member function getUrl() on boolean

Backtrace:

#0 /var/www/html/includes/specials/SpecialUpload.php(893): UploadForm->getDescriptionSection()
#1 /var/www/html/includes/specials/SpecialUpload.php(267): UploadForm->__construct(array, DerivativeContext, MediaWiki\Linker\LinkRenderer)
#2 /var/www/html/includes/specials/SpecialUpload.php(446): SpecialUpload->getUploadForm(string, string, boolean)
#3 /var/www/html/includes/specials/SpecialUpload.php(519): SpecialUpload->showUploadWarning(array)
#4 /var/www/html/includes/specials/SpecialUpload.php(209): SpecialUpload->processUpload()
#5 /var/www/html/includes/specialpage/SpecialPage.php(522): SpecialUpload->execute(NULL)
#6 /var/www/html/includes/specialpage/SpecialPageFactory.php(576): SpecialPage->run(NULL)
#7 /var/www/html/includes/MediaWiki.php(283): SpecialPageFactory::executePath(Title, RequestContext)
#8 /var/www/html/includes/MediaWiki.php(851): MediaWiki->performRequest()
#9 /var/www/html/includes/MediaWiki.php(512): MediaWiki->main()
#10 /var/www/html/index.php(43): MediaWiki->run()
#11 {main}

The used software versions:

SoftareVersion
MediaWiki1.28.0
PHP7.0.13 (apache2handler)
PostgreSQL9.6.1
TimedMediaHandler0.5.0 (64461e9) 21:18, 25. Okt. 2016
MwEmbedSupport0.3.0 (2e24ff4) 00:03, 25. Okt. 2016

Event Timeline

Your problem with the uploads is T155771: Upload fails if preview cannot be generated, caused by the previews to fail.

The file move seems like a core problem, and not TMH specific (could you test that ?)

if you want, I can add that postgres to the extension. How would you like to be credited for that (name/email) ?

Change 343833 had a related patch set uploaded (by TheDJ):
[mediawiki/extensions/TimedMediaHandler] Add support for postgres to TMH

https://gerrit.wikimedia.org/r/343833

Added the patch set, can update credit on the patch upon request.

Change 343833 abandoned by TheDJ:
Add support for postgres to TMH

Reason:
Original contributor is not responding. abandoning for now.

https://gerrit.wikimedia.org/r/343833

TheDJ changed the task status from Open to Stalled.Apr 14 2017, 11:34 AM
TheDJ triaged this task as Lowest priority.

This still requires more refinement, per brion's comment in the review. Stalling this until we have a postgres user on hand.

PostgreSQL user here, anything I could help with here? I have TMH installed and with the table/indexes added File pages seem to work so far.

@IijimaYun "ISTR the pgsql schema for MediaWiki wants to use a different timestamp format... core tables use TIMESTAMPTZ instead of VARCHAR(14)"

So it seems that the last status was that the type was incorrect. Working perhaps, but not correct. If anyone can rework the patch to take that into account, then that will be appreciated.

Apologies for the delay, I somehow missed the e-mail notification completely. The 14-character fields are definitely not working as the format of the timestamps being inserted is full YYYY-MM-DD HH:MM:SS+TZ; TIMESTAMPTZ seems to work fine.

Aklapper changed the task status from Stalled to Open.Jun 9 2020, 11:38 AM

Another PostgreSQL user here. I am keen to get TimedMediaHandler working with PostgreSQL. Is there anything I can do to help?

(I have not contributed to MediaWiki before, otherwise I would have contributed a patch already.)

For a quick fix with a local installation, simply ALTER the schema for transcode and use TIMESTAMPTZ.

transcode_time_addjob timestamp with time zone,
transcode_time_startwork timestamp with time zone,
transcode_time_success timestamp with time zone,
transcode_time_error timestamp with time zone,

For a quick fix with a local installation, simply ALTER the schema for transcode and use TIMESTAMPTZ.

transcode_time_addjob timestamp with time zone,
transcode_time_startwork timestamp with time zone,
transcode_time_success timestamp with time zone,
transcode_time_error timestamp with time zone,

There is now a db patch merged to the extension. If possible, please test with the current master or apply it manually: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/TimedMediaHandler/+/751797/2/sql/postgres/patch-transcode-transcode_timestamp.sql

If postgres now works without errors, this task could get resolved.

If postgres now works without errors, this task could get resolved.

Does anyone affected by this know? Thanks in advance.

I am planning an upgrade to 1.37.x (still on 1.36.x at the moment) within a few days and this will be a good way to test these changes; will report here on the outcome.

This problem is mentioned on https://www.mediawiki.org/wiki/Extension:TimedMediaHandler If confirmed fixed, we also need to update that page.

@Aklapper, my apologies, I completely forgot to comment on this. The updated extension requires 1.38 and does not work with 1.37.1.

Aklapper changed the task status from Open to Stalled.Jul 6 2022, 12:04 PM
Aklapper added a project: TestMe.

Setting stalled status as we need someone to test with 1.38

TheDJ claimed this task.

Im closing this as assumed fixed. Waiting 2+ years for testers seems long enough to me. Postgres users can open new tickets if they experience problems.