Commit graph

1120 commits

Author SHA1 Message Date
Tyler Anthony Romeo
af68ecea64 (bug 40541) Fixed minor code style problems.
Follow-up to I17ac68014840daa47bfd4768e978e9ff2edb00db.
Replaces some ==/!= with ===/!== and other code style
changes mentioned in Gerrit comments on previous patchset.

Change-Id: I50da16bc62241491ac5c4948e0d3059b21f113dc
2012-09-30 21:23:05 -04:00
Tyler Anthony Romeo
0a1e291036 Added protocol option to Linker and OutputPage::addReturnTo.
Added new argument to the Linker options array to allow
the forcing of an HTTP or HTTPS protocol. In order to facilitate
this, a protocol argument was added to Title::getLinkURL.

Also, an options argument was added to OutputPage::addReturnTo
so that options can be passed to the linker and so that the
returnto URL can be forced to a certain protocol.

Change-Id: Ia9cc11e310ad6ef23c221bdba3a4834e7c5556e7
2012-09-27 13:47:42 -04:00
Aaron Schulz
dcdb56b3f6 Merge "Limit the Title backlink cache to two instances." 2012-09-11 06:22:44 +00:00
umherirrender
d7720f1960 Fix Title::getRedirectsHere to respect interwiki prefix
Respecting rd_interwiki is needed to act the same way than
Special:Whatlinkshere. For local redirects it is needed to also check
for NULL, not only the empty string

Change-Id: I4f3f242d69054dcbb3c7a02441991196ba140986
2012-09-08 06:57:10 +02:00
Hashar
89a055491c Merge "'lang' attrib in #mw-content-text should be set to variant code." 2012-09-04 15:04:52 +00:00
Liangent
da43314022 'lang' attrib in #mw-content-text should be set to variant code.
Change-Id: I15cd8c102991c5007b43e06939a0c1a7593d0933
2012-09-04 17:00:27 +02:00
Aaron Schulz
af89b09a06 Limit the Title backlink cache to two instances.
Change-Id: I1e17a3de20d7c84a9818a850d4b7cc2898f72dc2
2012-09-03 12:45:50 -07:00
IAlex
bceb90ceed Merge "Replace deprecated wfMsg* calls with Message class calls." 2012-08-31 13:15:45 +00:00
Aaron Schulz
a53de31828 Added explicit DB flags for Revision loading calls.
Change-Id: Ie90d4197ad7a16009c96273eeae1a658678a8200
2012-08-29 20:04:30 -07:00
Siebrand Mazeland
01788cddd3 Replace deprecated wfMsg* calls with Message class calls.
Last round of easy replacements. About 30 uses in core remain (outside of HISTORY
and GlobalFunctions::wfMsg*). I'll work with IAlex and Nikerabbit to work towards
getting rid of those, too.

Updated method documentation in a few places.

Change-Id: I2491c006b62a9cc183230e31a0bd96c91e5b6142
2012-08-27 20:44:47 +02:00
Tyler Romeo
4893afd833 (bug 31040) Fixed $wgSecureLogin effect on returnto.
Added parameter to Title::getFullURL to allow specification
of a protocol rather than assuming PROTO_RELATIVE. Also
added an accompanying parameter to Skin::makeSpecialUrl
to make a link for a specific protocol.

Cleaned up the creation of personal URLs in SkinTemplate.php
so that when $wgSecureLogin is enabled, the returnto
query is not lost in the process.

Note: This will only work if $wgServer is set to a
protocol relative URL.

Change-Id: Iba48eb3620fb3a721220364185f7abfd902412d0
Signed-off-by: Tyler Romeo <tylerromeo@gmail.com>
2012-08-13 08:53:43 -04:00
Aaron Schulz
1690388847 Merge "(bug 12701) Use diff of all unseen revisions in the "new messages" bar." 2012-08-09 16:59:57 +00:00
Catrope
e23e3a3c79 Fix bug in moveTo() with $auth=false and $createRedirect=false
Even when $auth=false, moveToInternal() would unconditionally check
$wgUser's 'suppressredirect' permissions and override $createRedirect.
This means it was impossible to suppress redirect creation when moving
pages in a maintenance script, even when telling moveTo() to disable
permissions checks.

