Page MenuHomePhabricator

TimedMediaHandler does not support PostgreSQL
Open, LowestPublic


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


#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:

PHP7.0.13 (apache2handler)
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

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

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

Original contributor is not responding. abandoning for now.

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,