Remove ApiQueryReferences support

This API was never used in Wikimedia production, and would have caused
performance problems.  Removing the dead code will simplify our refactoring.

Bug: T238195
Change-Id: I7088f257ec034c0d089e0abdaa5a739910598300
This commit is contained in:
Adam Wight 2019-11-21 09:53:10 +01:00 committed by Thiemo Kreuz
parent dbf4c56896
commit a176e22097
62 changed files with 2 additions and 1127 deletions

View file

@ -4,11 +4,3 @@ Cite
The Cite extension provides a way for users to create references as footnotes to articles.
See https://www.mediawiki.org/wiki/Extension:Cite for detailed documentation.
Configuration
-------------
* `$wgCiteStoreReferencesData`: If set to true, references are saved in the database so that
other extensions can retrieve them independently of the main article content.
* `$wgCiteCacheRawReferencesOnParse`: (`$wgCiteStoreReferencesData` required) By default,
references are cached only on database access. If set to true, references are also cached
whenever pages are parsed.

View file

@ -21,20 +21,12 @@
"MessagesDirs": {
"Cite": [
"i18n",
"i18n/api",
"modules/ve-cite/i18n"
]
},
"APIPropModules": {
"references": {
"class": "Cite\\Api\\ApiQueryReferences"
}
},
"Hooks": {
"APIQuerySiteInfoGeneralInfo": "Cite\\Hooks\\CiteHooks::onAPIQuerySiteInfoGeneralInfo",
"ContentHandlerDefaultModelFor": "Cite\\Hooks\\CiteHooks::onContentHandlerDefaultModelFor",
"LinksUpdate": "Cite\\Hooks\\CiteHooks::onLinksUpdate",
"LinksUpdateComplete": "Cite\\Hooks\\CiteHooks::onLinksUpdateComplete",
"ParserAfterParse": "Cite\\Hooks\\CiteParserHooks::onParserAfterParse",
"ParserBeforeTidy": "Cite\\Hooks\\CiteParserHooks::onParserBeforeTidy",
"ParserClearState": "Cite\\Hooks\\CiteParserHooks::onParserClearState",
@ -100,16 +92,6 @@
"public": true,
"value": false
},
"CiteStoreReferencesData": {
"description": "If set to true, references are saved in the database so that other extensions can retrieve them independently of the main article content.",
"public": true,
"value": false
},
"CiteCacheRawReferencesOnParse": {
"description": "Requires $wgCiteStoreReferencesData. By default, references are cached only on database access. If set to true, references are also cached whenever pages are parsed.",
"public": true,
"value": false
},
"CiteVisualEditorOtherGroup": {
"public": true,
"value": false

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Meno25"
]
},
"apihelp-query+references-description": "يرجع تمثيل لبيانات المراجع المرتبطة مع الصفحات المعطاة.",
"apihelp-query+references-summary": "يرجع تمثيل بيانات للمراجع المصاحبة للصفحات المعطاة.",
"apihelp-query+references-example-1": "المراجع المرتبطة ب<kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "تخزين مراجع امتداد Cite غير مفعل."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Xuacu"
]
},
"apihelp-query+references-description": "Devolver una representación de datos de les referencies asociaes coles páxines indicaes.",
"apihelp-query+references-summary": "Devolver una representación de datos de les referencies asociaes coles páxines indicaes.",
"apihelp-query+references-example-1": "Referencies asociaes con <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "L'almacenamientu de referencies de la estensión Cite nun ta activáu."
}

View file

@ -1,10 +0,0 @@
{
"@metadata": {
"authors": [
"Лилиә",
"Янмурза Баки"
]
},
"apihelp-query+references-description": "Был бит менән бәйле һылтанмаларҙың мәғлүмәттәрен сағылдыра.",
"apihelp-query+references-example-1": "<kbd>Albert Einstein</kbd> менән бәйле һылтанмалар."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Red Winged Duck"
]
},
"apihelp-query+references-description": "Вяртае прадстаўленьне зьвестак крыніц, злучаных з пададзенымі старонкамі.",
"apihelp-query+references-summary": "Вяртае прадстаўленьне зьвестак крыніц, злучаных з пададзенымі старонкамі.",
"apihelp-query+references-example-1": "Крыніцы, зьвязаныя з старонкай <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Сховішча зносак пашырэньня цытаваньня ня ўключанае."
}

View file

@ -1,12 +0,0 @@
{
"@metadata": {
"authors": [
"StanProg",
"Ted Masters"
]
},
"apihelp-query+references-description": "Връщане на данни, представящи източниците свързани с дадената страница.",
"apihelp-query+references-summary": "Връщане на данни, представящи източниците свързани с дадените страници.",
"apihelp-query+references-example-1": "Източници, свързани с <kbd>Алберт Айнщайн</kbd>.",
"apierror-citestoragedisabled": "Хранилището на източници на разширението Cite не е включено."
}

View file

@ -1,8 +0,0 @@
{
"@metadata": {
"authors": [
"Fitoschido"
]
},
"apihelp-query+references-example-1": "Referències associades amb <kbd>Albert Einstein</kbd>."
}

View file

@ -1,12 +0,0 @@
{
"@metadata": {
"authors": [
"Debenben",
"Metalhead64"
]
},
"apihelp-query+references-description": "Gibt eine Datendarstellung von Referenzen zurück, die mit den angegebenen Seiten verbunden sind.",
"apihelp-query+references-summary": "Gibt eine Datendarstellung der Referenzen zurück, die mit den angegebenen Seiten verbunden sind.",
"apihelp-query+references-example-1": "Referenzen, die mit <kbd>Albert Einstein</kbd> verbunden sind.",
"apierror-citestoragedisabled": "Der Referenzspeicher der Erweiterung „Cite“ ist nicht aktiviert."
}

