Closed pjhinton closed 11 years ago
This patch is incompatible with our current 1.18 version. The code should probably check for MW version first, and then call getPath() for 1.18- or getLocalRefPath() for 1.19+ I'm now in progress of updating mediawiki4intranet to 1.21, so thanks for your help :)
Would you prefer an explicit version check or would it suffice to test for the existence of the newer method (getLocalRefPath())? I'll code it to your preferred convention.
P.J. Hinton pjhinton@aim.com
-----Original Message----- From: Vitaliy Filippov notifications@github.com To: mediawiki4intranet/TikaMW TikaMW@noreply.github.com Cc: pjhinton pjhinton@aim.com Sent: Fri, Sep 13, 2013 12:06 pm Subject: Re: [TikaMW] make TikaMW file access compatible with MediaWiki 1.21 (#1)
This patch is incompatible with our current 1.18 version. The code should probably check for MW version first, and then call getPath() for 1.18- or getLocalRefPath() for 1.19+ I'm now in progress of updating mediawiki4intranet to 1.21, so thanks for your help :) — Reply to this email directly or view it on GitHub.
Both ways are OK, one thing is that I would prefer the check being done once with the corresponding method name saved in a, for example, static variable inside function :)
A new commit has been added to the pull request. Let me know if this is what you had in mind.
P.J. Hinton pjhinton@aim.com
-----Original Message----- From: Vitaliy Filippov notifications@github.com To: mediawiki4intranet/TikaMW TikaMW@noreply.github.com Cc: pjhinton pjhinton@aim.com Sent: Fri, Sep 13, 2013 12:21 pm Subject: Re: [TikaMW] make TikaMW file access compatible with MediaWiki 1.21 (#1)
Both ways are OK, one thing is that I would prefer the check being done once with the corresponding method name saved in a, for example, static variable inside function :) — Reply to this email directly or view it on GitHub.
Yes, thank you, I've just merged it.
You're quite welcome!
P.J. Hinton pjhinton@aim.com
-----Original Message----- From: Vitaliy Filippov notifications@github.com To: mediawiki4intranet/TikaMW TikaMW@noreply.github.com Cc: pjhinton pjhinton@aim.com Sent: Mon, Sep 16, 2013 9:16 am Subject: Re: [TikaMW] make TikaMW file access compatible with MediaWiki 1.21 (#1)
Yes, thank you, I've just merged it. — Reply to this email directly or view it on GitHub.
MediaWiki changed their API for getting stored files. As of 5275f9b097cdae5dbab0845e3ea127086e3a6570 on mediawiki/core, File::getPath() no longer returns a path on the physical file system. Instead, it uses mwstore:// paths, which when passed to PHP functions like file_exists() and file_get_contents(), causes warnings. The fix is to use File::exists() and File::getLocalRefPath() instead. The rationale can be verified by examining this diff:
https://git.wikimedia.org/commitdiff/mediawiki%2Fcore/5275f9b097cdae5dbab0845e3ea127086e3a6570
wherein one can see the old API calls getting replaced with the new API.