aboutsummaryrefslogtreecommitdiff
path: root/mediawiki.lrdevplugin
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2014-09-02 15:31:21 +0200
committerRobin Krahl <me@robin-krahl.de>2014-09-02 15:31:21 +0200
commita1ff27606ca1afb86230b0b76d35fa82c08efb06 (patch)
treea5680da768b3ad54420cc3afabbcc10d2de48500 /mediawiki.lrdevplugin
parentc16d9e5e02e7cbb4f3229ef855b7b2f2fc1da6b1 (diff)
downloadLrMediaWiki-a1ff27606ca1afb86230b0b76d35fa82c08efb06.tar.gz
LrMediaWiki-a1ff27606ca1afb86230b0b76d35fa82c08efb06.tar.bz2
Fix #13: Add LrMediaWiki version to upload comments.
Diffstat (limited to 'mediawiki.lrdevplugin')
-rwxr-xr-xmediawiki.lrdevplugin/MediaWikiInterface.lua6
-rw-r--r--mediawiki.lrdevplugin/MediaWikiUtils.lua12
2 files changed, 14 insertions, 4 deletions
diff --git a/mediawiki.lrdevplugin/MediaWikiInterface.lua b/mediawiki.lrdevplugin/MediaWikiInterface.lua
index 715243c..8d79974 100755
--- a/mediawiki.lrdevplugin/MediaWikiInterface.lua
+++ b/mediawiki.lrdevplugin/MediaWikiInterface.lua
@@ -95,7 +95,7 @@ MediaWikiInterface.uploadFile = function(filePath, description, fileName)
if not MediaWikiInterface.loggedIn then
LrErrors.throwUserError(LOC '$$$/LrMediaWiki/Interface/Internal/NotLoggedIn=Internal error: not logged in before upload.')
end
- local comment = 'Uploaded with LrMediaWiki'
+ local comment = 'Uploaded with LrMediaWiki ' .. MediaWikiUtils.getVersionString()
local targetFileName = fileName or LrPathUtils.leafName(filePath)
local ignorewarnings = false
if MediaWikiApi.existsFile(targetFileName) then
@@ -103,7 +103,7 @@ MediaWikiInterface.uploadFile = function(filePath, description, fileName)
if continue == 'ok' then
local newComment = MediaWikiInterface.prompt(LOC '$$$/LrMediaWiki/Interface/VersionComment=Version comment', LOC '$$$/LrMediaWiki/Interface/VersionComment=Version comment')
if not MediaWikiUtils.isStringEmpty(newComment) then
- comment = newComment .. ' (LrMediaWiki)'
+ comment = newComment .. ' (LrMediaWiki ' .. MediaWikiUtils.getVersionString() .. ')'
end
ignorewarnings = true
elseif continue == 'other' then
@@ -137,4 +137,4 @@ MediaWikiInterface.buildFileDescription = function(description, source, timestam
return string.format(MediaWikiInterface.fileDescriptionPattern, description, source, timestamp, author, other, templates, license, categoriesString)
end
-return MediaWikiInterface \ No newline at end of file
+return MediaWikiInterface
diff --git a/mediawiki.lrdevplugin/MediaWikiUtils.lua b/mediawiki.lrdevplugin/MediaWikiUtils.lua
index 6093b8a..00dd46d 100644
--- a/mediawiki.lrdevplugin/MediaWikiUtils.lua
+++ b/mediawiki.lrdevplugin/MediaWikiUtils.lua
@@ -13,10 +13,20 @@
-- doc: missing
-- i18n: complete
+local Info = require 'Info'
+
local MediaWikiUtils = {}
MediaWikiUtils.isStringEmpty = function(str)
return str == nil or string.match(str, '^%s*$') ~= nil
end
-return MediaWikiUtils \ No newline at end of file
+MediaWikiUtils.getVersionString = function()
+ local str = Info.VERSION.major .. '.' .. Info.VERSION.minor
+ if Info.VERSION.revision > 0 then
+ str = str .. '.' .. Info.VERSION.revision
+ end
+ return str
+end
+
+return MediaWikiUtils