View file

@ -1,13 +0,0 @@
{
"@metadata": {
"authors": [
"Gırd",
"Kumkumuk",
"Orbot707"
]
},
"apihelp-query+references-description": "Eleqe referansa deyaye peran de temsilandataya çerx keno",
"apihelp-query+references-summary": "Eleqe referansa deyaye peran de temsilandataya çerx keno",
"apihelp-query+references-example-1": "<kbd>Albert Einstein</kbd>'i ya eleqeyın referanso",
"apierror-citestoragedisabled": "Nımıtışê referansê cıkerdışê qalkerdışi a niyo."
}

View file

@ -1,12 +0,0 @@
{
"@metadata": {
"authors": [
"jdlrobson",
"Brad Jorsch"
]
},
"apihelp-query+references-description": "Return a data representation of references associated with the given pages.",
"apihelp-query+references-summary": "Return a data representation of references associated with the given pages.",
"apihelp-query+references-example-1": "References associated with <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Cite extension reference storage is not enabled."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Mirin"
]
},
"apihelp-query+references-description": "Liveri datena prezento de referencoj asociitaj al la donitaj paĝoj.",
"apihelp-query+references-summary": "Liveri datena prezento de referencoj asociitaj al la donitaj paĝoj.",
"apihelp-query+references-example-1": "Referencoj asociitaj al <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Konservado de referencoj de citado-kromprogramo ne estas ŝaltita."
}

View file

@ -1,13 +0,0 @@
{
"@metadata": {
"authors": [
"Fitoschido",
"Macofe",
"Tiberius1701"
]
},
"apihelp-query+references-description": "Devolver una representación de datos de referencias asociadas con las páginas especificadas.",
"apihelp-query+references-summary": "Devuelve una representación de datos de las referencias asociadas con las páginas dadas.",
"apihelp-query+references-example-1": "Referencias asociadas con <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "El almacenamiento de referencias de la extensión de citas no está activado."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Huji"
]
},
"apihelp-query+references-description": "یک بازنمودِ دادگانی از ارجاع‌هایی که با صفحه‌های داده شده مرتبط هستند برمی‌گرداند.",
"apihelp-query+references-summary": "یک بازنمودِ دادگانی از ارجاع‌هایی که با صفحه‌های داده شده مرتبط هستند برمی‌گرداند.",
"apihelp-query+references-example-1": "ارجاع‌های مرتبط با <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "ذخیره‌سازی ارجاع‌ها برای افزونهٔ یادکرد فعال نشده‌است."
}

View file

@ -1,8 +0,0 @@
{
"@metadata": {
"authors": [
"01miki10"
]
},
"apihelp-query+references-example-1": "Sivuun <kbd>Albert Einstein</kbd> liittyvät viitteet."
}

View file

@ -1,12 +0,0 @@
{
"@metadata": {
"authors": [
"Gomoko",
"Wladek92"
]
},
"apihelp-query+references-description": "Renvoyer une représentation des données des références associées avec les pages fournies.",
"apihelp-query+references-summary": "Renvoyer une représentation des données de référence associées aux pages fournies.",
"apihelp-query+references-example-1": "Références associées avec <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "La sauvegarde sur l'extension de référence Cite n'est pas activée."
}

View file

@ -1,12 +0,0 @@
{
"@metadata": {
"authors": [
"Banjo",
"Elisardojm"
]
},
"apihelp-query+references-description": "Devolve unha representación de datos das referencias asociadas coas páxinas indicadas.",
"apihelp-query+references-summary": "Devolve unha representación de datos das referencias asociadas coas páxinas indicadas.",
"apihelp-query+references-example-1": "Referencias asociadas con <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "O almacenamento de referencias da extensión Cite non está habilitado."
}

View file

@ -1,12 +0,0 @@
{
"@metadata": {
"authors": [
"Amire80",
"Guycn2"
]
},
"apihelp-query+references-description": "החזרת ייצוג נתונים של הערות שוליים שמשויכות לדפים הנתונים.",
"apihelp-query+references-summary": "החזרת ייצוג נתונים של הערות שוליים שמשויכות לדפים הנתונים.",
"apihelp-query+references-example-1": "הערות שוליים שמשויכות ל־<kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "אחסון הערות של ההרחבה Cite אינו מופעל."
}

View file

