diff --git a/README.md b/README.md index 9e951caaa..180c92b34 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/extension.json b/extension.json index 2f73501d0..898522a7f 100644 --- a/extension.json +++ b/extension.json @@ -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 diff --git a/i18n/api/ar.json b/i18n/api/ar.json deleted file mode 100644 index 5826b3312..000000000 --- a/i18n/api/ar.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Meno25" - ] - }, - "apihelp-query+references-description": "يرجع تمثيل لبيانات المراجع المرتبطة مع الصفحات المعطاة.", - "apihelp-query+references-summary": "يرجع تمثيل بيانات للمراجع المصاحبة للصفحات المعطاة.", - "apihelp-query+references-example-1": "المراجع المرتبطة بAlbert Einstein.", - "apierror-citestoragedisabled": "تخزين مراجع امتداد Cite غير مفعل." -} diff --git a/i18n/api/ast.json b/i18n/api/ast.json deleted file mode 100644 index c424b0d2f..000000000 --- a/i18n/api/ast.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "L'almacenamientu de referencies de la estensión Cite nun ta activáu." -} diff --git a/i18n/api/ba.json b/i18n/api/ba.json deleted file mode 100644 index 7505f11bc..000000000 --- a/i18n/api/ba.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Лилиә", - "Янмурза Баки" - ] - }, - "apihelp-query+references-description": "Был бит менән бәйле һылтанмаларҙың мәғлүмәттәрен сағылдыра.", - "apihelp-query+references-example-1": "Albert Einstein менән бәйле һылтанмалар." -} diff --git a/i18n/api/be-tarask.json b/i18n/api/be-tarask.json deleted file mode 100644 index 725388829..000000000 --- a/i18n/api/be-tarask.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Red Winged Duck" - ] - }, - "apihelp-query+references-description": "Вяртае прадстаўленьне зьвестак крыніц, злучаных з пададзенымі старонкамі.", - "apihelp-query+references-summary": "Вяртае прадстаўленьне зьвестак крыніц, злучаных з пададзенымі старонкамі.", - "apihelp-query+references-example-1": "Крыніцы, зьвязаныя з старонкай Albert Einstein.", - "apierror-citestoragedisabled": "Сховішча зносак пашырэньня цытаваньня ня ўключанае." -} diff --git a/i18n/api/bg.json b/i18n/api/bg.json deleted file mode 100644 index b710d0bc1..000000000 --- a/i18n/api/bg.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "@metadata": { - "authors": [ - "StanProg", - "Ted Masters" - ] - }, - "apihelp-query+references-description": "Връщане на данни, представящи източниците свързани с дадената страница.", - "apihelp-query+references-summary": "Връщане на данни, представящи източниците свързани с дадените страници.", - "apihelp-query+references-example-1": "Източници, свързани с Алберт Айнщайн.", - "apierror-citestoragedisabled": "Хранилището на източници на разширението Cite не е включено." -} diff --git a/i18n/api/ca.json b/i18n/api/ca.json deleted file mode 100644 index 2b443bfd1..000000000 --- a/i18n/api/ca.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Fitoschido" - ] - }, - "apihelp-query+references-example-1": "Referències associades amb Albert Einstein." -} diff --git a/i18n/api/de.json b/i18n/api/de.json deleted file mode 100644 index 7b104a1ba..000000000 --- a/i18n/api/de.json +++ /dev/null @@ -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 Albert Einstein verbunden sind.", - "apierror-citestoragedisabled": "Der Referenzspeicher der Erweiterung „Cite“ ist nicht aktiviert." -} diff --git a/i18n/api/diq.json b/i18n/api/diq.json deleted file mode 100644 index 40b1330ae..000000000 --- a/i18n/api/diq.json +++ /dev/null @@ -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": "Albert Einstein'i ya eleqeyın referanso", - "apierror-citestoragedisabled": "Nımıtışê referansê cıkerdışê qalkerdışi a niyo." -} diff --git a/i18n/api/en.json b/i18n/api/en.json deleted file mode 100644 index a6e81deaf..000000000 --- a/i18n/api/en.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "Cite extension reference storage is not enabled." -} diff --git a/i18n/api/eo.json b/i18n/api/eo.json deleted file mode 100644 index 1009f3b62..000000000 --- a/i18n/api/eo.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "Konservado de referencoj de citado-kromprogramo ne estas ŝaltita." -} diff --git a/i18n/api/es.json b/i18n/api/es.json deleted file mode 100644 index d7257f783..000000000 --- a/i18n/api/es.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "El almacenamiento de referencias de la extensión de citas no está activado." -} diff --git a/i18n/api/fa.json b/i18n/api/fa.json deleted file mode 100644 index c5904d36c..000000000 --- a/i18n/api/fa.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Huji" - ] - }, - "apihelp-query+references-description": "یک بازنمودِ دادگانی از ارجاع‌هایی که با صفحه‌های داده شده مرتبط هستند برمی‌گرداند.", - "apihelp-query+references-summary": "یک بازنمودِ دادگانی از ارجاع‌هایی که با صفحه‌های داده شده مرتبط هستند برمی‌گرداند.", - "apihelp-query+references-example-1": "ارجاع‌های مرتبط با Albert Einstein.", - "apierror-citestoragedisabled": "ذخیره‌سازی ارجاع‌ها برای افزونهٔ یادکرد فعال نشده‌است." -} diff --git a/i18n/api/fi.json b/i18n/api/fi.json deleted file mode 100644 index c30a4f3aa..000000000 --- a/i18n/api/fi.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "01miki10" - ] - }, - "apihelp-query+references-example-1": "Sivuun Albert Einstein liittyvät viitteet." -} diff --git a/i18n/api/fr.json b/i18n/api/fr.json deleted file mode 100644 index 2c861c9d9..000000000 --- a/i18n/api/fr.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "La sauvegarde sur l'extension de référence Cite n'est pas activée." -} diff --git a/i18n/api/gl.json b/i18n/api/gl.json deleted file mode 100644 index d5575d9a9..000000000 --- a/i18n/api/gl.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "O almacenamento de referencias da extensión Cite non está habilitado." -} diff --git a/i18n/api/he.json b/i18n/api/he.json deleted file mode 100644 index 5b9179fe8..000000000 --- a/i18n/api/he.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Amire80", - "Guycn2" - ] - }, - "apihelp-query+references-description": "החזרת ייצוג נתונים של הערות שוליים שמשויכות לדפים הנתונים.", - "apihelp-query+references-summary": "החזרת ייצוג נתונים של הערות שוליים שמשויכות לדפים הנתונים.", - "apihelp-query+references-example-1": "הערות שוליים שמשויכות ל־Albert Einstein.", - "apierror-citestoragedisabled": "אחסון הערות של ההרחבה Cite אינו מופעל." -} diff --git a/i18n/api/hi.json b/i18n/api/hi.json deleted file mode 100644 index 83b7964e4..000000000 --- a/i18n/api/hi.json +++ /dev/null @@ -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": " अल्बर्ट आइंस्टीन से संबंधित संदर्भ।", - "apierror-citestoragedisabled": "उद्धरण विस्तार संदर्भ संग्रहण सक्षम नहीं है।" -} diff --git a/i18n/api/hu.json b/i18n/api/hu.json deleted file mode 100644 index 758f4c119..000000000 --- a/i18n/api/hu.json +++ /dev/null @@ -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 Albert Einstein szócikkhez kapcsolódó lábjegyzetek.", - "apierror-citestoragedisabled": "A Cite kiterjesztés lábjegyzettárolása nincs engedélyezve." -} diff --git a/i18n/api/ia.json b/i18n/api/ia.json deleted file mode 100644 index 10bd06c5c..000000000 --- a/i18n/api/ia.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "Le immagazinage de referentias del extension Cite non es activate." -} diff --git a/i18n/api/id.json b/i18n/api/id.json deleted file mode 100644 index fc7a1468a..000000000 --- a/i18n/api/id.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "Penyimpanan Ekstensi pengutipan referensi tidak diaktifkan." -} diff --git a/i18n/api/ilo.json b/i18n/api/ilo.json deleted file mode 100644 index c14a6ef34..000000000 --- a/i18n/api/ilo.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "Saan a napakabaelan ti pagipenpenan ti nagibasaran ti pagpaatiddog ti Cite." -} diff --git a/i18n/api/it.json b/i18n/api/it.json deleted file mode 100644 index a574f3c94..000000000 --- a/i18n/api/it.json +++ /dev/null @@ -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 Albert Einstein." -} diff --git a/i18n/api/ja.json b/i18n/api/ja.json deleted file mode 100644 index 80f08e8c1..000000000 --- a/i18n/api/ja.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Fryed-peach", - "Yusuke1109" - ] - }, - "apihelp-query+references-description": "指定されたページに関連付けられた脚注のデータ表現を返す", - "apihelp-query+references-summary": "指定されたページに関連付けられた脚注のデータ表現を返す", - "apihelp-query+references-example-1": "Albert Einstein に関連付けられた脚注。" -} diff --git a/i18n/api/jbo.json b/i18n/api/jbo.json deleted file mode 100644 index 4d87301b9..000000000 --- a/i18n/api/jbo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Olwe519" - ] - }, - "apihelp-query+references-example-1": "lo se sitna pe la .albert. .ainstain." -} diff --git a/i18n/api/jv.json b/i18n/api/jv.json deleted file mode 100644 index 57a930a4b..000000000 --- a/i18n/api/jv.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "@metadata": { - "authors": [ - "NoiX180" - ] - }, - "apihelp-query+references-example-1": "Rujukan sing gegayutan Albert Einstein.", - "apierror-citestoragedisabled": "Panyimpenan rujukan èkstènsi sitir ora diurubaké." -} diff --git a/i18n/api/ko.json b/i18n/api/ko.json deleted file mode 100644 index 714207cb5..000000000 --- a/i18n/api/ko.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Kwj2772" - ] - }, - "apihelp-query+references-example-1": "Albert Einstein과 관련된 주석." -} diff --git a/i18n/api/ksh.json b/i18n/api/ksh.json deleted file mode 100644 index 889bfc272..000000000 --- a/i18n/api/ksh.json +++ /dev/null @@ -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 Albert Einstein." -} diff --git a/i18n/api/lb.json b/i18n/api/lb.json deleted file mode 100644 index 18b5fd057..000000000 --- a/i18n/api/lb.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Robby" - ] - }, - "apihelp-query+references-example-1": "Referenzen associéiert mam Albert Einstein." -} diff --git a/i18n/api/li.json b/i18n/api/li.json deleted file mode 100644 index 1c0420d2b..000000000 --- a/i18n/api/li.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "Oetbreijingsrifferensieopslaag van Citeer steit neet aan." -} diff --git a/i18n/api/lij.json b/i18n/api/lij.json deleted file mode 100644 index 099a0496c..000000000 --- a/i18n/api/lij.json +++ /dev/null @@ -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 Albert Einstein." -} diff --git a/i18n/api/lt.json b/i18n/api/lt.json deleted file mode 100644 index 59a8be0ca..000000000 --- a/i18n/api/lt.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Eitvys200" - ] - }, - "apihelp-query+references-example-1": "Nuorodos, susijusios su Albert Einstein." -} diff --git a/i18n/api/lv.json b/i18n/api/lv.json deleted file mode 100644 index c5e5fce26..000000000 --- a/i18n/api/lv.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Papuass" - ] - }, - "apihelp-query+references-example-1": "Atsauces, kas saistītas ar Albertu Einšteinu." -} diff --git a/i18n/api/mk.json b/i18n/api/mk.json deleted file mode 100644 index 9b720c34f..000000000 --- a/i18n/api/mk.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Bjankuloski06" - ] - }, - "apihelp-query+references-description": "Дај податочно претставување на наводите поврзани со дадени страници.", - "apihelp-query+references-summary": "Дај податочно претставување на наводите поврзани со дадени страници.", - "apihelp-query+references-example-1": "Наводи поврзани со Алберт Ајнштајн.", - "apierror-citestoragedisabled": "Складиштето на наводи за додатокот „Наведување“ не е овозможено." -} diff --git a/i18n/api/mni.json b/i18n/api/mni.json deleted file mode 100644 index bb26b9d4b..000000000 --- a/i18n/api/mni.json +++ /dev/null @@ -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": "ꯑꯜꯕꯥꯔꯠ ꯑꯥꯏꯟꯁꯇꯥꯏꯟꯒ ꯃꯔꯤꯂꯩꯅꯕ ꯂꯧꯔꯛꯐꯝꯁꯤꯡ ꯫", - "apierror-citestoragedisabled": "Cite extension reference storage is not enabled." -} diff --git a/i18n/api/mr.json b/i18n/api/mr.json deleted file mode 100644 index c7dac820d..000000000 --- a/i18n/api/mr.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Sureshkhole" - ] - }, - "apihelp-query+references-description": "दिलेल्या पानांच्या संदर्भांची सांख्यीकी दाखवा", - "apihelp-query+references-summary": "दिलेल्या पानांच्या संदर्भांची सांख्यीकी दाखवा", - "apihelp-query+references-example-1": "अॅल्बर्ट आइन्स्टाइन ला दिलेले संदर्भ", - "apierror-citestoragedisabled": "अवतरण जोडणी संदर्भ साठवून ठेवणे चालू केलेले नाही" -} diff --git a/i18n/api/nap.json b/i18n/api/nap.json deleted file mode 100644 index b3915ad0d..000000000 --- a/i18n/api/nap.json +++ /dev/null @@ -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 Albert Einstein." -} diff --git a/i18n/api/nb.json b/i18n/api/nb.json deleted file mode 100644 index 49704e127..000000000 --- a/i18n/api/nb.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "Referanselagring i Cite-utvidelsen er ikke slått på." -} diff --git a/i18n/api/pl.json b/i18n/api/pl.json deleted file mode 100644 index f6c939b9d..000000000 --- a/i18n/api/pl.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "Pamięć referencyjna rozszerzenia Cite nie jest włączona." -} diff --git a/i18n/api/pt-br.json b/i18n/api/pt-br.json deleted file mode 100644 index 3852bffed..000000000 --- a/i18n/api/pt-br.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "O armazenamento de referência da extensão Cite não está habilitado." -} diff --git a/i18n/api/pt.json b/i18n/api/pt.json deleted file mode 100644 index 31aa42424..000000000 --- a/i18n/api/pt.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "O armazenamento de referências da extensão de citação não está ativado." -} diff --git a/i18n/api/qqq.json b/i18n/api/qqq.json deleted file mode 100644 index 4ae65c927..000000000 --- a/i18n/api/qqq.json +++ /dev/null @@ -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}}" -} diff --git a/i18n/api/ro.json b/i18n/api/ro.json deleted file mode 100644 index df5d1dabc..000000000 --- a/i18n/api/ro.json +++ /dev/null @@ -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 Albert Einstein." -} diff --git a/i18n/api/roa-tara.json b/i18n/api/roa-tara.json deleted file mode 100644 index 1375cc37c..000000000 --- a/i18n/api/roa-tara.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "'A reggistrazzione d'u referimende de l'estenzione Cite non g'ha state abbilitate." -} diff --git a/i18n/api/ru.json b/i18n/api/ru.json deleted file mode 100644 index d71171a99..000000000 --- a/i18n/api/ru.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Facenapalm", - "Putnik" - ] - }, - "apihelp-query+references-description": "Возвращает представление данных из ссылок, связанных с данной страницей.", - "apihelp-query+references-summary": "Возвращает представление данных из ссылок, связанных с данной страницей.", - "apihelp-query+references-example-1": "Ссылки, связанные с Albert Einstein.", - "apierror-citestoragedisabled": "Хранилище сносок расширения цитирования не активировано." -} diff --git a/i18n/api/sh.json b/i18n/api/sh.json deleted file mode 100644 index 687396ce2..000000000 --- a/i18n/api/sh.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "Spremište referencija za dodatak \"Citiranje\" nije omogućeno." -} diff --git a/i18n/api/sl.json b/i18n/api/sl.json deleted file mode 100644 index e2bfb0605..000000000 --- a/i18n/api/sl.json +++ /dev/null @@ -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 Albertom Einsteinom." -} diff --git a/i18n/api/sr-ec.json b/i18n/api/sr-ec.json deleted file mode 100644 index e17cbcdec..000000000 --- a/i18n/api/sr-ec.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "@metadata": { - "authors": [ - "BadDog" - ] - }, - "apihelp-query+references-example-1": "Референца је повезана с Albert Einstein.", - "apierror-citestoragedisabled": "Складиште за референце додатка Cite није омогућено." -} diff --git a/i18n/api/sv.json b/i18n/api/sv.json deleted file mode 100644 index 4f2fd7893..000000000 --- a/i18n/api/sv.json +++ /dev/null @@ -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 Albert Einstein.", - "apierror-citestoragedisabled": "Referenslagringen i Cite-tillägget är inte aktiverad." -} diff --git a/i18n/api/te.json b/i18n/api/te.json deleted file mode 100644 index dc0a429e2..000000000 --- a/i18n/api/te.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Chaduvari" - ] - }, - "apihelp-query+references-example-1": "ఆల్బర్ట్ ఐన్‌స్టీన్ కు సంబంధించిన మూలాలు." -} diff --git a/i18n/api/uk.json b/i18n/api/uk.json deleted file mode 100644 index 9ed924e47..000000000 --- a/i18n/api/uk.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Piramidion" - ] - }, - "apihelp-query+references-description": "Вивести репрезентацію даних посилань, пов'язаних із заданими сторінками.", - "apihelp-query+references-summary": "Вивести репрезентацію даних посилань, пов'язаних із заданими сторінками.", - "apihelp-query+references-example-1": "Посилання, пов'язані зі сторінкою Albert Einstein.", - "apierror-citestoragedisabled": "Зберігання посилань для розширення Cite не увімкнене." -} diff --git a/i18n/api/ur.json b/i18n/api/ur.json deleted file mode 100644 index c2fdf03af..000000000 --- a/i18n/api/ur.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "BukhariSaeed" - ] - }, - "apihelp-query+references-example-1": "البرٹ آئنسٹائن متعلقہ حوالہ جات" -} diff --git a/i18n/api/zh-hans.json b/i18n/api/zh-hans.json deleted file mode 100644 index 1cb7b591a..000000000 --- a/i18n/api/zh-hans.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Liuxinyu970226" - ] - }, - "apihelp-query+references-description": "返回与指定页面相关联的参考文献的数据表示法。", - "apihelp-query+references-summary": "返回与指定页面相关联的参考文献的数据表示法。", - "apihelp-query+references-example-1": "与Albert Einstein相关联的参考文献。", - "apierror-citestoragedisabled": "引用扩展参考存储未启用。" -} diff --git a/i18n/api/zh-hant.json b/i18n/api/zh-hant.json deleted file mode 100644 index 58006f693..000000000 --- a/i18n/api/zh-hant.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Kly" - ] - }, - "apihelp-query+references-description": "回傳與指定頁面關聯之參考文獻的資料描述。", - "apihelp-query+references-summary": "回傳與指定頁面關聯之參考文獻的資料描述。", - "apihelp-query+references-example-1": "與 Albert Einstein 關聯的參考文獻。", - "apierror-citestoragedisabled": "引用擴充參考文獻儲存未啟用。" -} diff --git a/src/Api/ApiQueryReferences.php b/src/Api/ApiQueryReferences.php deleted file mode 100644 index 67ef40127..000000000 --- a/src/Api/ApiQueryReferences.php +++ /dev/null @@ -1,217 +0,0 @@ - [ - 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 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', - ]; - } - -} diff --git a/src/Cite.php b/src/Cite.php index 084a769d5..04a340ef8 100644 --- a/src/Cite.php +++ b/src/Cite.php @@ -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 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 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 tags with 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 ); - } - } diff --git a/src/Hooks/CiteHooks.php b/src/Hooks/CiteHooks.php index c0046ab1b..00f13b1ae 100644 --- a/src/Hooks/CiteHooks.php +++ b/src/Hooks/CiteHooks.php @@ -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 diff --git a/src/Hooks/CiteParserHooks.php b/src/Hooks/CiteParserHooks.php index 47becd472..01efb6554 100644 --- a/src/Hooks/CiteParserHooks.php +++ b/src/Hooks/CiteParserHooks.php @@ -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 ); } } diff --git a/tests/phpunit/CiteHooksTest.php b/tests/phpunit/CiteHooksTest.php index ab66b30f5..f505c38e3 100644 --- a/tests/phpunit/CiteHooksTest.php +++ b/tests/phpunit/CiteHooksTest.php @@ -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( '' ); - // 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:', - 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 */ diff --git a/tests/phpunit/unit/ApiQueryReferencesTest.php b/tests/phpunit/unit/ApiQueryReferencesTest.php deleted file mode 100644 index bd3722c5c..000000000 --- a/tests/phpunit/unit/ApiQueryReferencesTest.php +++ /dev/null @@ -1,102 +0,0 @@ -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 ); - } - -} diff --git a/tests/phpunit/unit/CiteHooksUnitTest.php b/tests/phpunit/unit/CiteHooksUnitTest.php index 8c64e619c..8b840f85f 100644 --- a/tests/phpunit/unit/CiteHooksUnitTest.php +++ b/tests/phpunit/unit/CiteHooksUnitTest.php @@ -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 ); - } - }