Merge "skins: Deprecate QuickTemplate::setTranslator and MediaWikiI18N::set"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 2 Feb 2018 23:32:27 +0000 (23:32 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 2 Feb 2018 23:32:27 +0000 (23:32 +0000)
18 files changed:
RELEASE-NOTES-1.31
includes/OutputPage.php
includes/api/i18n/cs.json
includes/compat/Timestamp.php
includes/skins/Skin.php
languages/i18n/be-tarask.json
languages/i18n/gl.json
languages/i18n/hr.json
languages/i18n/is.json
languages/i18n/ko.json
languages/i18n/lij.json
languages/i18n/lv.json
languages/i18n/pl.json
languages/i18n/sr-ec.json
languages/i18n/sr-el.json
resources/src/mediawiki/api/edit.js
tests/phpunit/includes/utils/ClassCollectorTest.php
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.edit.test.js

index 5e1e8cd..ba7b86c 100644 (file)
@@ -201,6 +201,14 @@ changes to languages because of Phabricator reports.
 * ParserOutput objects generated using a non-default value for
   ParserOptions::setWrapOutputClass() can no longer be added to the parser
   cache.
+* The following deprecated methods from the OutputPage class have been removed:
+  * OutputPage::addExtensionStyle(); deprecated in 1.27
+  * OutputPage::getExtStyle(); deprecated in 1.27
+  * OutputPage::setETag(); deprecated in 1.28 (obsolete no-op)
+  * OutputPage::setSquidMaxage(); deprecated in 1.27
+  * OutputPage::readOnlyPage(); deprecated in 1.25
+  * OutputPage::rateLimited(); deprecated in 1.25
+* The no-op method Skin::showIPinHeader(), deprecated in 1.27, was removed.
 
 == Compatibility ==
 MediaWiki 1.31 requires PHP 5.5.9 or later. Although HHVM 3.18.5 or later is supported,
index fc7fbf7..5fa66e8 100644 (file)
@@ -464,31 +464,6 @@ class OutputPage extends ContextSource {
                $this->mScripts .= $script;
        }
 
-       /**
-        * Register and add a stylesheet from an extension directory.
-        *
-        * @deprecated since 1.27 use addModuleStyles() or addStyle() instead
-        * @param string $url Path to sheet.  Provide either a full url (beginning
-        *             with 'http', etc) or a relative path from the document root
-        *             (beginning with '/').  Otherwise it behaves identically to
-        *             addStyle() and draws from the /skins folder.
-        */
-       public function addExtensionStyle( $url ) {
-               wfDeprecated( __METHOD__, '1.27' );
-               array_push( $this->mExtStyles, $url );
-       }
-
-       /**
-        * Get all styles added by extensions
-        *
-        * @deprecated since 1.27
-        * @return array
-        */
-       function getExtStyle() {
-               wfDeprecated( __METHOD__, '1.27' );
-               return $this->mExtStyles;
-       }
-
        /**
         * Add a JavaScript file out of skins/common, or a given relative path.
         * Internal use only. Use OutputPage::addModules() if possible.
@@ -714,13 +689,6 @@ class OutputPage extends ContextSource {
                $this->mAdditionalBodyClasses = array_merge( $this->mAdditionalBodyClasses, (array)$classes );
        }
 
-       /**
-        * @deprecated since 1.28 Obsolete - wgUseETag experiment was removed.
-        * @param string $tag
-        */
-       public function setETag( $tag ) {
-       }
-
        /**
         * Set whether the output should only contain the body of the article,
         * without any skin, sidebar, etc.
@@ -1988,15 +1956,6 @@ class OutputPage extends ContextSource {
                return Parser::stripOuterParagraph( $parsed );
        }
 
-       /**
-        * @param int $maxage
-        * @deprecated since 1.27 Use setCdnMaxage() instead
-        */
-       public function setSquidMaxage( $maxage ) {
-               wfDeprecated( __METHOD__, '1.27' );
-               $this->setCdnMaxage( $maxage );
-       }
-
        /**
         * Set the value of the "s-maxage" part of the "Cache-control" HTTP header
         *
@@ -2660,36 +2619,6 @@ class OutputPage extends ContextSource {
                return $text;
        }
 
-       /**
-        * Display a page stating that the Wiki is in read-only mode.
-        * Should only be called after wfReadOnly() has returned true.
-        *
-        * Historically, this function was used to show the source of the page that the user
-        * was trying to edit and _also_ permissions error messages. The relevant code was
-        * moved into EditPage in 1.19 (r102024 / d83c2a431c2a) and removed here in 1.25.
-        *
-        * @deprecated since 1.25; throw the exception directly
-        * @throws ReadOnlyError
-        */
-       public function readOnlyPage() {
-               if ( func_num_args() > 0 ) {
-                       throw new MWException( __METHOD__ . ' no longer accepts arguments since 1.25.' );
-               }
-
-               throw new ReadOnlyError;
-       }
-
-       /**
-        * Turn off regular page output and return an error response
-        * for when rate limiting has triggered.
-        *
-        * @deprecated since 1.25; throw the exception directly
-        */
-       public function rateLimited() {
-               wfDeprecated( __METHOD__, '1.25' );
-               throw new ThrottledError;
-       }
-
        /**
         * Show a warning about replica DB lag
         *
index ea42e24..f90ae0f 100644 (file)
                        "Danny B.",
                        "LordMsz",
                        "Dvorapa",
-                       "Matěj Suchánek"
+                       "Matěj Suchánek",
+                       "Ilimanaq29"
                ]
        },
-       "apihelp-main-extended-description": "<div class=\"hlist plainlinks api-main-links\">\n* [[mw:Special:MyLanguage/API:Main_page|Dokumentace]]\n* [[mw:Special:MyLanguage/API:FAQ|FAQ]]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api E-mailová konference]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce Oznámení k API]\n* [https://phabricator.wikimedia.org/maniphest/query/GebfyV4uCaLd/#R Chyby a požadavky]\n</div>\n<strong>Stav:</strong> Všechny funkce uvedené na této stránce by měly fungovat, ale API se stále aktivně vyvíjí a může se kdykoli změnit. Upozornění na změny získáte přihlášením se k [https://lists.wikimedia.org/pipermail/mediawiki-api-announce/ e-mailové konferenci mediawiki-api-announce].\n\n<strong>Chybné požadavky:</strong> Pokud jsou do API zaslány chybné požadavky, bude vrácena HTTP hlavička s klíčem „MediaWiki-API-Error“ a hodnota této hlavičky a chybový kód budou nastaveny na stejnou hodnotu. Více informací najdete [[mw:Special:MyLanguage/API:Errors_and_warnings|v dokumentaci]].\n\n<strong>Testování:</strong> Pro jednoduché testování požadavků na API zkuste [[Special:ApiSandbox]].",
+       "apihelp-main-extended-description": "<div class=\"hlist plainlinks api-main-links\">\n* [[mw:Special:MyLanguage/API:Main_page|Dokumentace]]\n* [[mw:Special:MyLanguage/API:FAQ|Otázky a odpovědi]]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api E-mailová konference]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce Oznámení k API]\n* [https://phabricator.wikimedia.org/maniphest/query/GebfyV4uCaLd/#R Chyby a požadavky]\n</div>\n<strong>Stav:</strong> Všechny funkce uvedené na této stránce by měly fungovat, ale API se stále aktivně vyvíjí a může se kdykoli změnit. Upozornění na změny získáte přihlášením se k [https://lists.wikimedia.org/pipermail/mediawiki-api-announce/ e-mailové konferenci mediawiki-api-announce].\n\n<strong>Chybné požadavky:</strong> Pokud jsou do API zaslány chybné požadavky, bude vrácena HTTP hlavička s klíčem „MediaWiki-API-Error“ a hodnota této hlavičky a chybový kód budou nastaveny na stejnou hodnotu. Více informací najdete [[mw:Special:MyLanguage/API:Errors_and_warnings|v dokumentaci]].\n\n<strong>Testování:</strong> Pro jednoduché testování požadavků na API zkuste [[Special:ApiSandbox]].",
        "apihelp-main-param-action": "Která akce se má provést.",
        "apihelp-main-param-format": "Formát výstupu.",
        "apihelp-main-param-maxlag": "Maximální zpoždění lze použít, když je MediaWiki nainstalováno na cluster s replikovanou databází. Abyste se vyhnuli zhoršování už tak špatného replikačního zpoždění, můžete tímto parametrem nechat klienta čekat, dokud replikační zpoždění neklesne pod uvedenou hodnotu. V případě příliš vysokého zpoždění se vrátí chybový kód „<samp>maxlag</samp>“ s hlášením typu „<samp>Waiting for $host: $lag seconds lagged</samp>“.<br />Více informací najdete v [[mw:Special:MyLanguage/Manual:Maxlag_parameter|příručce]].",
index bd25432..63b87ae 100644 (file)
@@ -7,12 +7,12 @@
 // loading context. This file will then register the alias and, as class_alias() does
 // by default, it will trigger a plain autoload for the destination class.
 
-// The below uses string concatenation for the alias to avoid being seen by ClassCollector,
-// which would insist on adding it to autoload.php, after which AutoLoaderTest will
+// The below uses a namespaced class reference, to to avoid being seen by ClassCollector,
+// which would otherwise add it to autoload.php, after which AutoLoaderTest will
 // complain about class_alias() not being in the target class file.
 
 /**
  * @deprecated since 1.29
  * @since 1.20
  */
-class_alias( Wikimedia\Timestamp\TimestampException::class, 'Timestamp' . 'Exception' );
+class_alias( Wikimedia\Timestamp\TimestampException::class, 'TimestampException' );
index c95f1f5..bd43255 100644 (file)
@@ -767,15 +767,6 @@ abstract class Skin extends ContextSource {
                return $subpages;
        }
 
-       /**
-        * @deprecated since 1.27, feature removed
-        * @return bool Always false
-        */
-       function showIPinHeader() {
-               wfDeprecated( __METHOD__, '1.27' );
-               return false;
-       }
-
        /**
         * @return string
         */
index 6f0bd53..31e5aaa 100644 (file)
        "right-move-subpages": "Перанос старонак разам зь іх падстаронкамі",
        "right-move-rootuserpages": "перанос карэнных старонак удзельнікаў",
        "right-move-categorypages": "перанос старонак катэгорыяў",
-       "right-movefile": "перайменаваньне файлаў",
+       "right-movefile": "Ð\9fерайменаваньне файлаў",
        "right-suppressredirect": "не ствараць перанакіраваньне са старой назвы пасьля пераносу старонкі",
        "right-upload": "загрузка файлаў",
        "right-reupload": "перазапіс існуючых файлаў",
index 5193c0b..5be7056 100644 (file)
        "postedit-confirmation-created": "Creouse a páxina.",
        "postedit-confirmation-restored": "Restaurouse a páxina.",
        "postedit-confirmation-saved": "Gardouse a súa edición.",
+       "postedit-confirmation-published": "A súa edición foi publicada.",
        "edit-already-exists": "Non se pode crear a nova páxina.\nEsta xa existe.",
        "defaultmessagetext": "Texto predeterminado",
        "content-failed-to-parse": "Erro ao analizar o contido de \"$2\" para o modelo de $1: $3",
        "lockmanager-fail-closelock": "Non se puido pechar o ficheiro de peche de \"$1\".",
        "lockmanager-fail-deletelock": "Non se puido borrar o ficheiro de peche de \"$1\".",
        "lockmanager-fail-acquirelock": "Non se puido obter o peche de \"$1\".",
-       "lockmanager-fail-openlock": "Non se puido abrir o ficheiro de peche de \"$1\".",
+       "lockmanager-fail-openlock": "Non se puido abrir o ficheiro de bloqueo de \"$1\". Revise que o directorio de cargas estea configurado correctamente e que o seu servidor web teña permisos de escritura nese directorio. Consulte https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:$wgUploadDirectory para obter máis información.",
        "lockmanager-fail-releaselock": "Non se puido liberar o peche de \"$1\".",
        "lockmanager-fail-db-bucket": "Non se puido contactar cos peches de bases de datos suficientes no cubo $1.",
        "lockmanager-fail-db-release": "Non se puideron liberar os peches na base de datos $1.",
        "doubleredirects": "Redireccións dobres",
        "doubleredirectstext": "Esta lista contén as páxinas que redirixen cara a outras páxinas de redirección.\nCada ringleira contén ligazóns cara á primeira e segunda redireccións, así como a primeira liña de texto da segunda páxina, que é frecuentemente o artigo \"real\", á que a primeira redirección debera apuntar.\nAs entradas <del>riscadas</del> xa foron resoltas.",
        "double-redirect-fixed-move": "Trasladouse a páxina \"[[$1]]\".\nActualizouse automaticamente e agora é unha redirección cara a \"[[$2]]\".",
-       "double-redirect-fixed-maintenance": "Arranxo automaticamente a redirección dobre entre \"[[$1]]\" e \"[[$2]]\" como tarefa de mantemento.",
+       "double-redirect-fixed-maintenance": "Arranxo automático da redirección dobre entre \"[[$1]]\" e \"[[$2]]\" nunha tarefa de mantemento",
        "double-redirect-fixer": "Amañador de redireccións",
        "brokenredirects": "Redireccións rotas",
        "brokenredirectstext": "As seguintes redireccións ligan cara a páxinas que non existen:",
index 060c444..5fd0fe9 100644 (file)
        "rcfilters-advancedfilters": "Napredni filtri",
        "rcfilters-limit-title": "Rezultata za prikaz",
        "rcfilters-limit-and-date-label": "{{PLURAL:$1|$1 izmjena|$1 izmjene|$1 izmjena}}, $2",
-       "rcfilters-date-popup-title": "Vremensko razdoblje za pretragu",
+       "rcfilters-date-popup-title": "Razdoblje za pretraživanje",
        "rcfilters-days-title": "Nedavnih dana",
        "rcfilters-hours-title": "Nedavnih sati",
        "rcfilters-days-show-days": "$1 {{PLURAL:$1|dan|dana}}",
index 8aeac3c..f0d3cd3 100644 (file)
        "rcfilters-activefilters": "Virkar síur",
        "rcfilters-advancedfilters": "Ítarlegar síur",
        "rcfilters-limit-title": "Breytingar sem á að birta",
+       "rcfilters-limit-and-date-label": "$1 {{PLURAL:$1|breyting|breytingar}}, $2",
        "rcfilters-date-popup-title": "Tímarammi sem á að leita í",
        "rcfilters-days-title": "Síðustu daga",
        "rcfilters-hours-title": "Síðustu klukkutíma",
        "rcfilters-highlighted-filters-list": "Áherslulitað: $1",
        "rcfilters-quickfilters": "Vistaðar síur",
        "rcfilters-quickfilters-placeholder-title": "Engar síur vistaðar",
-       "rcfilters-quickfilters-placeholder-description": "Til þess að vista þínar síustillingar og nota þær aftur seinna, smelltu á bókamerkistáknið undir Virkum síum hér fyrir neðan.",
+       "rcfilters-quickfilters-placeholder-description": "Til þess að vista síustillingarnar þínar og nota þær aftur seinna, smelltu á bókamerkistáknið undir 'Virkar síur' hér fyrir neðan.",
        "rcfilters-savedqueries-defaultlabel": "Vistaðar síur",
        "rcfilters-savedqueries-rename": "Endurnefna",
        "rcfilters-savedqueries-setdefault": "Setja sem sjálfgefið",
        "rcfilters-liveupdates-button-title-off": "Sýna nýjar breytingar um leið og þær gerast",
        "rcfilters-watchlist-markseen-button": "Merkja allar breytingar sem skoðaðar",
        "rcfilters-watchlist-edit-watchlist-button": "Breyta þínum lista yfir vaktaðar síður",
+       "rcfilters-filter-showlinkedfrom-label": "Sýna breytingar á síðum sem tengt er í frá",
+       "rcfilters-filter-showlinkedfrom-option-label": "<strong>Síður sem tengt er í</strong> frá valinni síðu",
+       "rcfilters-filter-showlinkedto-label": "Sýna breytingar á síðum sem tengjast í",
+       "rcfilters-filter-showlinkedto-option-label": "<strong>Síður sem tengjast í</strong> valda síðu",
        "rcfilters-target-page-placeholder": "Settu inn síðuheiti (eða flokk)",
        "rcnotefrom": "Að neðan {{PLURAL:$5|er breyting síðan|eru breytingar síðan}} <strong>$3, $4</strong> (allt að <strong>$1</strong> sýndar).",
        "rclistfromreset": "Endurstilla dagsetningarval",
index 340f427..ef12e21 100644 (file)
        "postedit-confirmation-created": "문서가 만들어졌습니다.",
        "postedit-confirmation-restored": "문서가 되돌려졌습니다.",
        "postedit-confirmation-saved": "편집을 저장했습니다.",
+       "postedit-confirmation-published": "편집이 게시되었습니다.",
        "edit-already-exists": "새 문서를 만들 수 없습니다.\n문서가 이미 존재합니다.",
        "defaultmessagetext": "기본 메시지 글",
        "content-failed-to-parse": "$1 모델에 대한 $2 내용을 구문 분석하는 데 실패했습니다: $3",
index 171b989..74558b9 100644 (file)
        "site-atom-feed": "Feed Atom de $1",
        "page-rss-feed": "Feed RSS pe \"$1\"",
        "page-atom-feed": "Feed Atom pe \"$1\"",
-       "red-link-title": "$1 (a pàgina no esiste)",
+       "red-link-title": "$1 (a pàgina a no existe)",
        "sort-descending": "Ordine decrescente",
        "sort-ascending": "Ordine crescente",
        "nstab-main": "Pàgina",
        "userlogin-yourname-ph": "Inserisci o teu nómme uténte",
        "createacct-another-username-ph": "Scrivi o teu nomme utente",
        "yourpassword": "Pòula segretta:",
-       "userlogin-yourpassword": "Ciâve",
+       "userlogin-yourpassword": "Inserisci a teu ciâve",
        "userlogin-yourpassword-ph": "Scrivi a tu poula segretta.",
        "createacct-yourpassword-ph": "Scrivi 'na poula segretta.",
        "yourpasswordagain": "Riscrivi a pòula segrétta:",
        "emailuserfooter": "Questa email a l'è stæta {{GENDER:$1|inviâ}} da $1 a {{GENDER:$2|$2}} a traverso a fonçion \"{{int:emailuser}}\" insce {{SITENAME}}. Se {{GENDER:$2|ti ghe rispondi}}, a to email de risposta a saiâ spedia direttamente {{GENDER:$1|a-o|a-a}} mittente originâ, rivelando{{GENDER:$1|ghe}} o {{GENDER:$2|to}} adresso de posta elettronica.",
        "usermessage-summary": "Messaggio de scistema",
        "usermessage-editor": "Messaggê de scistema",
-       "watchlist": "Ã\92servòi speciâli",
-       "mywatchlist": "òservòi speciâli",
+       "watchlist": "Ã\92servæ speciâli",
+       "mywatchlist": "òservæ speciâli",
        "watchlistfor2": "Pe $1 $2",
        "nowatchlist": "A lista di öservæ speciali a l'è voeua.",
        "watchlistanontext": "Pe vixualizzâ e modificâ l'elenco di öservæ l'è necessaio eseguî l'accesso.",
index 1c96495..ff62ec0 100644 (file)
        "watchlist-details": "Tu uzraugi $1 {{PLURAL:$1|lapas|lapu|lapas}} (neieskaitot diskusiju lapas).",
        "wlheader-enotif": "E-pasta paziņojumi ir ieslēgti.",
        "wlheader-showupdated": "Lapas, kas ir tikušas izmainītas, kopš pēdējoreiz skatījies tās, tiek rādītas <strong>trekninātā</strong> rakstā.",
+       "wlnote": "Zemāk {{PLURAL:$1|redzamas <strong>$1</strong> izmaiņas|redzama <strong>$1</strong> izmaiņa|redzamas <strong>$1</strong> izmaiņas}} {{PLURAL:$2|pēdējās <strong>$2</strong> stundās|pēdējā <strong>$2</strong> stundā|pēdējās <strong>$2</strong> stundās}} uz $3 $4.",
        "wlshowlast": "Rādīt pēdējās $1 stundas $2 dienas",
        "watchlist-hide": "Slēpt",
        "watchlist-submit": "Rādīt",
index 58bd82f..92efb1e 100644 (file)
        "rcfilters-watchlist-markseen-button": "Oznacz wszystkie zmiany jako obejrzane",
        "rcfilters-watchlist-edit-watchlist-button": "Edytuj swoją listę obserwowanych stron",
        "rcfilters-watchlist-showupdated": "<strong>Wytłuszczono</strong> strony, których nie odwiedził{{GENDER:|e|a|e}}ś od czasu zapisania ostatnich zmian.",
-       "rcfilters-preference-label": "Wyłącz ulepszenia strony Ostatnie zmiany",
+       "rcfilters-preference-label": "Wyłącz ulepszenia strony Ostatnich zmian",
        "rcfilters-preference-help": "Wycofuje wszystkie zmiany interfejsu z 2017 i narzędzia dodane od tamtej pory.",
        "rcfilters-filter-showlinkedfrom-label": "Pokaż zmiany na stronach linkowanych z",
        "rcfilters-filter-showlinkedfrom-option-label": "<strong>Strony linkowane z</strong> zaznaczonej strony",
index f1e57fa..03701e7 100644 (file)
        "log-action-filter-managetags-activate": "активирање ознаке",
        "log-action-filter-managetags-deactivate": "деактивирање ознаке",
        "log-action-filter-move-move": "премештање без преснимавања преусмерења",
-       "log-action-filter-move-move_redir": "Ð\9fÑ\80емеÑ\88Ñ\82аÑ\9aе Ñ\81а Ð¿Ñ\80епиÑ\81ивањем преусмерења",
+       "log-action-filter-move-move_redir": "пÑ\80емеÑ\88Ñ\82аÑ\9aе Ñ\81а Ð¿Ñ\80еÑ\81нимавањем преусмерења",
        "log-action-filter-newusers-create": "отворио анониман корисник",
        "log-action-filter-newusers-create2": "отворио регистрован корисник",
        "log-action-filter-newusers-autocreate": "аутоматски отворен",
        "log-action-filter-protect-protect": "закључавање",
        "log-action-filter-protect-modify": "измена закључавања",
        "log-action-filter-protect-unprotect": "уклањање закључавања",
-       "log-action-filter-protect-move_prot": "Ð\9fремештање заштите",
+       "log-action-filter-protect-move_prot": "премештање заштите",
        "log-action-filter-rights-rights": "ручно",
        "log-action-filter-rights-autopromote": "аутоматски",
-       "log-action-filter-upload-upload": "Ð\9dово отпремање",
+       "log-action-filter-upload-upload": "ново отпремање",
        "log-action-filter-upload-overwrite": "промена постојећег",
        "authmanager-authplugin-setpass-failed-title": "Неуспешна промена лозинке",
        "authmanager-email-label": "Имејл",
index 467e68b..b9dd55a 100644 (file)
        "mw-widgets-usersmultiselect-placeholder": "Dodaj još...",
        "randomrootpage": "Slučajna korenska stranica",
        "log-action-filter-all": "Sve",
-       "log-action-filter-move-move_redir": "Premeštanje sa prepisivanjem preusmerenja",
-       "log-action-filter-protect-move_prot": "Premeštanje zaštite",
-       "log-action-filter-upload-upload": "Novo otpremanje",
+       "log-action-filter-move-move_redir": "premeštanje sa presnimavanjem preusmerenja",
+       "log-action-filter-protect-move_prot": "premeštanje zaštite",
+       "log-action-filter-upload-upload": "novo otpremanje",
        "authmanager-email-label": "Imejl",
        "authmanager-email-help": "Imejl adresa",
        "changecredentials": "Promjena akreditiva",
index 21fad5e..21c55c7 100644 (file)
                edit: function ( title, transform ) {
                        var basetimestamp, curtimestamp,
                                api = this;
+
+                       title = String( title );
+
                        return api.get( {
                                action: 'query',
                                prop: 'revisions',
                                rvprop: [ 'content', 'timestamp' ],
-                               titles: String( title ),
+                               titles: [ title ],
                                formatversion: '2',
                                curtimestamp: true
                        } )
                                                return $.Deferred().reject( 'unknown' );
                                        }
                                        page = data.query.pages[ 0 ];
-                                       if ( !page || page.missing ) {
+                                       if ( !page || page.invalid ) {
+                                               return $.Deferred().reject( 'invalidtitle' );
+                                       }
+                                       if ( page.missing ) {
                                                return $.Deferred().reject( 'nocreate-missing' );
                                        }
                                        revision = page.revisions[ 0 ];
index 8e07b5e..796d459 100644 (file)
@@ -33,6 +33,12 @@ class ClassCollectorTest extends PHPUnit_Framework_TestCase {
                                "class_alias( Foo::class, 'Bar' );",
                                [ 'Bar' ],
                        ],
+                       [
+                               // Namespaced class is not currently supported. Must use namespace declaration
+                               // earlier in the file.
+                               "class_alias( Example\Foo::class, 'Bar' );",
+                               [],
+                       ],
                        [
                                "namespace Example;\nclass Foo {}\nclass_alias( Foo::class, 'Bar' );",
                                [ 'Example\Foo', 'Bar' ],
index 13d7dcc..4ce7c5d 100644 (file)
                        } );
        } );
 
