Commit graph

56 commits

Author SHA1 Message Date
umherirrender
6ffe706044 (bug 33564) transwiki import sometimes result in invalid title
This is a simple fix. A other solution is to check isExternal on the
original title, but than it is never possible to import pages, which
have a interwiki in the destination wiki. Now the interwiki is skipped,
when using a target namespace.

Change-Id: I148e124016cacac0e0c6c6eb8c7e8a2e85802565
2012-04-09 12:25:00 -07:00
Daniel Friesen
e2ee009e5c Commit the cryptrand project worked on in git:
- MWCryptRand: A new api for generating cryptographic randomness for security tokens. Uses whatever cryptographic source is available and if not falls back to using random state and clock drift.
- wfRandomString - A simple non-cryptographic pesudo-random string generation function to replace wfGenerateToken which was written pretending to be secure when it's really not.
- Core updates to use MWCryptRand in various places:
-- user_token generation (to do this we stop generating user_token implicitly and only generate it when needed to avoid depleting the system's entropy pool by reading random data we'll never use)
-- email confirmation token generation
-- password salt generation
-- temporary password generation
-- Generation of the automatic watchlist token
-- login and create user tokens
-- session ids when php's entropy sources are not set
-- the installer when generating wgSecretKey and the upgrade key
2012-03-20 05:17:40 +00:00
Sam Reed
c052fc3b7b Documentation followups from lastnight 2012-02-10 15:37:33 +00:00
Sam Reed
76246b9bf5 More return documentation 2012-02-09 21:33:27 +00:00
Sam Reed
7b25f8231f 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:30:01 +00:00
Sam Reed
284d014e37 Update documentation for ImportHandleRevisionXMLTag 2012-01-16 15:49:32 +00:00
Alexandre Emsenhuber
c24fbd4aff * Added callback to send notices from WikiImporter and use it in ImportReporter so that it can use the context to get messages and send them to OutputPage (also removes on usage of $wgCommandLineMode)
* Early abort on invalid title in ImportReporter::reportPage() since a notice has already been sent
* Localised message saying the title is invalid
2012-01-06 14:21:16 +00:00
Alexandre Emsenhuber
e7e4e4fbf5 * Don't allow to import a page in the Media: namespace, this didn't work just because WikiPage::factory() throws an exception when a Title in NS_MEDIA is passed
* Added localised message when trying to import a page with an interwiki prefix
2012-01-06 12:06:13 +00:00
Alexandre Emsenhuber
937c30f582 Use WikiPage instead of Article 2011-11-19 08:51:20 +00:00
Sam Reed
52cd34acf5 More documentation 2011-10-29 01:53:28 +00:00
Mark A. Hershberger
f1ff44d518 Fixes Bug #28277 by allowing redirects on the stream reader. Fixes a
regression where pages specifying a w:en:Sprint would result in a url
like http://pt.wikipedia.org/wiki/en:Special:Export/Sprint which, at
least in 1.16, would mean the reader follow the redirect to
http://en.wikipedia.org/wiki/Special:Export/Sprint.
2011-10-27 17:58:30 +00:00
Sam Reed
96641da58e Add, update, tweak documentation
Fix document comment blocks