@ -1,13 +0,0 @@
{
"@metadata": {
"authors": [
"Anoop rao",
"Jayprakash12345",
"Prong$31"
]
},
"apihelp-query+references-description": "दिए गए पृष्ठों से संबंधित संदर्भों का एक डेटा प्रस्तुत करें।",
"apihelp-query+references-summary": "Return a data representation of references associated with the given pages.",
"apihelp-query+references-example-1": "<kbd> अल्बर्ट आइंस्टीन </kbd> से संबंधित संदर्भ।",
"apierror-citestoragedisabled": "उद्धरण विस्तार संदर्भ संग्रहण सक्षम नहीं है।"
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Tacsipacsi"
]
},
"apihelp-query+references-description": "A megadott lapokhoz kapcsolódó lábjegyzetek adatreprezentációjának lekérése.",
"apihelp-query+references-summary": "A megadott lapokhoz kapcsolódó lábjegyzetek adatreprezentációjának lekérése.",
"apihelp-query+references-example-1": "Az <kbd>Albert Einstein</kbd> szócikkhez kapcsolódó lábjegyzetek.",
"apierror-citestoragedisabled": "A Cite kiterjesztés lábjegyzettárolása nincs engedélyezve."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"McDutchie"
]
},
"apihelp-query+references-description": "Retornar un representation de datos del referentias associate al paginas indicate.",
"apihelp-query+references-summary": "Retornar un representation de datos del referentias associate al paginas indicate.",
"apihelp-query+references-example-1": "Referentias associate a <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Le immagazinage de referentias del extension Cite non es activate."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Gombang"
]
},
"apihelp-query+references-description": "Kembalikan representasi data dari referensi yang terkait dengan halaman yang diberikan.",
"apihelp-query+references-summary": "Kembalikan representasi data dari referensi yang terkait dengan halaman yang diberikan.",
"apihelp-query+references-example-1": "Referensi yang dikaitkan dengan <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Penyimpanan Ekstensi pengutipan referensi tidak diaktifkan."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Lam-ang"
]
},
"apihelp-query+references-description": "Mangisubli iti representasion ti datos kadagiti nagibasaran a mainaig kadagiti naited a panid.",
"apihelp-query+references-summary": "Mangisubli iti representasion ti datos kadagiti nagibasaran a mainaig kadagiti naited a panid.",
"apihelp-query+references-example-1": "Dagiti nagibasaran a mainaig kenni <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Saan a napakabaelan ti pagipenpenan ti nagibasaran ti pagpaatiddog ti Cite."
}

View file

@ -1,10 +0,0 @@
{
"@metadata": {
"authors": [
"Beta16"
]
},
"apihelp-query+references-description": "Restituisce una rappresentazione dati dei riferimenti associati con le pagine indicate.",
"apihelp-query+references-summary": "Restituisce una rappresentazione dati dei riferimenti associati con le pagine indicate.",
"apihelp-query+references-example-1": "Riferimenti associati con <kbd>Albert Einstein</kbd>."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Fryed-peach",
"Yusuke1109"
]
},
"apihelp-query+references-description": "指定されたページに関連付けられた脚注のデータ表現を返す",
"apihelp-query+references-summary": "指定されたページに関連付けられた脚注のデータ表現を返す",
"apihelp-query+references-example-1": "<kbd>Albert Einstein</kbd> に関連付けられた脚注。"
}

View file

@ -1,8 +0,0 @@
{
"@metadata": {
"authors": [
"Olwe519"
]
},
"apihelp-query+references-example-1": "lo se sitna pe <kbd>la .albert. .ainstain.</kbd>"
}

View file

@ -1,9 +0,0 @@
{
"@metadata": {
"authors": [
"NoiX180"
]
},
"apihelp-query+references-example-1": "Rujukan sing gegayutan <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Panyimpenan rujukan èkstènsi sitir ora diurubaké."
}

View file

@ -1,8 +0,0 @@
{
"@metadata": {
"authors": [
"Kwj2772"
]
},
"apihelp-query+references-example-1": "<kbd>Albert Einstein</kbd>과 관련된 주석."
}

View file

@ -1,9 +0,0 @@
{
"@metadata": {
"authors": [
"Purodha"
]
},
"apihelp-query+references-description": "Jidd en Dahschtällong vun dä Qälle un Fohßnuhte als Dahte uß, di met dä aanjejovve Sigge verknop sin.",
"apihelp-query+references-example-1": "Bezösche em Zesammehang mem <kbd lang=\"de\" xml:lang=\"de\" dir=\"ltr\">Albert Einstein</kbd>."
}

View file

@ -1,8 +0,0 @@
{
"@metadata": {
"authors": [
"Robby"
]
},
"apihelp-query+references-example-1": "Referenzen associéiert mam <kbd>Albert Einstein</kbd>."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Ooswesthoesbes"
]
},
"apihelp-query+references-description": "Gaef gegaevesrepresentatie van rifferensies trögk die waere verbónje mit de opgegaeve pagina's.",
"apihelp-query+references-summary": "Gaef gegaevesrepresentatie van rifferensies trögk die waere verbónje mit de opgegaeve pagina's.",
"apihelp-query+references-example-1": "Rifferensies verbónje mit <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Oetbreijingsrifferensieopslaag van Citeer steit neet aan."
}

View file

@ -1,9 +0,0 @@
{
"@metadata": {
"authors": [
"Giromin Cangiaxo"
]
},
"apihelp-query+references-description": "O restitoisce una rapresentaçion di dæti de referençe associæ co-e paggine indicæ.",
"apihelp-query+references-example-1": "Referençe associæ con <kbd>Albert Einstein</kbd>."
}

View file

@ -1,8 +0,0 @@
{
"@metadata": {
"authors": [
"Eitvys200"
]
},
"apihelp-query+references-example-1": "Nuorodos, susijusios su <kbd>Albert Einstein</kbd>."
}

View file

