Commit graph

57 commits

Author SHA1 Message Date
cenarium
d7a37e8daa Allow to pass a rev id to a log entry without making it unpatrolled
This adds new methods to ManualLogEntry that allow to specify that
a log entry is patrollable. RecentChange::newLogEntry then checks
this in order to allow or not unpatrolled status instead of checking
if there is an associated rev id. This allows to associate a revision
to a log entry without possibly making the recent change unpatrolled,
and extensions can implement patrol of actions not dependent on an
associated revision id.

Bug: T127848
Change-Id: I98298047142819b69639e6ca9d77c5ba982a380c
2016-03-14 16:11:05 +01:00
Geoffrey Mon
e70c4eb664 Add tags support to patrol, protect, unblock, and undelete
- Add 'tags' parameters to appropriate API modules
- Add tag-adding logic to appropriate functions that carry out
  relevant functions
- ManualLogEntry::{set,get}Tags to handle adding tags to log
  entries in a cleaner fashion
- Use ManualLogEntry::setTags in LocalFile::recordUpload2

Bug: T97720
Change-Id: I98c52da7985623bfdafda2dc2dae937b39b72419
2016-02-29 16:59:31 -05:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Bartosz Dziewoński
61c7852049 Make it possible to tag new file uploads without messy queries
UploadBase::performUpload() now takes a $tags parameter and passes it
to LocalFile::upload() and LocalFile::recordUpload2(), which
eventually adds the requested tags to the log_id, rev_id and rc_id
that are created for the file upload.

Previously you'd have to query the database for the latest rev_id and
log_id for the page title under which the title is being uploaded, as
performUpload() is unable to return them to you because it's all
deferred in funny ways.

Bug: T121874
Change-Id: I99a8fd67c84219d2715d3d88cc21500614431179
2016-01-25 20:06:53 +01:00
Bartosz Dziewoński
f66ff60244 LogEntry: Make associated rev id persistent (store in logging and log_search)
The implementation from 0160b410bd only
stored the associated rev id in the `recentchanges` table, which was
sufficient for its purpose of allowing patrol of these log entries and
provided some change tagging improvements, but ephemeral.

Now we also store it in `logging` and `log_search` tables, which makes
it possible to find a revision for the log entry and vice versa.

* For `log_search` we just add a row with 'associated_rev_id' as key,
  it was designed for exactly this purpose.
* For `logging` we store it in log_params field in ManualLogEntry, and
  transparently remove it from there when building a DatabaseLogEntry.

Bug: T122089
Change-Id: I559587ff77b3c94b31a6c5951287b6f9c1e167ce
2016-01-07 02:19:51 +00:00
Bartosz Dziewoński
c34682d3e9 LogEntry: Boring whitespace and comment changes, some documentation too
Change-Id: If501a3c276c3dc341ef73d5ffdb255f68cbe0ab7
2016-01-07 02:19:07 +00:00
cenarium
0160b410bd Option to associate a rev id to a RC log entry, allowing unpatrolled status
This provides a mechanism to associate a revision id to an action.
For example in core, it makes sense for moves and uploads, which both
generate null revisions (also protections, but it isn't interesting if one
has patrolling in mind).

Crucially, in that case an unpatrolled status is allowed for the RC item.
So if the performer of the action is not autopatrolled, it will be displayed
as unpatrolled, and if the performer is autopatrolled, it will record an
autopatrol action.

When one associates a rev id to a type of action, one should also implement
a mechanism to patrol said action, since getting the diff for the associated
revision is not user friendly and works only if RC patrol is enabled.
This is done for uploads in If71af58719a4461f12d125455b7bef07164525ca (with
a new file patrol) and for moves in Ie0fa417feaf930c096b69521fc54d57aecd6cd51
(within RC patrol).

Extensions might possess other such actions that could benefit from patrolling.

Bug: T122089
Change-Id: I694424eca32b69e277f89d4c15183870983d0993
2015-12-21 22:14:00 +00:00
Kunal Mehta
f6e5079a69 Use mediawiki/at-ease library for suppressing warnings
wfSuppressWarnings() and wfRestoreWarnings() were split out into a
separate library. All usages in core were replaced with the new
functions, and the wf* global functions are marked as deprecated.

Additionally, some uses of @ were replaced due to composer's autoloader
being loaded even earlier.

Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to
mediawiki/vendor.