Fixed by moving the check from moveToInternal() up into moveTo() and
respecting $auth there

Change-Id: I9b52dc67c7ae2dbda3ca62f78d4d7df118771c0f
2012-07-19 15:48:05 -07:00
tomek
74cbd6b05f fix problem with retriving fresh LatestRevID when GAID_FOR_UPDATE
Change-Id: Idff009752da3336383a20581d79ffd231332f463
2012-07-11 13:12:58 -04:00
Siebrand
5fb8b96195 Merge "Expose the log_id of the deletion log entry in the action=delete API" 2012-07-01 15:55:29 +00:00
Alexandre Emsenhuber
58852d8827 Deprecated Title::userIsWatching(); use User::isWatched() instead.
* The problem is that Title::userIsWatching() relies on $wgUser,
  which is not suitable on every case. Instead User::isWatched()
  requires both an User and a Title object.
* Replaced all core calls from the former to the latter
* Added a cache in User for the WatchedItem instances so we do not
  need to do a database request every time something want to know
  whether a page is watched or not, which can happen several times
  per request.

Change-Id: Ifa9c55b7ffb487ce6893c74df233eedc7654dc5e
2012-06-29 23:22:35 +02:00
Aaron Schulz
938d6ec732 Merge "Purge Squid variant pages based on page language (not $wgContLang)" 2012-06-28 22:23:42 +00:00
lupo
b082e920b1 (bug 12701) Use diff of all unseen revisions in the "new messages" bar.
Also pluralize properly.

"You have a new message from another user (last change)"
if only one unseen revision, or
"You have new messages [from another user|from N users|]
(last changes)" if there are several unseen revisions.

Contains a fix in Title::countAuthorsBetween() adding options to include
(one or both of) the delimiting revisions in the count.

Change-Id: I8870111802085d0bd188cb508c4f4b852985634d
2012-06-18 08:43:47 +02:00
Liangent
30036a10e9 Do proper conversion table detection.
MediaWiki:NotConversiontable/zh-cn and
MediaWiki:Conversiontable2/zh-cn are not conversion tables.

Change-Id: Id132330e20e1a33985aa336b1c26268b036f2dad
2012-06-11 00:21:13 +08:00
Liangent
f70f8b6c3b Purge Squid variant pages based on page language (not $wgContLang)
This reverts commit 10c37d58fe.

Change-Id: I60985a2c3914308102cfc11544abc409ab8b860a
2012-06-04 13:06:08 +08:00
Aaron Schulz
10c37d58fe Revert "Purge Squid variant pages based on page language (not $wgContLang)" per CR comments. I merged this one too quickly.
This reverts commit 0f9b9d5144
2012-06-03 21:07:58 +00:00
Liangent
0f9b9d5144 Purge Squid variant pages based on page language (not $wgContLang)
Change-Id: I36a55d0de33dd199513b94741b1833e8e0543b95
2012-06-04 01:39:55 +08:00
Brion VIBBER
0d22edd27b Merge "Revert "Adding sanity check to Title::isRedirect()."" 2012-06-03 11:03:20 +00:00
Brion VIBBER
d7f7a6234b Revert "Adding sanity check to Title::isRedirect()."
This reverts commit 7d12b7b72c
2012-06-03 11:00:54 +00:00
Aaron Schulz
2f3004af8e Merge "Adding sanity check to Title::isRedirect()." 2012-05-29 17:29:19 +00:00
daniel
7d12b7b72c Adding sanity check to Title::isRedirect().
isRedirect() assumes that the LinkCache already contains
information about this title. If that is not the case, it
currently returns false, even though it just doesn't know
whether this link is a redirect.

