Commit graph

217 commits

Author SHA1 Message Date
saper
535cddbeab Fix newline in the message per CR
Change method visibility to private

https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113888#c32433

Change-Id: I8ea562cb5346de6823b3c0f0259d438bbefa8bac
2012-03-22 01:03:45 +01:00
Marcin Cieślak
3ebbdc7d0d Followup-To: r113888 Remove extra wfDebug() 2012-03-15 02:00:16 +00: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
Alexandre Emsenhuber
ffb22c66de We have DatabaseBase::selectRow() to select a single row 2012-03-14 16:18:27 +00:00
Aaron Schulz
48b4c56b8f r110955: also truncate rc_comment for log entries. This adds the code in save() to proof RecentChange a bit against such problems. 2012-03-06 19:38:17 +00:00
Siebrand Mazeland
fe9cd7ef73 (bug 34702) More localised parentheses. 2012-02-28 12:41:26 +00:00
Aaron Schulz
6846f3c3a8 Separate out an IRC actionText field for RecentChange. The two are currently the same but that will change soon. 2012-02-21 23:39:14 +00:00
Alexandre Emsenhuber
75da88318c Added $performer parameter to PatrolLog::record() and pass it from WikiPage::doEdit() and RecentChange::doMarkPatrolled() since the performer is not necessarily $wgUser 2012-02-21 22:27:33 +00:00
Sam Reed
a539a3537f Documentation
Wrapping up some long lines
2012-01-14 15:27:30 +00:00
Mark A. Hershberger
68f79fb671 minor w/s + move $title instantiation above Enotif 2012-01-06 21:25:09 +00:00
Niklas Laxström
d4885e2ae8 Followup r101834 - this time tested 2011-11-03 17:09:29 +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
Niklas Laxström
610db6c338 * (bug 30245) Use the correct way to construct a log page title 2011-09-21 09:41:40 +00:00
Niklas Laxström
e82c796570 RecentChange::notifyMove* have no callers. Everything uses ::notifyLog or ::newLogEntry. 2011-09-07 16:20:23 +00:00
Alexandre Emsenhuber
3bcd1980ff Use $this->mAttribs['rc_old_len'] and $this->mAttribs['rc_new_len'] instead of $this->mExtra['oldSize'] and $this->mExtra['newSize'] 2011-09-06 13:17:22 +00:00
Roan Kattouw
fbc65f8972 Per CR on r44412 and my promise in the commit summary of r94990, stop abusing $wgInternalServer (intended for Squid URLs) for IRC/e-mail URLs and introduce $wgCanonicalServer for these purposes instead. This revision introduces two new hooks for WMF hacks, in exchange for making the core code saner.
* Introduce $wgCanonicalServer, which should typically be a fully qualified version of $wgServer but in practice can be anything that you'd like to be used in IRC/e-mail notifs
** Default value is $wgServer, expanded to http:// if protocol-relative
** This means you can easily set HTTPS as the 'default' protocol to use in IRC and e-mail notifs by setting $wgCanonicalServer to https://example.com
* Introduce Title::getCanonicalURL(). Similar to getInternalURL(), including a hook for WMF usage (which will be needed as long as secure.wikimedia.org is used)
** Also add escapeCanonicalURL(). Due to some ridiculous accident of history, the other escapeFooURL() functions don't have a $variant parameter; I decided not to follow that bad example
* Reinstate the spirit of r44406 and r44412: instead of calling getInternalURL() (or getCanonicalURL()) and regexing the title parameter out, obtain the path to index.php using $wgCanonicalServer . $wgScript and append params to that. Sadly, we need to add a hook here to support the secure server hack for WMF, but that's the price of saner code in this case
* Introduce the {{canonicalurl:}} and {{canonicalurle:}} parser functions, which work just like {{fullurl:}} and {{fullurle:}} except that they use getCanonicalURL() instead of getFullURL()
* Use {{canonicalurl:}} in the enotif_body message, fixing bug 29993 (protocol-relative URLs appear in e-mail notifications)
2011-08-19 11:23:17 +00:00
Roan Kattouw
3b35a3d2ec Followup r94754: move protocol expansion from getIRCLine() to inside getInternalUrl(); these internal URLs should always be fully qualified. Effectively this means that if $wgServer is protocol-relative and $wgInternalServer either isn't set or is also protocol relative (but it really shouldn't be the latter!), we'll add http:// to URLs used for Squid purging and in IRC lines. If people want those to be https:// instead, they can set $wgInternalServer accordingly.
We should really, really break the connection between internal URLs used for Squid purges and URLs used for IRC, and use the latter in e-mails as well. This was briefly discussed in the CR comments on r44412 and I'll be working on that today.
2011-08-19 08:56:39 +00:00
Alexandre Emsenhuber
77a3987052 Moved wfGetIP() to WebRequest::getIP():
* Changed all calls in core to the latter
* Also marked wfGetForwardedFor() as deprecated
* Moved wfGetIP() tests to WebRequestTest
2011-08-18 20:03:30 +00:00
Roan Kattouw
4876fc43d6 (bug 30398) Expand any protocol-relative URLs to HTTP in RecentChange::getIRCLine(). This will prevent sending protocol-relative URLs to the IRC feed 2011-08-17 13:32:45 +00:00
Platonides
854c414cc1 r91784 forgot to change one instance of $wgUser to $user 2011-07-19 20:21:11 +00:00
Alexandre Emsenhuber
3bc20b28a0 Pass the User object to RecentChange::doMarkPatrolled() instead of relying on $wgUser 2011-07-09 09:17:35 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Chad Horohoe
783d4e0862 Remove @static from all over the place. That's what the static keyword is for, this being PHP5 and all 2011-04-21 00:07:09 +00:00
Sam Reed
8bd96ffafd Code comments, few braces 2011-04-11 12:47:55 +00:00
Alexandre Emsenhuber
43a798f15a Get ride of extract() calls in RecentChange::getIRCLine() 2011-03-15 18:35:32 +00:00
Happy-melon
52ffdb9d1c Documentation format 2011-01-05 23:08:13 +00:00
Tim Starling
07bb8ce5b5 Remove some of the rubbish that has been accumulating in the default LocalSettings.php for years, especially code as opposed to configuration data:
* Don't set $IP. The entry point already sets it, so there's no point. Users can still set it if they can figure out a way to do it without breaking things.
* Don't include DefaultSettings.php. Doing that is code, not configuration, and it can easily be done in WebStart/Maintenance. Some non-standard entry points in extensions may be broken by this. That's their fault for being non-standard. Backwards compatibility is preserved thanks to require_once().
* Introduce $wgInvalidateCacheOnLocalSettingsChange, which when set, causes $wgCacheEpoch to be updated in the way that it previously was in the default LocalSettings.php.
* Don't set $wgLocalInterwiki to some nonsense value (possibly including spaces and punctuation in the new installer). It should be only for actual interwiki prefixes. Since most wikis don't have them, I set this to false by default and adjusted the referring code to accept this. 
* Removed the guard for web invocation with $wgCommandLineMode set. This ancient code is redundant with modern protections in doMaintenance.php. 
* In DefaultSettings.php, fixed fold terminator placement near $wgLoadScript
* Add a web entry point guard. That's one piece of code which really is necessary.
2010-12-06 15:00:56 +00:00
Sam Reed
4a0c3d8ff5 Comment return types, some explicit class variable declaration 2010-10-09 00:01:45 +00:00
Brion Vibber
c35cabe334 Tweak tab vs spaces from r73860 2010-09-28 02:18:35 +00:00
Sam Reed
9d1e45bf42 Tweak/add some documentation as hints for some code analysis 2010-09-28 01:33:11 +00:00
Alexandre Emsenhuber
5be509b0c1 * Standardised file description headers
* Added some descriptions
* Added @file where needed
2010-08-08 14:23:14 +00:00
Chad Horohoe
4c74490bb8 Big commit: kill almost every freeResult() call as useless 2010-08-08 12:27:48 +00:00
Niklas Laxström
48c3231e32 Apply patch from bug 24104 by John Du Hart for allowing custom port.
Also updated the function documentation while at it.
2010-06-24 06:20:11 +00:00
Alexandre Emsenhuber
c00e4572b0 * Fix some doxygen warnings
* use spaces for identation in the middle of lines instead of tabs
2010-01-21 22:01:38 +00:00
Chad Horohoe
a4e5e935b6 Mass convert NULL -> null. Left strings and comments alone, obviously. 2009-12-11 21:07:27 +00:00
Jure Kajzer
785ad24aa7 Changed sequence names to a standard <table>_<field>_seq form.
Updated all nextSequenceValue calls with new sequence names.
OverlordQ stated he'll handle changes to Postgres scripts.
Need someone to change DB2 scripts.
2009-10-28 16:17:16 +00:00
Chad Horohoe
88bf1584a6 Revert r55459, 55467, 55469, 55518 (Page creation notification email is sent when a watched page is deleted). Breaks current setups where enotif_body is customized. Sidenote: anyone looking to do this right should redo EmailNotification::notifyOnPageChange() to just use the params array from RC, rather than tacking more crap onto this function 2009-09-11 01:04:00 +00:00
Daniel Kinzler
0234640637 adding public access methods for use by XMLRC extension. 2009-09-03 16:15:55 +00:00
Chad Horohoe
3617ab6b5c (bug 15646) Page creation notification email is sent when a watched page is deleted 2009-08-21 23:33:38 +00:00
Aaron Schulz
f741c09aa2 (bug 19214) Make sure new pages have page ID cached for getTitle() 2009-06-17 21:11:29 +00:00
Alexandre Emsenhuber
19b9a1d48d Make RecentChange::cleanupForIRC() also call Sanitizer::decodeCharReferences() to remove HTML entities left by some messages (such as colon-separator, etc.) 2009-01-25 19:00:11 +00:00
Aaron Schulz
db4b0db9d2 Added notifyRC2UDP() convenience function 2009-01-14 01:45:52 +00:00
Charles Melbye
2774c33be8 Fix a problem with a protected class method that brought up an error, and also
fixed a typo in the release notes.
2009-01-12 22:52:09 +00:00
Aaron Schulz
3dbbdca71d Just use != here 2009-01-10 22:07:12 +00:00
Aaron Schulz
6059b4d6ad Minor code style tweaks & cleanup 2009-01-09 23:18:47 +00:00
Aaron Schulz
78678afa7c Hide patrol mark if patrolling is disabled 2009-01-09 22:49:40 +00:00
Aaron Schulz
6ced476ceb Clean up log restrictions check 2009-01-09 18:38:10 +00:00
Aaron Schulz
9d9ad4dab8 Revert r45605 and generalize the ability to have logs go to UDP. 2009-01-09 18:30:47 +00:00
Aaron Schulz
97878c044f Make sure feeds reflect changes due to flaggedrevs 2009-01-09 18:05:58 +00:00