Tweak some returns
2011-10-26 03:44:47 +00:00
Robin Pepermans
2ed55f42e4 (bug 23057) Importers can 'edit' or 'create' a fully-protected page by importing a new revision into it 2011-09-06 00:01:06 +00:00
Roan Kattouw
bf50f4eb43 Fix embarassing debugging code left in in r93744 2011-08-04 12:13:01 +00:00
Roan Kattouw
b00a32ba3b Add --no-updates flag to importDump.php that allows the user to skip updating the links table. On my test dataset (an old (~2 years) MediaWiki namespace dump of enwiki) this speeds up the import from 9m35s to 10s. 2011-08-02 14:05:01 +00:00
Ariel Glenn
de1f9c7d61 libxml >= 2.7.3 ha a 10mb cap on the size of a text node and the LIBXML_PARSEHUGE lets us override that, needed for lucid since there are a few revs in the db larger than that limit 2011-07-12 15:01:58 +00:00
Alexandre Emsenhuber
931bdf8d2d Fixes for r88113 and some realted changes:
* Modified <s>Article::editUpdates()</s> WikiPage::doEditUpdates() arguments to take a Revision object, an User object and options (much more readable that those boolean parameters)
* Call isCountable() on the old content and pass it to WikiPage::doEditUpdates() with the 'oldcountable' option so that it really reflects the old state of the page
* Updated all calls (no one in extensions) and removed the wrapper WikiPage::editUpdates()
* Call onArticleEdit() and onArticleCreate() (the one that is of course) from doEditUpdates()
* Removed $wgTitle hack from Import.php
2011-06-30 15:26:26 +00:00
Alexandre Emsenhuber
1edfcb440c Removed usage of error suppression operator 2011-06-22 18:02:28 +00:00
Bryan Tong Minh
506fd9f2b1 Per comments on r88145: unlink file if it is broken 2011-06-17 16:48:42 +00:00
Sam Reed
4065e65d03 Even more documentation in various files 2011-05-29 14:24:27 +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
Bryan Tong Minh
43d5d3b682 Follow-up r87176: Make importDump.php import files
* Fixes for Import.php: Check sha1 of the file; only delete source files if they are temporary
* importDump.php now imports embedded files if --uploads is set; if they are not present it will try to get them from --image-base-path
2011-05-15 10:39:15 +00:00
Alexandre Emsenhuber
421948c238 Rewrote the article counting code and related:
* (bug 26033, bug 24754) Added $wgArticleCountMethod to have a more flexible way to define which method to use to define if a page is an article or not and deprecated $wgUseCommaCount. There is now a new 'any' method to count any article that is in a content namespace and not a redirect.
* (bug 11868) If using links to count articles, Article::isCountable() will now use the ParserOutput to check if there's a link instead of checking for the "[[" string. Changed Article::isCountable() to take a stdObject or false for the first parameters. If false is passed, the result will be based on the current article's state (i.e. database). The only call outside of the Article class is in DeleteAction (including extensions).
* Removed this horror of Article::$mGoodAdjustment and Article::$mTotalAdjustment, replaced by the new $created parameter on Article::editUpdates(); simplified Article::createUpdates()
* Updated Import.php to take advantage of the new parameter and make a single call to Article::editUpdates()
2011-05-14 17:11:32 +00:00
Sam Reed
8e80b8c3c1 Tidy up some unused variables and such 2011-04-23 21:40:52 +00:00
Sam Reed
a6f56411a2 Remove some unused variables/globals
Fix another unreachable statement
2011-04-16 11:28:35 +00:00
Bryan Tong Minh
9b3128eb2b Add support for importing/exporting files. This can be done by embedding the image as base64 in the XML stream or by copying the images directory manually and pointing the importer to the base images directory.
Currently only backend code available and a few member variables need to be modified to enable the functionality.

Export.php: 
* Add <rel> and <sha1base36> elememnts to the XML output
* Add optional <archivename> and <contents> elements to the XML output. <contents> contains an encoding attribute, which is currently only set to base64.
Import.php:
* Add Import::$mImageBasePath which should point to the images/ directory to import from
* Add methods to WikiRevision (terrible name btw) to set the rel, hash, archivename and filesrc.
* Cleanup and made WikiRevision::importUpload working. It's still quite a mess though
OldLocalFiel.php:
* Fix a few timestamp related things from r85635
2011-04-12 19:25:56 +00:00
Brion Vibber
69079ca839 * (bug 28417) Fix PHP notice when importing revision without a listed id 2011-04-04 19:06:01 +00:00
Mark A. Hershberger
2e61719bdb Followup r83536 to address Jack Phoenix's comments about the bogus w/s “cleanup” 2011-03-18 20:58:12 +00:00
Mark A. Hershberger
b3df4babc2 misc w/s cleanups, “svn diff -x-w” clean 2011-03-08 18:12:17 +00:00
Mark A. Hershberger
bb3cc5719a followup r83227 ... missed bits of patch 2011-03-04 19:19:59 +00:00
Mark A. Hershberger
8c8b692b97 W/S cleanup 2011-03-04 19:13:59 +00:00
Derk-Jan Hartman
70e98b5a79 All functions of the importer have $title, origTitle, but processTitle() returned $title, origTitle.
This caused confusion and a misusage of the processTitle() result.