The new check asserts the assumption that this title
is already known to the link cache.

Amend: use Exception instead of assert()

Change-Id: Id3ad2d4e140b270b1f5ca1f7af9b3320cffff5a2
2012-05-29 15:39:43 +02:00
umherirrender
beccc67e36 Title.php: replace some '*' with explicit fields in selects
It is good practice to select only fields, which are used later

Change-Id: I4e765d60aea3c11261497346a85e65ed755a085d
2012-05-25 16:55:25 +02:00
Aaron Schulz
2f5914c2ce Merge "Title::moveToInternal doesn't return anything, but it does throw an exception" 2012-05-19 07:55:54 +00:00
umherirrender
7b8e963c88 empty string test for old page_restricions entries
some old page_restricions entries are move=:edit=,
which result in any empty string as level in the JS var
wgRestrictionEdit

Checking wgRestrictionEdit.length is than not possible

Change-Id: I250b4f9bda60361d4cd8c3139b17b299fec0a718
2012-05-16 21:14:40 +02:00
Catrope
3068742546 Expose the log_id of the deletion log entry in the action=delete API
This entails some refactoring to actually surface the log_id all the way
up:

* Made doDeleteArticleReal() return a Status object rather than a
  constant, and put the log_id in $status->value. This Status object is
  also passed to the ArticleDelete hook.
* Kept doDeleteArticle() the same for extension compatibility.
* Switched all core callers of doDeleteArticle() to
  doDeleteArticleReal() and surfaced the error message from the Status
  if appropriate, rather than hardcoding 'cannotdelete' all over the
  place.
* Exposed the log_id in ApiDelete
* Add 'delete-hook-aborted' message for when a hook aborts the deletion
  but does not provide an error message. Previously this just caused the
  'cannotdelete' message to appear.

Change-Id: Ia6415b390d5d4172ce96667f46ccdba2be02461f
2012-05-13 18:20:05 -07:00
Alexandre Emsenhuber
2040d1337e Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Ib46e50da4ec649a6a06cbeed00752effb79ed06e
2012-05-09 20:11:36 +02:00
Siebrand
a15243f15d Merge "Pass the result of the database queries in Title::getPreviousRevisionID() and Title::getNextRevisionID() into intval()." 2012-05-07 10:22:46 +00:00
umherirrender
fafd3e0b26 Use Title::legalChars()
Change-Id: I6b29f29875fa54196b5899042a8f576c82a8943f
2012-05-04 21:47:00 +02:00
Aaron Schulz
73737df4a4 Merge "Noticed while looking at $wgShowUpdatedMarker related database queries, queries not using index order at all. Fixed up" 2012-05-03 18:25:18 +00:00
Alexandre Emsenhuber
5e7c414018 Pass the result of the database queries in Title::getPreviousRevisionID() and Title::getNextRevisionID() into intval().
No idea why mysql_fetch_object() returns string when the field in defined as integer, but it is so on my machine...

Change-Id: I353c6087d20d7a72d6d4b39bdc477b094bc460f6
2012-05-02 10:52:51 +02:00
Reedy
5813680952 Few documentation/type hint updates
Change-Id: Ib2882cc03540403f74f68854fa76df375c1bb25a
2012-05-01 22:03:50 +01:00
Reedy
3f4e41a24e Noticed while looking at $wgShowUpdatedMarker related database queries, queries not using index order at all. Fixed up
Title.php at line 4313:
			array( 'wl_namespace' => $this->getNamespace(),
				'wl_title' => $this->getDBkey(),
				'wl_user' => $user->getId()
			),

In UserMailer.php at line 438:

array(
					'wl_title' => $title->getDBkey(),
					'wl_namespace' => $title->getNamespace(),
					'wl_user != ' . intval( $editor->getID() ),
					'wl_notificationtimestamp IS NULL',
				)

