Commit graph

113 commits

Author SHA1 Message Date
Alexandre Emsenhuber
77fe134b08 Also call $this->clear() from WikiPage::doDeleteUpdates() so that the object is in a consistent state after deletion 2012-02-14 15:06:13 +00:00
Jeroen De Dauw
abfdd0b617 fix doc 2012-02-13 19:13:30 +00:00
Sam Reed
c052fc3b7b Documentation followups from lastnight 2012-02-10 15:37:33 +00:00
Sam Reed
09a78c1368 More return documentation 2012-02-09 21:36:14 +00:00
Sam Reed
0a626db6e1 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:29:36 +00:00
Sam Reed
85bbb0b080 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 18:01:10 +00:00
Max Semenik
efb855cb88 Fix my stupid mistake in r110750 that resulted in fake "can't delete page" errors (bug 34245) 2012-02-08 18:07:41 +00:00
Max Semenik
ad5292af60 Follow-up r110750: move constants to a different class per CR 2012-02-07 09:40:08 +00:00
Max Semenik
5dd5b558e3 Fixed r63018: made it possible to delte half-baked images w/o descriptions, clearer error message 2012-02-06 15:21:10 +00:00
Alexandre Emsenhuber
7f53e62508 * Use $this->getRevision() to get the latest revision instead of loading it each time from the database
* Moved wfGetDB( DB_MASTER ) a bit after so that it is only called when needed
2012-02-05 18:45:07 +00:00
Alexandre Emsenhuber
afab06cc73 wfTime() -> microtime( true ), no need to use the former which is just a wrapper to the latter 2012-02-03 08:32:34 +00:00
Antoine Musso
fc6bc233be Fix doxygen docs before REL1_19 branching 2012-02-01 20:53:38 +00:00
Alexandre Emsenhuber
829dd6ef9d * Group related functions
* Moved isCountable() and redirect-related function a bit downward
2012-01-27 21:13:25 +00:00
Alexandre Emsenhuber
16ec2100de * Do the page existence check before calling ignore_user_abort() so that we don't return after having modified that value
* Change the check to use $oldid since we already have the result of getLatest()
2012-01-26 16:44:29 +00:00
Alexandre Emsenhuber
b1d0376c1e Fix bug 32948:
* {{REVISIONID}} and related variables are no longer blank after doing a null edit
* {{REVISIONID}} and related variables are no longer blank after calling action=purge&forcelinkupdate
2012-01-21 07:59:25 +00:00
Alexandre Emsenhuber
da4780c12e * Use WikiPage instead of Article to call commitRollback()
* Pass the User object from WikiPage::commitRollback() to WikiPage::doEdit()
* Do the edits with 'Maintenance script' user as other maintenance scripts instead of 127.0.0.1
2012-01-14 14:11:08 +00:00
Aaron Schulz
5a6559d8b1 Reverted r108743 per CR comment. This should at least be discussed first. 2012-01-12 19:41:18 +00:00
Sam Reed
a5c200a25b Kill "* @return void" 2012-01-12 19:12:24 +00:00
Platonides
99f352e556 Profile all returns (r107319 follow-up) 2012-01-07 23:23:29 +00:00
Alexandre Emsenhuber
a02ee030e7 Simplify the check to make it more understandable 2012-01-07 16:58:56 +00:00
Alexandre Emsenhuber
c9df79c484 Cleanup in WikiPage::getRedirectURL():
* Call Title::isValidRedirectTarget() in case of special page instead of checking only for Special:Userlogout
* Refactor the code a bit to be more readable and remove unneeded nested conditions
2012-01-07 15:48:42 +00:00
Alexandre Emsenhuber
99fde665ed Revert r105790 and move back view counter back to WikiPage with two modifications:
* WikiPage::$mCounter is now marked as protected
* Call WikiPage::loadPageData() from WikiPage::getCount() if the count is not set intead of loading the page_counter field only
2012-01-06 20:26:53 +00:00
Alexandre Emsenhuber
36071ad2a5 Fix for r107945: also partially revert r107842 2012-01-04 08:24:11 +00:00
Brion Vibber
0bbf9a45b0 Revert r107769, r107771, r107825, r107840, r107927, r107934
Title objects are meant to be dumb value objects; we shouldn't add to their internal state like this, but should be working to remove the bits already in there like the article ID.
Preloading information like this can make sense, but probably belongs in WikiPage, not Title.
2012-01-03 21:44:41 +00:00
Alexandre Emsenhuber
e40e80e74e Per Aaron, fix for r107771: Title::getTouched() should return false on non-existing page 2012-01-03 20:15:45 +00:00
Alexandre Emsenhuber
17230f6a4e Give Title a decent loading mechanism:
* Added Title::load() to factorise common code that load member variables instead of having each accessor doing it own loading system for its related member variable
* Removed usage of LinkCache::addLinkObj() to do the database query and do this directly in Title::load(). This allows to select the complete database row and populate all member variables; previously, requesting a field not stored in LinkCache (using getCount(), getTouched() or isNewPage()) results in two database query, one to load LinkCache data and the second to load the requested field; now there'll be only one query.
* Added Title::FIELD_IN_LINKCACHE and Title::FIELD_NOT_IN_LINKCACHE to specify whether the requested field is stored in LinkCache or not. LinkCache will be used if possible (i.e. Title::FIELD_IN_LINKCACHE is passed), otherwise a DB query to select the complete row is issued.
* Made Title::loadFromRow() save the row to LinkCache if possible.
* Added $wasFromMaster parameter to Title::loadFromRow() to tell that method whether the row was loaded from the master database or not and pass it from WikiPage::loadPageData()
* Added Title::GAID_USE_MASTER in addition to Title::GAID_FOR_UPDATE to get the row from the master database without having to do a SELECT FROM UPDATE query
* Added Title::selectFields() method to return the fields to select to given Title::loadFromRow() (and methods using it such as Title::newFromRow()) a complete row
* Made Title::$mCounter private since it has only been added recently (in r105790)
* Mark the object as loaded if Title::resetArticleID() is called with as new ID as 0
2012-01-03 19:28:03 +00:00
Niklas Laxström
ba5cc24eb4 Typofix r107842 2012-01-02 18:22:26 +00:00
Alexandre Emsenhuber
f59b944ab1 * Removed WikiPage::$mTouched and use the value from Title; that member is not used anywhere else and is marked protected
* Fix some spaces and added description for WikiPage::$mTouched
2012-01-02 17:26:47 +00:00
Alexandre Emsenhuber
68bf1a77b4 * Store the value of the page.page_restrictions field in Title::loadFromRow() and defers loading restrictions until when it's really needed; this reuses the Title::$mOldRestrictions member which is not used anywhere yet
* Removed $oldFashionedRestrictions parameter from Title::loadRestrictions*(); the only extension using it is LiquidThreads and it's using Title::newFromRow() to create the Title object, so the field is already cached (and this even allows to cache that field when there's no row for that page in the page_restrictions table)
* Also reset $mTouched and $mIsNew members on resetArticleId() calls
* Updated FakeTitle a bit
2012-01-02 12:49:50 +00:00
Alexandre Emsenhuber
40addf3204 * Moved post-deletion code from WikiPage::doDeleteArticle() to WikiPage::doDeleteUpdates() so that it can be shared with page move
* Use WikiPage::doEditUpdates() and WikiPage::onArticleDelete() to do updates instead of reimplementing the whole thing in Title::moveTo(); avoids some bugs since the implementation differs from the one from WikiPage (notably the page and article count). This adds some more cache clearing, but they are needed depending on parameters (e.g. if the redirect is not created).
2011-12-30 15:54:11 +00:00
Alexandre Emsenhuber
1b655a802a * Added Title::getLinksFrom() and Title::getTemplateLinksFrom() for consistency with Title::getLinksTo() and Title::getTemplateLinksTo()
* Deprecated WikiPage::getUsedTemplates() in favour of Title::getTemplateLinksFrom() and updated to it in core
2011-12-29 15:12:00 +00:00
Alexandre Emsenhuber
7654ddf798 * Group related functions
* Put deprecated functions at the bottom
2011-12-29 14:21:15 +00:00
Tim Starling
28482987fb Revert the fix for bug 32858 (r105664, r105161, r103476): no consensus, backwards compatibility issues not addressed (e.g. {{selfsubst/now string}}) 2011-12-27 22:50:10 +00:00
Alexandre Emsenhuber
4f68ae8939 * Integrate $wgDeleteRevisionsLimit in Title::getUserPermissionsErrors() (only if doing expensive checks)
* Moved WikiPage::estimateRevisionCount() and WikiPage::isBigDeletion() to Title and marked those WikiPage methods as deprecated (only call in extensions removed in r107385)
* Show an error message when deleting a page to move another one in Special:MovePage and the deletion fails due to permissions errors (previously the form would simply show again)
* Cache the result of Title::estimateRevisionCount() since it's called two times when showing the deletion form and the user doesn't have 'bigdelete' right (one for the permissions check and the other when showing the number of revisions)
2011-12-27 15:29:44 +00:00
Alexandre Emsenhuber
6d10567e62 * (bug 30711) WikiPage::replaceSection() now always the current text when adding a new section
* Made WikiPage::replaceSection() use getRawText() to get the current text
* Made EditPage::showDiff() also use the current text when diffing for adding a new section
* Removed the "You are editing an old version" when section=new since the oldid parameter has no effect new due to the above
2011-12-26 14:45:58 +00:00
Alexandre Emsenhuber
b5066db963 Follow-up r106567: pass the User object to LogPage::addEntry(); was breaking protect.php maintenance script 2011-12-26 14:15:42 +00:00
Ryan Kaldari
9f5877af5c follow-up to r106754 - using strict comparison, adding logic for editing existing pages, changing parameter name in WikiPage::replaceSection from $summary to $sectionTitle as it only used for section titling 2011-12-20 23:50:15 +00:00
Alexandre Emsenhuber
46c5d3edad * Merged WikiPage::updateRestrictions() and Title::updateTitleProtection() into WikiPage::doUpdateRestrictions(); older methods still work for backward compatibility, but marked Title::updateTitleProtection() as deprecated and for removal in 1.20 since no extension calls it
* Removed permissions check from WikiPage::doUpdateRestrictions() and left it for callers, resolves the todo from documentation
* Inverted $expiry and $reason parameter between WikiPage::doUpdateRestrictions() and WikiPage::updateRestrictions() for more consistency; WikiPage::doUpdateRestrictions() also requires all parameters to be passed
* WikiPage::doUpdateRestrictions() returns a Status object instead of bool for the older one; only possible error at the moment is a read-only database
* Updated core calls to these functions
* Made maintenance scripts using it simply protect all actions returned by Title::getRestrictionTypes() instead of hardcoded 'edit' and 'move'
* This also means that protect.php can be used to protect a non-existing page for creation
2011-12-18 16:01:31 +00:00
Jeroen De Dauw
0b105ebf1d added missing deprecation notices 2011-12-13 19:51:03 +00:00
Alexandre Emsenhuber
87ebe89bed Moved view count from WikiPage to Title; avoids an extra DB query when showing the view count in SkinTemplate::outputPage() (since it's not the same WikiPage object) 2011-12-11 11:30:11 +00:00
Alexandre Emsenhuber
81ea10b635 * Changed WikiPage::exists() to call Title::exists()
* Changed some getId() calls to exists() and call that method directly on $mTitle
2011-12-10 09:35:03 +00:00
Tim Starling
71e27e22de * Revert r103476, r105161 and implement the fix for bug 32858 (a.k.a. bug 32450) in WikiPage instead. See comment 14 for further rationale.
* Clarified release notes. Please write what the new code does, not the bug description.
2011-12-09 10:32:55 +00:00
Platonides
0461342d2c Unused $wgParser. Fix comment 2011-11-30 23:06:18 +00:00
Chad Horohoe
7914b2ee68 (bug 29475) Remove "trackback" feature entirely from core. This has been disabled-by-default since its inception and nobody uses it.
If someone really really wants this, they can write an extension.

Language files need rebuilding, but I took care of En and messages.inc.
2011-11-23 17:14:03 +00:00
Roan Kattouw
792c38f424 (bug 26854) Invalid user names go unchecked. Applied most of the patch submitted by Søren Løvborg, checking for null return values from User::newFromName() 2011-11-20 10:55:58 +00:00
Alexandre Emsenhuber
e725d56451 Fix for r103502: make PoolWorkArticleView::doWork() return true when the parse is successful; also fixed getIsDirty() to return the member parameter and not try to execute a non-existing function 2011-11-18 07:10:03 +00:00
Alexandre Emsenhuber
dd58309f1a * Added WikiPage::getParserOutput() and changed Article::getParserOutput() to use it
* WikiPage::getParserOutput() requires a ParserOptions object (and optionally the revision ID) instead of an User object, removes an hidden dependency on $wgLang. For this reason, WikiPage::isParserCacheUsed() now also uses a ParserOptions object instead of an User object (doesn't change anything in the code except the variable name and it's not called in extensions)
* Moved PoolWorkArticleView to WikiPage.php and added an entry in the AutoLoader and moved output-related stuff directly in Article::view() so that in can be shared with WikiPage::getParserOutput() (removes code duplication, etc.)
* Added the revision ID to the PoolCounter key so that it knows which revision is being parsed and doesn't wait for another parse operation with same options but different revisions
* Removed Article::doViewParse(), Article::tryDirtyCache() and Article::getOutputFromWikitext() since they are now integrated in PoolWorkArticleView and Article::view() and there are no callers in extensions. This also fixes a bug since Article::doViewParse() will get another ParserOptions instance with special options set in Article::view() not be repercuted.
* Updated DifferenceEngine to use the new system
* Updated docs/memcached.txt to correct method names
2011-11-17 20:21:54 +00:00
Mark A. Hershberger
171ac0a31b Apply cryptocoryne's patch from Bug 32454 - ArticlePurge hook is broken after r86041 2011-11-17 16:00:41 +00:00
Alexandre Emsenhuber
610d68c3c3 * Put the LinkCache update in WikiPage::updateRevisionOn() so that we are sure that it is executed every time that function get called (and the update succeeds of course); and removed the call to Title::resetArticleID() which is already done by insertOn()
* Also update $this->mLatest and $this->mIsRedirect in updateRevisionOn() (will use this in ApiEditPage to have to create another istance just to grab the new revision ID)
* In WikiPage::doEdit(), get the current latest before going through the process since it's now updated in updateRevisionOn() (would break RecentChange::notifyEdit() otherwise) and pass the current redirect state to use the optimisation in updateRedirectOn() if possible
2011-11-16 21:03:06 +00:00
Alexandre Emsenhuber
018d885f64 Deprecated WikiPage::preSaveTransform() in favour of Parser::preSaveTransform() and updated callers; added wfDeprecated() call since there are no callers in extensions 2011-11-15 21:46:05 +00:00