Bug: T100923
Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
2015-06-11 18:49:29 +00:00
umherirrender
fd9feb907b Added LogEntryBase::extractParams/makeParamBlob
Centralize the serialize and unserialize call in the new logging system
into two functions to allow reuse by tests.

Change-Id: Ibedca39558cbd566661b20e7ebb9d2b6537e4f24
2015-04-07 23:23:45 +02:00
Aaron Schulz
4bdbfe6c1b Removed BloomFilter classes
* This ends up being more complex than its worth
  and even more so for multi-DC support

Bug: T93006
Change-Id: Iaa774fe69061e42955b11dc82d30dba93208e606
2015-04-03 09:10:04 +00:00
umherirrender
68c945d796 Fix IRC lines for blocks published with the old logging system
The CheckUser and GlobalBlocking extension are inserting the block logs
over the old logging system, where the keys are numeric.
This case is not known when building the irc line, because that was
already migrated to just get the new style.
Added compatibility code for legacy rows.

Needs the legacy flag also in ManualLogEntry to make this happen,
because it is using the LogFormatter of the new logging system to format
the actionText.

Have not found the old way for block/reblock, so just for block/block.

Bug: T92713
Follow-Up: Ibc7fcaa5a952ff90d42a6477da4baa429f3de64b
Change-Id: I08aea8399ce766e98c1a76e237169f220c6cc751
2015-03-14 13:43:13 +01:00
Brad Jorsch
f81baad5b3 Fix doc for ManualLogEntry::setParameters()
Numbered-and-named parameters are "number:type:name" (where "type" is
often empty), not "number:name".

Change-Id: I417a3d6caf929a94ffed5e315692950295b3be0d
2015-01-28 11:18:41 -08:00
Aaron Schulz
a9ba7d45f4 Added BloomCache classes
* Implemented a version of BloomCache using Redis
* Added a BloomCheckTitleHasLogs handler class for avoiding
  slow logging table queries when large amounts of 404 pages
  are viewed (by various web crawlers at the moment).

bug: 67439
Change-Id: I26e5034755e3a7208a45991b1cf2f12467679cc1
2014-09-03 17:43:21 +00:00
jenkins-bot
f93d34fb75 Merge "Allow adding Deleted log entries" 2014-05-30 21:58:54 +00:00
umherirrender
d2effb755b Allow LogEntry::setRelations to work with array(tag => value)
Change-Id: I5a3d9799cd2125a02871b1c6a9ef7745eadb518d
2014-05-15 16:38:41 +00:00
csteipp
34d4901f73 Allow adding Deleted log entries
Set log_deleted when a LogEntry object's deleted property is set.