And line 455:

array( /* WHERE */
						'wl_title' => $title->getDBkey(),
						'wl_namespace' => $title->getNamespace(),
						'wl_user' => $watchers
					)

CREATE TABLE /*_*/watchlist (
  -- Key to user.user_id
  wl_user int unsigned NOT NULL,

  -- Key to page_namespace/page_title
  -- Note that users may watch pages which do not exist yet,
  -- or existed in the past but have been deleted.
  wl_namespace int NOT NULL default 0,
  wl_title varchar(255) binary NOT NULL default '',

  -- Timestamp when user was last sent a notification e-mail;
  -- cleared when the user visits the page.
  wl_notificationtimestamp varbinary(14)

) /*$wgDBTableOptions*/;

CREATE UNIQUE INDEX /*i*/wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title);
CREATE INDEX /*i*/namespace_title ON /*_*/watchlist (wl_namespace, wl_title);

Change-Id: I633c009b4a1c614b966c69f042f94c2056e03784
2012-04-28 00:59:59 +01:00
umherirrender
4989ddd423 strip off subpages direct in GenderCache
LinkBatch can also give subpages to the GenderCache and therefor it is
easier to do it always in GenderCache, than in LinkBatch and Title

Add unit tests for GenderCache

Change-Id: Ia936ff8bb639a197b0b3a8e07c97a66edd57dd10
2012-04-21 10:34:22 +02:00
Reedy
9ae175d6c8 Title::moveToInternal doesn't return anything, but it does throw an exception
Means the evaluation of if ( is_array( $err ) ) { is always going to be false

Update the documentation

Change-Id: I0016495563e715a2a1927e227ec2bb5c80b5378b
2012-04-11 20:00:29 +01:00
Alexandre Emsenhuber
9eb25dc032 Check for namespace existence in Title::makeTitleSafe().
Namespace existence has to be checked before calling Title::makeName() because otherwise it will fallback to a page with the same name, but in the main namespace which is not what we want here.

Change-Id: I8c087390044c54dd0502c1b8bb9321dfaec6b5f7
2012-04-11 14:37:27 +02:00
Sam Reed
2d25a902e3 More of r113580 2012-03-11 22:05:54 +00:00
Alexandre Emsenhuber
880477b0ad * (bug 34937) Fix for r107636: call WikiPage::onArticleCreate() when moving a page an not overriding the redirect 2012-03-03 16:36:37 +00:00
Aaron Schulz
1a9061d900 [Title] In moveToInternal(), just use getParentId() on the null revision object as the base ID rather than $latest. They should conceptually be the same but the former was already fetched with master data. 2012-03-03 12:46:58 +00:00
Amir E. Aharoni
f42c131076 Fixes bug 34723: applies the English language to CSS/JS both as a user subpage and a MediaWiki space page, and consequently applies LTR to JS and CSS in the textarea. 2012-02-26 11:39:49 +00:00
Alexandre Emsenhuber
3219219c29 Per Aaron, follow-up r112036: add __METHOD__ to DatabaseBase::rollback() too 2012-02-21 22:04:43 +00:00
Alexandre Emsenhuber
44bc2e7cc2 Pass __METHOD__ to DatabaseBase::begin() and DatabaseBase::commit() 2012-02-21 19:56:43 +00:00
Sam Reed
c8eb4467f1 Fix user related direct member variable access 2012-02-16 00:54:34 +00:00
Robin Pepermans
542bae9af9 add warning note to isKnown() per r111017 2012-02-12 23:42:39 +00:00
Jeroen De Dauw
6479096233 follow up to r111017, move hook to isAlwatsKnown as per discussion on CR 2012-02-12 23:10:06 +00:00
Antoine Musso
d5d1585900 revert r111234 (deprecated methods removal)
Reasons invoked by Rob Lanphier are:
* ongoing code slush
* backwards compatilibility issues
2012-02-12 19:25:28 +00:00