@ -1,8 +0,0 @@
{
"@metadata": {
"authors": [
"Papuass"
]
},
"apihelp-query+references-example-1": "Atsauces, kas saistītas ar <kbd>Albertu Einšteinu</kbd>."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Bjankuloski06"
]
},
"apihelp-query+references-description": "Дај податочно претставување на наводите поврзани со дадени страници.",
"apihelp-query+references-summary": "Дај податочно претставување на наводите поврзани со дадени страници.",
"apihelp-query+references-example-1": "Наводи поврзани со <kbd>Алберт Ајнштајн</kbd>.",
"apierror-citestoragedisabled": "Складиштето на наводи за додатокот „Наведување“ не е овозможено."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Awangba Mangang"
]
},
"apihelp-query+references-description": "Return a data representation of references associated with the given pages.",
"apihelp-query+references-summary": "Return a data representation of references associated with the given pages.",
"apihelp-query+references-example-1": "<kbd>ꯑꯜꯕꯥꯔꯠ ꯑꯥꯏꯟꯁꯇꯥꯏꯟ</kbd>ꯒ ꯃꯔꯤꯂꯩꯅꯕ ꯂꯧꯔꯛꯐꯝꯁꯤꯡ ꯫",
"apierror-citestoragedisabled": "Cite extension reference storage is not enabled."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Sureshkhole"
]
},
"apihelp-query+references-description": "दिलेल्या पानांच्या संदर्भांची सांख्यीकी दाखवा",
"apihelp-query+references-summary": "दिलेल्या पानांच्या संदर्भांची सांख्यीकी दाखवा",
"apihelp-query+references-example-1": "<kbd>अॅल्बर्ट आइन्स्टाइन</kbd> ला दिलेले संदर्भ",
"apierror-citestoragedisabled": "अवतरण जोडणी संदर्भ साठवून ठेवणे चालू केलेले नाही"
}

View file

@ -1,9 +0,0 @@
{
"@metadata": {
"authors": [
"C.R."
]
},
"apihelp-query+references-description": "Tuorna na rappresentazione 'e date ch' 'e riferimiente ssuòccie a 'e paggene date.",
"apihelp-query+references-example-1": "Riferimiente suòccie a <kbd>Albert Einstein</kbd>."
}

View file

@ -1,12 +0,0 @@
{
"@metadata": {
"authors": [
"Danmichaelo",
"Jon Harald Søby"
]
},
"apihelp-query+references-description": "Returnerer en datarepresentasjon av referanser assosiert med de gitte sidene.",
"apihelp-query+references-summary": "Returner en datarepresentasjon av referanser assosiert med de gitte sidene.",
"apihelp-query+references-example-1": "Referanser forbundet med <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Referanselagring i Cite-utvidelsen er ikke slått på."
}

View file

@ -1,13 +0,0 @@
{
"@metadata": {
"authors": [
"Woytecr",
"Railfail536",
"Rail"
]
},
"apihelp-query+references-description": "Zwraca reprezentację danych przypisów związanych z tą stroną.",
"apihelp-query+references-summary": "Zwraca reprezentację danych przypisów związanych z tą stroną.",
"apihelp-query+references-example-1": "Przypisy powiązane z <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Pamięć referencyjna rozszerzenia Cite nie jest włączona."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Felipe L. Ewald"
]
},
"apihelp-query+references-description": "Retornar uma representação de dados de referências associadas às páginas fornecidas.",
"apihelp-query+references-summary": "Retornar uma representação de dados de referências associadas às páginas fornecidas.",
"apihelp-query+references-example-1": "Referências associadas a <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "O armazenamento de referência da extensão Cite não está habilitado."
}

View file

@ -1,12 +0,0 @@
{
"@metadata": {
"authors": [
"Fúlvio",
"Hamilton Abreu"
]
},
"apihelp-query+references-description": "Devolver uma representação de dados, das referências associadas com as páginas especificadas.",
"apihelp-query+references-summary": "Devolver uma representação de dados, das referências associadas com as páginas especificadas.",
"apihelp-query+references-example-1": "Referências associadas com <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "O armazenamento de referências da extensão de citação não está ativado."
}

View file

@ -1,12 +0,0 @@
{
"@metadata": {
"authors": [
"jdlrobson",
"Brad Jorsch"
]
},
"apihelp-query+references-description": "{{doc-apihelp-description|query+references}}",
"apihelp-query+references-summary": "{{doc-apihelp-summary|query+references}}",
"apihelp-query+references-example-1": "{{doc-apihelp-example|query+references}}",
"apierror-citestoragedisabled": "{{doc-apierror}}"
}

View file

@ -1,10 +0,0 @@
{
"@metadata": {
"authors": [
"Strainu"
]
},
"apihelp-query+references-description": "Întoarce o reprezentare a referințelor asociate cu paginile date.",
"apihelp-query+references-summary": "Întoarce o reprezentare a referințelor asociate cu paginile date.",
"apihelp-query+references-example-1": "Referințe asociate cu <kbd>Albert Einstein</kbd>."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Joetaras"
]
},
"apihelp-query+references-description": "Dèje 'na rappresendazione de le date de le refereminde associate cu le pàggene indicate.",
"apihelp-query+references-summary": "Dèje 'na rappresendazione de le date de le refereminde associate cu le pàggene indicate.",
"apihelp-query+references-example-1": "Refereminde associate cu <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "'A reggistrazzione d'u referimende de l'estenzione Cite non g'ha state abbilitate."
}

View file

@ -1,12 +0,0 @@
{
"@metadata": {
"authors": [
"Facenapalm",
"Putnik"
]
},
"apihelp-query+references-description": "Возвращает представление данных из ссылок, связанных с данной страницей.",
"apihelp-query+references-summary": "Возвращает представление данных из ссылок, связанных с данной страницей.",
"apihelp-query+references-example-1": "Ссылки, связанные с <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Хранилище сносок расширения цитирования не активировано."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Vlad5250"
]
},
"apihelp-query+references-description": "Daj podatkovno predstavljanje o navodima povezanih s danim stranicama.",
"apihelp-query+references-summary": "Daj podatkovno predstavljanje o navodima povezanih s danim stranicama.",
"apihelp-query+references-example-1": "Referencije vezane uz <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Spremište referencija za dodatak \"Citiranje\" nije omogućeno."
}

View file

@ -1,9 +0,0 @@
{
"@metadata": {
"authors": [
"Dbc334"
]
},
"apihelp-query+references-description": "Vrne predstavitev podatkov sklicev, povezano z danimi stranmi.",
"apihelp-query+references-example-1": "Sklici, povezani z <kbd>Albertom Einsteinom</kbd>."
}

