Page MenuHomePhabricator

TimedMediaHandler does not support PostgreSQL
Open, Stalled, LowestPublic

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

0xAFFF created this task.Feb 7 2017, 8:54 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 7 2017, 8:54 AM
TheDJ added a subscriber: TheDJ.Mar 20 2017, 12:06 PM

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

TheDJ added a comment.Mar 21 2017, 9:38 AM

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.

saper added a subscriber: saper.Jun 2 2017, 1:38 AM

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.

TheDJ added a comment.Jan 27 2018, 9:26 PM

@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.