Bug: 63650
Change-Id: Iebd6f7442cba5176d112eb613e2b7ca2e67e37b1
2014-04-28 15:28:41 -07:00
umherirrender
b45420410f Fixed some @params documentation (includes/*)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: Iced714bca004756b461b66067a49a925a7e3b877
2014-04-19 22:22:20 +02:00
nullzero
5c06f5f517 LogEntry: Make newFromRow work with RC object
LogEntry::newFromRow is supposed to give a RCDatabaseLogEntry
if the given row is a RC log entry. The previous code only did
this if an array was passed as the $row argument.

This adds a type cast and fixes the function so that the proper
LogEntry subclass is returned no matter what variable type is
passed to the function.

Bug: 52053
Change-Id: I6f64358837b37c54d00a7544e9e8a92c216bbe89
2013-12-31 10:49:13 +00:00
Siebrand Mazeland
c64fc2f380 Update documentation related to newFromRow and formatRow
Change-Id: I65e5923c4dc3a63bd9cdbbc5fdcb572ab0cb9cae
2013-12-27 13:56:52 +01:00
jenkins-bot
8751d6a10f Merge "Declare visibility on log class related properties" 2013-12-26 18:40:53 +00:00
jenkins-bot
5c5255e227 Merge "Update documentation for log related classes" 2013-12-06 00:28:29 +00:00
Siebrand Mazeland
d60ff22b75 Declare visibility on log class related properties
Also add a few missing ones.

Change-Id: Iff1d9ebc79f8990bfa2e3c4eea2ff15a7c9cd55e
2013-12-05 23:07:41 +00:00
Siebrand Mazeland
e64f4d9f12 Update documentation for log related classes
Change-Id: I4e00cda46cc7bbcbd17ac2d3d025a76281ee84b6
2013-12-06 00:07:12 +01:00
Siebrand Mazeland
8c0cbe6f83 Update ternary notation
Change-Id: I553dd1d42477326848e6e40b824058b6790e2eb5
2013-12-04 09:52:51 +01:00
Siebrand Mazeland
8a536b8591 Update formatting for log related classes
Change-Id: I6535467ed9b22d61b7c5caf3f18067a988871751
2013-12-03 15:36:21 +01:00
Kunal Mehta
6b1b25fad3 Move ManualLogEntry to RecentChange logic into own function
There are certain cases where extensions might want to get
a RecentChanges object without actually inserting it into
the recentchanges table.

Change-Id: I2873c648285a2918661c3650bb90e8db0e05c40c
2013-11-05 00:02:54 -08:00
MatmaRex
df8ec1e216 No spaces after (casts)
Also removed some unnecessary ones. I think I've caught them all.

The spaceless version already appears in core ~300 times (after
accounting for false positives when grepping). Some consistency would
be nice.

Change-Id: I607655b5f4366e66dc78730d5fd2f57ed8776cae
2013-09-04 20:05:43 +02:00
Victor Vasiliev
2961884b43 Provide a JSON recent changes feed.
This introduces a new configuration variable, $wgRCFeeds, which allows the user
to configure multiple destinations for RC notifications. It also allows the
notification format to be customized. Two formats are included by default: the
older IRC format and a new JSON format.

Change-Id: I270bde418a82985c94372ac4579100435b6ee026
2013-08-25 21:23:16 -07:00
Aaron Schulz
1fbb0404f5 Allow for IDatabase to be used as type hints for DatabaseBase|DBConnRef
* Use this in LogEntry to avoid needless type errors

Change-Id: I8644b35b0d9cd171243dd28de52e94ef39d361a7
2013-07-18 03:43:20 +00:00
Aaron Schulz
8c04cd7647 Added log_search tag support to ManualLogEntry
Change-Id: I7e57cd3f2b8790aecd1c1831325c59a2be600780
2013-07-06 10:42:54 -07:00
Aaron Schulz
07319ccba2 Dependency inject DB into ManualLogEntry::insert()
Change-Id: I5018a6ef6095929edca444ad2d901adcf8680ed2
2013-07-01 11:26:45 -07:00
umherirrender
6c38a5eb72 Fixed spacing in logging/parser/profiler/rl/revdel/search folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I11bbcfa351e945b7bde10c2105d61a3cf5622205
2013-04-20 17:38:24 +02:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
7d2bf6aac1 Trim spaces on user supplied comments
This helps on bug 29575

Change-Id: Ic05e5898f8a7c93a95188c9342d22c70d7413b09
2013-01-20 14:08:38 +00:00
umherirrender
17652df9f9 Cache performer of a LogEntry to load it only once from the database
Change-Id: If920ba0a29b8c9b04705a20db5d8f9528b251fe5
2012-10-21 17:57:54 +02:00
umherirrender
85d8ee1f87 Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
2012-10-10 20:14:40 +02:00
Alexandre Emsenhuber
7d9016943d Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I1815587ab2eeb24623ce4bf1c695088bd3f1c2ea
2012-04-30 09:16:10 +02:00
Marcin Cieślak
de5222aedf Unbreak maintenance/deleteDefaultMessages.php for PostgreSQL
deleteDefaultMessages.php was failing during upgrade
from MediaWiki 1.7.3 with a databaser error.

A stub user:

   $user = User::newFromName( 'MediaWiki default' );

has user ID 0, so that $user->isAnon() is true.

Unfortunately, ManualLogEntry::publish() from r96441
tries to insert $user->getName() ("MediaWiki default")
into rc_ip.

PostgreSQL won't allow this, because rc_ip is of 
Postgres-specific CIDR type.

Traceback:

Checking existence of old default messages...
...deleting old default messages (this may take a long time!)...A database query syntax error has occurred.
The last attempted database query was:
"INSERT INTO "recentchanges" (rc_timestamp,rc_cur_time,rc_namespace,rc_title,rc_type,rc_minor,rc_user,rc_user_text,rc_comment,rc_this_oldid,rc_last_oldid,rc_bot,rc_moved_to_ns,rc_moved_to_title,rc_ip,rc_patrolled,rc_new,rc_old_len,rc_new_len,rc_deleted,rc_logid,rc_log_type,rc_log_action,rc_params,rc_id) VALUES ('2012-03-14 21:51:05 GMT','2012-03-14 21:51:05 GMT','8','1movedto2','3','0','0','MediaWiki default','No longer required','0','0',1,'0','','MediaWiki default','1','0',NULL,NULL,'0','1','delete','delete','a:0:{}','1')"
from within function "RecentChange::save".
MySQL returned error "1: ERROR:  invalid input syntax for type cidr: "MediaWiki default"
LINE 1: ...ki default','No longer required','0','0',1,'0','','MediaWiki...
                                                             ^"
Backtrace:
#0 /usr/home/saper/public_html/pg/w/includes/db/DatabasePostgres.php(332): DatabaseBase->reportQueryError('ERROR:  invalid...', 1, 'INSERT INTO "re...', 'RecentChange::s...', '')
#1 /usr/home/saper/public_html/pg/w/includes/db/Database.php(904): DatabasePostgres->reportQueryError('ERROR:  invalid...', 1, 'INSERT INTO "re...', 'RecentChange::s...', '')
#2 /usr/home/saper/public_html/pg/w/includes/db/DatabasePostgres.php(604): DatabaseBase->query('INSERT INTO "re...', 'RecentChange::s...', '')
#3 /usr/home/saper/public_html/pg/w/includes/RecentChange.php(199): DatabasePostgres->insert('recentchanges', Array, 'RecentChange::s...')
#4 /usr/home/saper/public_html/pg/w/includes/logging/LogEntry.php(479): RecentChange->save('pleasedontudp')
#5 /usr/home/saper/public_html/pg/w/includes/WikiPage.php(2042): ManualLogEntry->publish('1')
#6 /usr/home/saper/public_html/pg/w/includes/WikiPage.php(1937): WikiPage->doDeleteArticleReal('No longer requi...', false, 0, false, '', Object(User))
#7 /usr/home/saper/public_html/pg/w/maintenance/deleteDefaultMessages.php(73): WikiPage->doDeleteArticle('No longer requi...', false, 0, false, '', Object(User))
#8 /usr/home/saper/public_html/pg/w/maintenance/update.php(128): DeleteDefaultMessages->execute()
#9 /usr/home/saper/public_html/pg/w/maintenance/doMaintenance.php(105): UpdateMediaWiki->execute()
#10 /usr/home/saper/public_html/pg/w/maintenance/update.php(151): require_once('/usr/home/saper...')
#11 {main}
2012-03-15 01:52:38 +00:00
Sam Reed
b18ea7dee2 Normalise casing of getArticleID used in core 2012-03-11 18:54:55 +00:00
Aaron Schulz
f5d3d02a98 Made use of new getIRCActionComment() function so that comments are back in IRC lines. 2012-02-22 00:26:29 +00:00
Aaron Schulz
689b261466 r112062: updated LogEntry publish() function too 2012-02-21 23:51:18 +00:00
Sam Reed
58c7cf14d3 First merge of the rest of the code from bug 34508 patch 1 and patch 3 2012-02-21 21:26:15 +00:00
Sam Reed
e16a11ae16 Improve documentation
Fix whitespace


Fix weird conditional loading of DB_MASTER from specials/SpecialEditWatchlist.php
2012-02-21 21:15:05 +00:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +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
Aaron Schulz
44da495581 (bug 33374) - 'Deletion log summary not properly truncated' 2012-02-08 19:53:55 +00:00
Aaron Schulz
6b239b0416 Made LogEntry::getPerformer() not fail miserable if we got the LogEntry via newFromRow() on just a logging table row. Previously, the current user IP would show. 2012-02-07 22:22:27 +00:00
Jeroen De Dauw
46dc391fb3 added some docs 2012-01-15 16:13:16 +00:00
Niklas Laxström
6470c75721 Quick ugly fix to avoid duplicate log entries in rc feed.
I didn't think that save() would send lines, since there was function to do that (added in r45725 - duplicating existing code).
This part of codebase could use much TLC
2011-11-03 17:07:29 +00:00
Sam Reed
9d41b95053 Kill various unused variables
Comment some out also

Add some bits of documentation
2011-10-29 01:17:26 +00:00