View file

@ -1,9 +0,0 @@
{
"@metadata": {
"authors": [
"BadDog"
]
},
"apihelp-query+references-example-1": "Референца је повезана с <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Складиште за референце додатка Cite није омогућено."
}

View file

@ -1,12 +0,0 @@
{
"@metadata": {
"authors": [
"Lokal Profil",
"WikiPhoenix"
]
},
"apihelp-query+references-description": "Returnera en datarepresentation av referenser associerade med den angivna sidorna.",
"apihelp-query+references-summary": "Returnera en datarepresentation av referenser associerade med de angivna sidorna.",
"apihelp-query+references-example-1": "Referenser associerade med <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Referenslagringen i Cite-tillägget är inte aktiverad."
}

View file

@ -1,8 +0,0 @@
{
"@metadata": {
"authors": [
"Chaduvari"
]
},
"apihelp-query+references-example-1": "<kbd>ఆల్బర్ట్ ఐన్‌స్టీన్</kbd> కు సంబంధించిన మూలాలు."
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Piramidion"
]
},
"apihelp-query+references-description": "Вивести репрезентацію даних посилань, пов'язаних із заданими сторінками.",
"apihelp-query+references-summary": "Вивести репрезентацію даних посилань, пов'язаних із заданими сторінками.",
"apihelp-query+references-example-1": "Посилання, пов'язані зі сторінкою <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Зберігання посилань для розширення Cite не увімкнене."
}

View file

@ -1,8 +0,0 @@
{
"@metadata": {
"authors": [
"BukhariSaeed"
]
},
"apihelp-query+references-example-1": "<kbd>البرٹ آئنسٹائن</kbd> متعلقہ حوالہ جات"
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Liuxinyu970226"
]
},
"apihelp-query+references-description": "返回与指定页面相关联的参考文献的数据表示法。",
"apihelp-query+references-summary": "返回与指定页面相关联的参考文献的数据表示法。",
"apihelp-query+references-example-1": "与<kbd>Albert Einstein</kbd>相关联的参考文献。",
"apierror-citestoragedisabled": "引用扩展参考存储未启用。"
}

View file

@ -1,11 +0,0 @@
{
"@metadata": {
"authors": [
"Kly"
]
},
"apihelp-query+references-description": "回傳與指定頁面關聯之參考文獻的資料描述。",
"apihelp-query+references-summary": "回傳與指定頁面關聯之參考文獻的資料描述。",
"apihelp-query+references-example-1": "與 <kbd>Albert Einstein</kbd> 關聯的參考文獻。",
"apierror-citestoragedisabled": "引用擴充參考文獻儲存未啟用。"
}

View file

@ -1,217 +0,0 @@
<?php
/**
* Expose reference information for a page via prop=references API.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @see https://www.mediawiki.org/wiki/Extension:Cite#API
*/
namespace Cite\Api;
use ApiBase;
use ApiQuery;
use ApiResult;
use Cite\Cite;
use MediaWiki\MediaWikiServices;
use Wikimedia\Rdbms\Database;
use Wikimedia\Rdbms\IDatabase;
class ApiQueryReferences extends \ApiQueryBase {
/**
* Cache duration when fetching references from the database, in seconds. 18,000 seconds = 5
* hours.
*/
private const CACHE_DURATION_ONFETCH = 18000;
/**
* @param ApiQuery $query
* @param string $moduleName
*/
public function __construct( ApiQuery $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'rf' );
}
/**
* @inheritDoc
*/
public function getAllowedParams() {
return [
'continue' => [
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
],
];
}
public function execute() {
$config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'cite' );
if ( !$config->get( 'CiteStoreReferencesData' ) ) {
$this->dieWithError( 'apierror-citestoragedisabled' );
}
$params = $this->extractRequestParams();
$titles = $this->getPageSet()->getGoodTitles();
ksort( $titles );
if ( !is_null( $params['continue'] ) ) {
$startId = (int)$params['continue'];
// check it is definitely an int
$this->dieContinueUsageIf( strval( $startId ) !== $params['continue'] );
} else {
$startId = false;
}
foreach ( $titles as $pageId => $title ) {
// Skip until you have the correct starting point
if ( $startId !== false && $startId !== $pageId ) {
continue;
} else {
$startId = false;
}
$storedRefs = $this->getStoredReferences( $pageId );
$allReferences = [];
// some pages may not have references stored
if ( $storedRefs !== false ) {
// a page can have multiple <references> tags but they all have unique keys
foreach ( $storedRefs['refs'] as $index => $grouping ) {
foreach ( $grouping as $group => $members ) {
foreach ( $members as $name => $ref ) {
$ref['name'] = $name;
$key = $ref['key'];
if ( is_string( $name ) ) {
$id = Cite::getReferencesKey( $name . '-' . $key );
} else {
$id = Cite::getReferencesKey( $key );
}
$ref['group'] = $group;
$ref['reflist'] = $index;
$allReferences[$id] = $ref;
}
}
}
}
// set some metadata since its an assoc data structure
ApiResult::setArrayType( $allReferences, 'kvp', 'id' );
// Ship a data representation of the combined references.
$fit = $this->addPageSubItems( $pageId, $allReferences );
if ( !$fit ) {
$this->setContinueEnumParameter( 'continue', $pageId );
break;
}
}
}
/**
* Fetch references stored for the given title in page_props
* For performance, results are cached
*
* @param int $pageId
* @return array|false
*/
private function getStoredReferences( $pageId ) {
global $wgCiteStoreReferencesData;
if ( !$wgCiteStoreReferencesData ) {
return false;
}
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
$key = $cache->makeKey( Cite::EXT_DATA_KEY, $pageId );
return $cache->getWithSetCallback(
$key,
self::CACHE_DURATION_ONFETCH,
function ( $oldValue, &$ttl, array &$setOpts ) use ( $pageId ) {
$dbr = wfGetDB( DB_REPLICA );
$setOpts += Database::getCacheSetOptions( $dbr );
return $this->recursiveFetchRefsFromDB( $pageId, $dbr );
},
[
'checkKeys' => [ $key ],
'lockTSE' => 30,
]
);
}
/**
* Reconstructs compressed json by successively retrieving the properties references-1, -2, etc
* It attempts the next step when a decoding error occurs.
* Returns json_decoded uncompressed string, with validation of json
*
* @param int $pageId
* @param IDatabase $dbr
* @param string $string
* @param int $i
* @return array|false
*/
private function recursiveFetchRefsFromDB(
$pageId,
IDatabase $dbr,
$string = '',
$i = 1
) {
$result = $dbr->selectField(
'page_props',
'pp_value',
[
'pp_page' => $pageId,
'pp_propname' => 'references-' . $i
],
__METHOD__
);
if ( $result === false ) {
// no refs stored in page_props at this index
if ( $i > 1 ) {
// shouldn't happen
wfDebug( "Failed to retrieve stored references for title id $pageId" );
}
return false;
}
$string .= $result;
$decodedString = gzdecode( $string );
if ( $decodedString !== false ) {
$json = json_decode( $decodedString, true );
if ( json_last_error() === JSON_ERROR_NONE ) {
return $json;
}
// corrupted json ?
// shouldn't happen since when string is truncated, gzdecode should fail
wfDebug( "Corrupted json detected when retrieving stored references for title id $pageId" );
}
// if gzdecode fails, try to fetch next references- property value
return $this->recursiveFetchRefsFromDB( $pageId, $dbr, $string, ++$i );
}
/**
* Get the cache mode for the data generated by this module.
*
* @param array $params
* @return string
*/
public function getCacheMode( $params ) {
return 'public';
}
/**
* @inheritDoc
*/
protected function getExamplesMessages() {
return [
'action=query&prop=references&titles=Albert%20Einstein' =>
'apihelp-query+references-example-1',
];
}
}

