Manual:$wgArticle
Este recurso foi removido completamente na versão 1.23.0[1]. |
| Objeto global: $wgArticle | |
|---|---|
| Objeto Article (ou o objeto filho de Article) correspondente ao objeto Title | |
| Parâmetros: | $title |
| Depreciado na versão: | 1.19.0 |
| Removido na versão: | 1.23.0[1] |
| Classe: | Article |
| Localizado em: | Article.php, CategoryPage.php, ImagePage.php |
Detalhes
O objeto Article encapsula o acesso à tabela "page" do banco de dados. O objeto representa um artigo, e mantém o estado como texto (em formato Wiki texto), flags, etc.
Os objetos CategoryPage e ImagePage são objetos filhos do objeto Article, e são utilizados especificamente para páginas de categorias e páginas de imagens.
Substituição
Use the Context object to get what you need.
Since 1.19, Context objects have a getWikiPage() to access the corresponding WikiPage object.
Where you get this context object from depends on where your code is running.
Many major classes extend ContextSource, which means you can just do $someObject->getContext() to get the context and $someObject->getWikiPage() for the WikiPage object.
As of this writing that includes ApiBase, CategoryViewer, ChangesList, DerivativeContext, DifferenceEngine, HTMLForm, ImportReporter, IndexPager, OutputPage, RevisionListBase, Skin.
Some other classes support getContext() which don't have ContextSource as a parent class, such as SpecialPage (So if you're writing a SpecialPage, you can often do $this->getContext() to get the context).
Se você precisa usar um método que está em Article que não seja WikiPage e tem um objeto context, chamado $context, você pode usar Article::newFromTitle( $context->getTitle(), $context );, por favor, observe as seguintes coisas:
- A ID da revisão apresentada é acessível através de
OutputPage->getRevisionId()ouSkin->getRevisionId()e o fato de que esta é a versão atual da página que pode ser acessada através deSkin->isRevisionCurrent()(em vez deArticle->isCurrent()) - O texto da última revisão da página atual (não necessariamente da revisão exibida) está acessível através de
WikiPage->getRawText(); dependendo do propósito para o qual você usaArticle->getContent(), você pode preferir esta opção.
- The displayed revision's ID is accessible through
OutputPage->getRevisionId()orSkin->getRevisionId()and the fact that this is the current revision of the page can be accessed throughSkin->isRevisionCurrent()(instead ofArticle->isCurrent())
- The text of the latest revision of the current page (not necessarily of the displayed revision) is accessible through
WikiPage->getRawText(); depending on what you useArticle->getContent()for, you may prefer this one.
Sample Code
Use $article->getPage()->getContent()->getNativeData() to replace this.