+       QUnit.test( 'edit( mw.Title, transform String )', function ( assert ) {
+               this.server.respond( function ( req ) {
+                       if ( /query.+titles=Sandbox/.test( req.url ) ) {
+                               req.respond( 200, { 'Content-Type': 'application/json' }, JSON.stringify( {
+                                       curtimestamp: '2016-01-02T12:00:00Z',
+                                       query: {
+                                               pages: [ {
+                                                       pageid: 1,
+                                                       ns: 0,
+                                                       title: 'Sandbox',
+                                                       revisions: [ {
+                                                               timestamp: '2016-01-01T12:00:00Z',
+                                                               contentformat: 'text/x-wiki',
+                                                               contentmodel: 'wikitext',
+                                                               content: 'Sand.'
+                                                       } ]
+                                               } ]
+                                       }
+                               } ) );
+                       }
+                       if ( /edit.+basetimestamp=2016-01-01.+starttimestamp=2016-01-02.+text=Box%2E/.test( req.requestBody ) ) {
+                               req.respond( 200, { 'Content-Type': 'application/json' }, JSON.stringify( {
+                                       edit: {
+                                               result: 'Success',
+                                               oldrevid: 11,
+                                               newrevid: 13,
+                                               newtimestamp: '2016-01-03T12:00:00Z'
+                                       }
+                               } ) );
+                       }
+               } );
+
+               return new mw.Api()
+                       .edit( new mw.Title( 'Sandbox' ), function ( revision ) {
+                               return revision.content.replace( 'Sand', 'Box' );
+                       } )
+                       .then( function ( edit ) {
+                               assert.equal( edit.newrevid, 13 );
+                       } );
+       } );
+
        QUnit.test( 'edit( title, transform Promise )', function ( assert ) {
                this.server.respond( function ( req ) {
                        if ( /query.+titles=Async/.test( req.url ) ) {
                        } );
        } );
 
+       QUnit.test( 'edit( invalid-title, transform String )', function ( assert ) {
+               this.server.respond( function ( req ) {
+                       if ( /query.+titles=%1F%7C/.test( req.url ) ) {
+                               req.respond( 200, { 'Content-Type': 'application/json' }, JSON.stringify( {
+                                       query: {
+                                               pages: [ {
+                                                       title: '|',
+                                                       invalidreason: 'The requested page title contains invalid characters: "|".',
+                                                       invalid: true
+                                               } ]
+                                       }
+                               } ) );
+                       }
+               } );
+
+               return new mw.Api()
+                       .edit( '|', function ( revision ) {
+                               return revision.content.replace( 'Sand', 'Box' );
+                       } )
+                       .then( function () {
+                               return $.Deferred().reject( 'Unexpected success' );
+                       }, function ( reason ) {
+                               assert.equal( reason, 'invalidtitle' );
+                       } );
+       } );
+
        QUnit.test( 'create( title, content )', function ( assert ) {
                this.server.respond( function ( req ) {
                        if ( /edit.+text=Sand/.test( req.requestBody ) ) {