View file

@ -29,7 +29,6 @@ use Html;
use MediaWiki\MediaWikiServices;
use Parser;
use ParserOptions;
use ParserOutput;
use Sanitizer;
use StatusValue;
@ -37,28 +36,6 @@ class Cite {
private const DEFAULT_GROUP = '';
/**
* Maximum storage capacity for the pp_value field of the page_props table. 2^16-1 = 65535 is
* the size of a MySQL 'blob' field.
* @todo Find a way to retrieve this information from the DBAL
*/
public const MAX_STORAGE_LENGTH = 65535;
/**
* Key used for storage in parser output's ExtensionData and ObjectCache
*/
public const EXT_DATA_KEY = 'Cite:References';
/**
* Version number in case we change the data structure in the future
*/
private const DATA_VERSION_NUMBER = 1;
/**
* Cache duration when parsing a page with references, in seconds. 3,600 seconds = 1 hour.
*/
public const CACHE_DURATION_ONPARSE = 3600;
/**
* Wikitext attribute name for Book Referencing.
*/
@ -139,11 +116,6 @@ class Cite {
*/
private $referenceStack;
/**
* @var bool
*/
private $mBumpRefData = false;
/**
* @param Parser $parser
*/
@ -180,10 +152,6 @@ class Cite {
$ret = $this->guardedRef( $text, $argv, $parser );
$this->mInCite = false;
// new <ref> tag, we may need to bump the ref data counter
// to avoid overwriting a previous group
$this->mBumpRefData = true;
return $ret;
}
@ -544,11 +512,6 @@ class Cite {
$ret = Html::rawElement( 'div', [ 'class' => $wrapClasses ], $ret );
}
if ( !$this->isPagePreview ) {
// save references data for later use by LinksUpdate hooks
$this->saveReferencesData( $this->mParser->getOutput(), $group );
}
// done, clean up so we can reuse the group
$this->referenceStack->deleteGroup( $group );
@ -877,13 +840,11 @@ class Cite {
*
* @param bool $afterParse True if called from the ParserAfterParse hook
* @param ParserOptions $parserOptions
* @param ParserOutput $parserOutput
* @param string &$text
*/
public function checkRefsNoReferences(
$afterParse,
ParserOptions $parserOptions,
ParserOutput $parserOutput,
&$text
) {
global $wgCiteResponsiveReferences;
@ -894,15 +855,6 @@ class Cite {
return;
}
if ( !$parserOptions->getIsPreview() ) {
// save references data for later use by LinksUpdate hooks
if ( $this->referenceStack &&
$this->referenceStack->hasGroup( self::DEFAULT_GROUP )
) {
$this->saveReferencesData( $parserOutput );
}
}
$s = '';
if ( $this->referenceStack ) {
foreach ( $this->referenceStack->getGroups() as $group ) {
@ -934,38 +886,4 @@ class Cite {
}
}
/**
* Saves references in parser extension data
* This is called by each <references/> tag, and by checkRefsNoReferences
*
* @param ParserOutput $parserOutput
* @param string $group
*/
private function saveReferencesData( ParserOutput $parserOutput, $group = self::DEFAULT_GROUP ) {
global $wgCiteStoreReferencesData;
if ( !$wgCiteStoreReferencesData ) {
return;
}
$savedRefs = $parserOutput->getExtensionData( self::EXT_DATA_KEY );
if ( $savedRefs === null ) {
// Initialize array structure
$savedRefs = [
'refs' => [],
'version' => self::DATA_VERSION_NUMBER,
];
}
if ( $this->mBumpRefData ) {
// This handles pages with multiple <references/> tags with <ref> tags in between.
// On those, a group can appear several times, so we need to avoid overwriting
// a previous appearance.
$savedRefs['refs'][] = [];
$this->mBumpRefData = false;
}
$n = count( $savedRefs['refs'] ) - 1;
// save group
$savedRefs['refs'][$n][$group] = $this->referenceStack->getGroupRefs( $group );
$parserOutput->setExtensionData( self::EXT_DATA_KEY, $savedRefs );
}
}

View file

@ -7,15 +7,11 @@
namespace Cite\Hooks;
use ApiQuerySiteinfo;
use Cite\Cite;
use ExtensionRegistry;
use FormatJson;
use LinksUpdate;
use MediaWiki\Linker\LinkTarget;
use MediaWiki\MediaWikiServices;
use ResourceLoader;
use Title;
use WANObjectCache;
class CiteHooks {
@ -228,67 +224,6 @@ class CiteHooks {
] );
}
/**
* Callback for LinksUpdate hook
* Post-output processing of references property, for proper db storage
* Deferred to avoid performance overhead when outputting the page
*
* @param LinksUpdate $linksUpdate
*/
public static function onLinksUpdate( LinksUpdate $linksUpdate ) {
global $wgCiteStoreReferencesData, $wgCiteCacheRawReferencesOnParse;
if ( !$wgCiteStoreReferencesData ) {
return;
}
$refData = $linksUpdate->getParserOutput()->getExtensionData( Cite::EXT_DATA_KEY );
if ( $refData === null ) {
return;
}
if ( $wgCiteCacheRawReferencesOnParse ) {
// caching
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
$articleID = $linksUpdate->getTitle()->getArticleID();
$key = $cache->makeKey( Cite::EXT_DATA_KEY, $articleID );
$cache->set( $key, $refData, Cite::CACHE_DURATION_ONPARSE );
}
// JSON encode
$ppValue = FormatJson::encode( $refData, false, FormatJson::ALL_OK );
// GZIP encode references data at maximum compression
$ppValue = gzencode( $ppValue, 9 );
// split the string in smaller parts that can fit into a db blob
$ppValues = str_split( $ppValue, Cite::MAX_STORAGE_LENGTH );
foreach ( $ppValues as $num => $ppValue ) {
$key = 'references-' . intval( $num + 1 );
$linksUpdate->mProperties[$key] = $ppValue;
}
$linksUpdate->getParserOutput()->setExtensionData( Cite::EXT_DATA_KEY, null );
}
/**
* Callback for LinksUpdateComplete hook
* If $wgCiteCacheRawReferencesOnParse is set to false, purges the cache
* when references are modified
*
* @param LinksUpdate $linksUpdate
*/
public static function onLinksUpdateComplete( LinksUpdate $linksUpdate ) {
global $wgCiteStoreReferencesData, $wgCiteCacheRawReferencesOnParse;
if ( !$wgCiteStoreReferencesData || $wgCiteCacheRawReferencesOnParse ) {
return;
}
// if we can, avoid clearing the cache when references were not changed
if ( isset( $linksUpdate->getAddedProperties()['references-1'] )
|| isset( $linksUpdate->getRemovedProperties()['references-1'] )
) {
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
$articleID = $linksUpdate->getTitle()->getArticleID();
$key = $cache->makeKey( Cite::EXT_DATA_KEY, $articleID );
// delete with reduced hold off period (LinksUpdate uses a master connection)
$cache->delete( $key, WANObjectCache::MAX_COMMIT_DELAY );
}
}
/**
* Adds extra variables to the global config
* @param array &$vars

View file

@ -57,7 +57,7 @@ class CiteParserHooks {
public static function onParserAfterParse( Parser $parser, &$text, $stripState ) {
/** @var Cite $cite */
$cite = $parser->extCite;
$cite->checkRefsNoReferences( true, $parser->getOptions(), $parser->getOutput(), $text );
$cite->checkRefsNoReferences( true, $parser->getOptions(), $text );
}
/**
@ -69,7 +69,7 @@ class CiteParserHooks {
public static function onParserBeforeTidy( Parser $parser, &$text ) {
/** @var Cite $cite */
$cite = $parser->extCite;
$cite->checkRefsNoReferences( false, $parser->getOptions(), $parser->getOutput(), $text );
$cite->checkRefsNoReferences( false, $parser->getOptions(), $text );
}
}

