Modul:Authority control: Versiyalar orasidagi farq
Programmer (munozara | hissa) Oʻzbekcha Vikipediyadan import qilindi. |
mw.wikibase stub: Ziyosferada Wikibase klienti yoʻq (Lua xatosini oldini olish) |
||
| (Bitta oraliq tahrir tomonidan boshqa bir foydalanuvchi koʻrsatilmagan) | |||
| Qator 1: | Qator 1: | ||
-- [zs-wikibase-guard] Ziyosfera has no Wikibase client; stub mw.wikibase so | |||
-- modules reading Wikidata degrade to nil instead of erroring. Auto-added on import. | |||
if not mw.wikibase then mw.wikibase = setmetatable({}, { __index = function() return function() return nil end end }) end | |||
require('strict') | require('strict') | ||
| Qator 743: | Qator 746: | ||
function p.getIdsFromWikidata( itemId, property ) | function p.getIdsFromWikidata( itemId, property ) | ||
local ids = {} | local ids = {} | ||
-- ZiyoSfera'da Wikibase Client o'rnatilmagan bo'lishi mumkin. | |||
-- Bunday holatda mw.wikibase nil bo'ladi; xato bermasdan bo'sh natija qaytaramiz. | |||
if not mw.wikibase or type( mw.wikibase.getBestStatements ) ~= 'function' then | |||
return ids | |||
end | |||
local statements = mw.wikibase.getBestStatements( itemId, property ) | local statements = mw.wikibase.getBestStatements( itemId, property ) | ||
if statements then | if statements then | ||
| Qator 755: | Qator 765: | ||
function p.matchesWikidataRequirements( itemId, reqs ) | function p.matchesWikidataRequirements( itemId, reqs ) | ||
-- Wikibase mavjud bo'lmasa Wikidata talablarini tekshirib bo'lmaydi. | |||
if not mw.wikibase or type( mw.wikibase.getBestStatements ) ~= 'function' then | |||
return false | |||
end | |||
for _, group in ipairs( reqs ) do | for _, group in ipairs( reqs ) do | ||
local property = 'P'..group[1] | local property = 'P'..group[1] | ||
| Qator 975: | Qator 990: | ||
end | end | ||
else | else | ||
itemId = mw.wikibase.getEntityIdForCurrentPage() | -- ZiyoSfera Wikibase Client ishlatmasa mw.wikibase mavjud bo'lmaydi. | ||
-- Shunda Wikidata fallback o'chadi, lekin qo'lda berilgan identifikatorlar ishlashda davom etadi. | |||
if mw.wikibase and type( mw.wikibase.getEntityIdForCurrentPage ) == 'function' then | |||
itemId = mw.wikibase.getEntityIdForCurrentPage() | |||
end | |||
end | end | ||