Follow up to r66267.
Fixes bug 27486
2011-02-19 20:35:51 +00:00
Andrew Garrett
868cfaa7ba Kill the XMLReader2 class in response to Tim's code review comments on r68587 2011-02-03 01:25:09 +00:00
Tim Starling
47b728b45b Cleanup for r66268, r66267: merge WikiImporter back into Import.php, where it started. It doesn't really make sense to have a class called WikiImporter in a file called ImportXMLReader.php, and a few little helper classes for it in a file called Import.php. 2011-01-31 07:07:43 +00:00
Alexandre Emsenhuber
e6bba17c9f Converted ImportStreamSource functions to return a Status object rather than ImportStreamSource-or-WikiError
This is a breaking change since the ImportStreamSource object is in the value member of the Status object; I will fix the extensions in my next commit
2010-12-05 14:22:49 +00:00
Siebrand Mazeland
eb860c8689 Remove comment related to no longer supported PHP versions. 2010-10-02 22:41:44 +00:00
Platonides
6e772b1aee Remove old var_dump 2010-08-27 17:55:20 +00:00
Alexandre Emsenhuber
5be509b0c1 * Standardised file description headers
* Added some descriptions
* Added @file where needed
2010-08-08 14:23:14 +00:00
Andrew Garrett
c9ebbcd09b Rewrite of XML Dump Processing:
* Full rewrite of the WikiImporter class to a new class, XMLDumpImporter, which uses XMLReader instead of the deprecated PHP SAX interface.
* Fixes for the following bugs:
** XML Dump Processor chokes on unrecognised tags.
** Special:Import does not allow you to import a dump including only log entries.
* Added hooks to allow extensions to handle tags in any part of the XML document.
* Fully source-compatible with the previous interface.
2010-05-12 13:28:13 +00:00
Alexandre Emsenhuber
c3ec19debc Replaced all @fixme with "@todo Fixme" since doxygen doesn't have a @fixme command 2009-12-15 21:26:58 +00:00
OverlordQ
a989843cd0 Code cleanup, covert leading spaces into tabs per coding style 2009-11-14 21:27:13 +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
Aaron Schulz
0cb40e8a39 Fixed total import breakage from r53271 2009-10-14 01:24:24 +00:00
Alexandre Emsenhuber
b4b89afea3 fix some doxygen warnings 2009-10-04 21:21:30 +00:00
Tim Starling
4b66381cbf * Mostly reverted r41081 and related. Although the motivation (to save a query) is noble, it's a complex special case relying on subtle inter-module effects, making the code quite unclear and the performance advantage hard to reproduce in new code.
* r41081 was causing the job queue to be flooded with tiny htmlCacheUpdate jobs which were less than the batch size and so, according to the original logic, should have been done immediately. This was causing template updates to be delayed even when the template has few backlinks. This is fixed.
* Introduced a shared cache called BacklinkCache with the main purpose of sharing data from these backlink queries, thus recovering the performance of r41081.
* Refactored backlink partitioning code, which in r40741 was copied from HTMLCacheUpdate to LinksUpdate with a bug intact. The bug caused every htmlCacheUpdate or refreshLinks2 job to be split into at least two pieces even when number of rows is less than the batch size.
* Fixed a bug from r40741 causing refreshLinks2 jobs with end=false to be ignored.
* Made SquidUpdate::newFromTitles() accept a TitleArray
2009-02-16 14:26:34 +00:00
Andrew Garrett
5b29264951 Add 'include pages linked to from these pages' to Special:Export and the corresponding transwiki interface. 2009-02-06 22:44:28 +00:00
Chad Horohoe
ff3d15d134 (bug 15283) Interwiki imports should fetch included templates 2009-02-06 00:02:44 +00:00
Brion Vibber
3b571e768c Attempting to import a title that came out as an interwiki would sort of half-work somewhere then explode when trying to save the null revision with the import info:
Fatal error:  Call to a member function insertOn() on a non-object in /Library/WebServer/Documents/trunk/includes/specials/SpecialImport.php on line 305

Now such titles are skipped. You can probably force import of the page by forcing the target namespace...

Better long-term solution might include title renormalization, adapation of remote namespace names (eg Wikipedia -> Project), etc.
2008-12-10 22:41:13 +00:00
Ariel Glenn
6584a7bb0d handle xmlns for imports (bug #4520) 2008-12-05 02:16:11 +00:00
Brion Vibber
2d5024f4d7 * Add guard exception in OutputPage::parse() for failure case where $wgTitle is null; that causes a fatal error which doesn't show a backtrace if we don't catch it here.
* Temporarily set $wgTitle while doing article creation/edit updates during XML import. A null $wgTitle as in importDump.php caused a fatal error when special pages were transcluded if they did any parsing via OutputPage::parse()
2008-11-24 01:58:15 +00:00