View file

@ -4,10 +4,6 @@ namespace Cite\Tests;
use ApiQuerySiteinfo;
use Cite\Hooks\CiteHooks;
use HashBagOStuff;
use LinksUpdate;
use Title;
use WANObjectCache;
/**
* @coversDefaultClass \Cite\Hooks\CiteHooks
@ -16,44 +12,6 @@ use WANObjectCache;
*/
class CiteHooksTest extends \MediaWikiIntegrationTestCase {
protected function setUp() : void {
parent::setUp();
$this->setMwGlobals( [
'wgCiteStoreReferencesData' => true,
] );
}
/**
* @covers ::onLinksUpdateComplete
*/
public function testOnLinksUpdateComplete() {
$cache = $this->getMockBuilder( WANObjectCache::class )
->setConstructorArgs( [ [ 'cache' => new HashBagOStuff() ] ] )
->setMethods( [ 'makeKey', 'relayPurge' ] )
->getMock();
$cache->method( 'makeKey' )
->willReturn( '<KEY>' );
// What we actually want to check here is if WANObjectCache::delete() is called, but it's
// final and can't be mocked.
$cache->expects( $this->once() )
->method( 'relayPurge' )
->with(
'WANCache:v:<KEY>',
WANObjectCache::MAX_COMMIT_DELAY,
WANObjectCache::HOLDOFF_TTL_NONE
);
$this->setService( 'MainWANObjectCache', $cache );
$linksUpdate = $this->createMock( LinksUpdate::class );
$linksUpdate->method( 'getAddedProperties' )
->willReturn( [ 'references-1' => true ] );
$linksUpdate->method( 'getTitle' )
->willReturn( $this->createMock( Title::class ) );
CiteHooks::onLinksUpdateComplete( $linksUpdate );
}
/**
* @covers ::onResourceLoaderGetConfigVars
*/

View file

@ -1,102 +0,0 @@
<?php
namespace Cite\Tests\Unit;
use ApiMain;
use ApiQuery;
use Cite\Api\ApiQueryReferences;
use IContextSource;
use Wikimedia\AtEase\AtEase;
use Wikimedia\Rdbms\IDatabase;
use Wikimedia\TestingAccessWrapper;
/**
* @coversDefaultClass \Cite\Api\ApiQueryReferences
*
* @license GPL-2.0-or-later
*/
class ApiQueryReferencesTest extends \MediaWikiUnitTestCase {
/**
* @covers ::__construct
* @covers ::getAllowedParams
* @covers ::getCacheMode
* @covers ::getExamplesMessages
*/
public function testBasics() {
$api = $this->newApiQueryReferences();
$this->assertInternalType( 'array', $api->getAllowedParams() );
$this->assertSame( 'public', $api->getCacheMode( [] ) );
$this->assertContainsOnly( 'string', $api->getExamplesMessages() );
}
/**
* @covers ::getStoredReferences
*/
public function testGetStoredReferences_storeDisabled() {
$api = $this->newApiQueryReferences();
$this->assertFalse( $api->getStoredReferences( 0 ) );
}
/**
* @covers ::recursiveFetchRefsFromDB
*/
public function testRecursiveFetchRefsFromDB_fails() {
$api = $this->newApiQueryReferences();
$dbr = $this->createMock( IDatabase::class );
$dbr->method( 'selectField' )
->willReturn( false );
$this->assertFalse( $api->recursiveFetchRefsFromDB( 0, $dbr ) );
}
/**
* @covers ::recursiveFetchRefsFromDB
*/
public function testRecursiveFetchRefsFromDB_firstTry() {
$api = $this->newApiQueryReferences();
$dbr = $this->createMock( IDatabase::class );
$dbr->method( 'selectField' )
->willReturn( gzencode( '{"refs":{}}' ) );
$this->assertSame( [ 'refs' => [] ], $api->recursiveFetchRefsFromDB( 0, $dbr ) );
}
/**
* @covers ::recursiveFetchRefsFromDB
*/
public function testRecursiveFetchRefsFromDB_secondTry() {
$api = $this->newApiQueryReferences();
$dbr = $this->createMock( IDatabase::class );
$dbr->expects( $this->exactly( 2 ) )
->method( 'selectField' )
->willReturnOnConsecutiveCalls( '', gzencode( '{"refs":{}}' ) );
// Code relies on gzdecode() returning false, but that reports an error now
AtEase::suppressWarnings();
$refs = $api->recursiveFetchRefsFromDB( 0, $dbr );
AtEase::restoreWarnings();
$this->assertSame( [ 'refs' => [] ], $refs );
}
/**
* @return ApiQueryReferences
*/
private function newApiQueryReferences() {
$main = $this->createMock( ApiMain::class );
$main->method( 'getContext' )
->willReturn( $this->createMock( IContextSource::class ) );
$query = $this->createMock( ApiQuery::class );
$query->method( 'getMain' )
->willReturn( $main );
$api = new ApiQueryReferences( $query, '' );
return TestingAccessWrapper::newFromObject( $api );
}
}

View file

@ -2,11 +2,8 @@
namespace Cite\Tests\Unit;
use Cite\Cite;
use Cite\Hooks\CiteHooks;
use HashConfig;
use LinksUpdate;
use ParserOutput;
use ResourceLoader;
use Title;
@ -17,13 +14,6 @@ use Title;
*/
class CiteHooksUnitTest extends \MediaWikiUnitTestCase {
protected function setUp() : void {
global $wgCiteStoreReferencesData;
parent::setUp();
$wgCiteStoreReferencesData = true;
}
/**
* @covers ::onContentHandlerDefaultModelFor
*/
@ -66,25 +56,4 @@ class CiteHooksUnitTest extends \MediaWikiUnitTestCase {
CiteHooks::onResourceLoaderRegisterModules( $resourceLoader );
}
/**
* @covers ::onLinksUpdate
*/
public function testOnLinksUpdate() {
$parserOutput = $this->createMock( ParserOutput::class );
$parserOutput->method( 'getExtensionData' )
->willReturn( true );
$parserOutput->expects( $this->once() )
->method( 'setExtensionData' )
->with( Cite::EXT_DATA_KEY, null );
$linksUpdate = $this->createMock( LinksUpdate::class );
$linksUpdate->method( 'getParserOutput' )
->willReturn( $parserOutput );
/** @var LinksUpdate $linksUpdate */
CiteHooks::onLinksUpdate( $linksUpdate );
$this->assertArrayHasKey( 'references-1', $linksUpdate->mProperties );
}
}