Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace Flow\Import; |
| 4 | |
| 5 | use Flow\Import\Postprocessor\Postprocessor; |
| 6 | use Flow\Import\SourceStore\SourceStoreInterface; |
| 7 | use MediaWiki\Content\WikitextContent; |
| 8 | use MediaWiki\Title\Title; |
| 9 | |
| 10 | /** |
| 11 | * Interface between the Converter and an implementation of IImportSource. |
| 12 | * Informs conversion behavior and which pages should be converted. |
| 13 | */ |
| 14 | interface IConversionStrategy { |
| 15 | /** |
| 16 | * @return SourceStoreInterface This should consistently return the |
| 17 | * same store between conversion runs from the same source to |
| 18 | * guarantee idempotent imports (without duplicate content). |
| 19 | */ |
| 20 | public function getSourceStore(); |
| 21 | |
| 22 | /** |
| 23 | * @param Title $from The original location of the page |
| 24 | * @param Title $to The archive location of the page |
| 25 | * @return string A reason for moving the page to an archive location. |
| 26 | */ |
| 27 | public function getMoveComment( Title $from, Title $to ); |
| 28 | |
| 29 | /** |
| 30 | * @param Title $from The original location of the page |
| 31 | * @param Title $to The archive location of the page |
| 32 | * @return string A reason for performing an edit to the |
| 33 | * archive location. |
| 34 | */ |
| 35 | public function getCleanupComment( Title $from, Title $to ); |
| 36 | |
| 37 | /** |
| 38 | * @param Title $title The current location of the page |
| 39 | * @param Title|null $movedFrom The location this was moved from |
| 40 | * in a prior run of the converter. |
| 41 | * @return bool True when the conversion is complete and nothing |
| 42 | * more can be done |
| 43 | */ |
| 44 | public function isConversionFinished( Title $title, ?Title $movedFrom = null ); |
| 45 | |
| 46 | /** |
| 47 | * Create an ImportSource implementation for the provided Title. |
| 48 | * This provides a consistent interface to the headers, topics, |
| 49 | * summaries and posts to be imported. |
| 50 | * |
| 51 | * @param Title $title The page to import from |
| 52 | * @return IImportSource |
| 53 | */ |
| 54 | public function createImportSource( Title $title ); |
| 55 | |
| 56 | /** |
| 57 | * Flow does not support viewing the history of the wikitext pages |
| 58 | * it takes over, so those need to be moved out the way. This method |
| 59 | * decides that destination. |
| 60 | * |
| 61 | * @param Title $source The title to be archived |
| 62 | * @return Title The title to archive $source to |
| 63 | * @throws ImportException When no title can be decided upon |
| 64 | */ |
| 65 | public function decideArchiveTitle( Title $source ); |
| 66 | |
| 67 | /** |
| 68 | * Creates the content for an edit to the archived page content. When |
| 69 | * null is returned no edit is performed. This edit is performed by |
| 70 | * an administrative user provided to the Converter. |
| 71 | * |
| 72 | * @param WikitextContent $content |
| 73 | * @param Title $title |
| 74 | * @return WikitextContent|null |
| 75 | */ |
| 76 | public function createArchiveCleanupRevisionContent( WikitextContent $content, Title $title ); |
| 77 | |
| 78 | /** |
| 79 | * Gets any postprocessors used for this type of conversion |
| 80 | * @return Postprocessor|null |
| 81 | */ |
| 82 | public function getPostprocessor(); |
| 83 | |
| 84 | /** |
| 85 | * Checks whether the title should be converted. |
| 86 | * This is a secondary filter in addition to the original list (which might be a |
| 87 | * single title, a namespace, etc.) passed into convert/convertAll. |
| 88 | * |
| 89 | * @param Title $sourceTitle |
| 90 | * @return bool True if and only if it should be converted |
| 91 | */ |
| 92 | public function shouldConvert( Title $sourceTitle ); |
| 93 | } |