http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72474
Revision: 72474
Author: nikerabbit
Date: 2010-09-06 09:44:24 +0000 (Mon, 06 Sep 2010)
Log Message:
-----------
Documentation updates. Now all classes have at least short description.
Modified Paths:
--------------
trunk/extensions/Translate/FFS.php
trunk/extensions/Translate/FirstSteps.i18n.php
trunk/extensions/Translate/Groups.php
trunk/extensions/Translate/TranslateEditAddons.php
trunk/extensions/Translate/TranslateUtils.php
trunk/extensions/Translate/ffs/Gettext.php
trunk/extensions/Translate/ffs/OpenLayers.php
trunk/extensions/Translate/ffs/PhpVariables.php
trunk/extensions/Translate/ffs/Simple.php
trunk/extensions/Translate/ffs/Wiki.php
trunk/extensions/Translate/ffs/WikiExtension.php
trunk/extensions/Translate/groups/ComplexMessages.php
trunk/extensions/Translate/groups/MediaWiki/Checker.php
trunk/extensions/Translate/groups/MediaWiki/setup.php
trunk/extensions/Translate/groups/MediaWikiExtensions.php
trunk/extensions/Translate/groups/OpenLayers.php
trunk/extensions/Translate/groups/Voctrain.php
trunk/extensions/Translate/groups/Wikia/WikiaExtensions.php
trunk/extensions/Translate/scripts/fuzzy.php
trunk/extensions/Translate/scripts/mwcore-export.php
trunk/extensions/Translate/scripts/pagetranslation-check-database.php
trunk/extensions/Translate/scripts/pagetranslation-test-parser.php
trunk/extensions/Translate/scripts/sync-group.php
Modified: trunk/extensions/Translate/FFS.php
===================================================================
--- trunk/extensions/Translate/FFS.php 2010-09-06 09:26:14 UTC (rev 72473)
+++ trunk/extensions/Translate/FFS.php 2010-09-06 09:44:24 UTC (rev 72474)
@@ -423,7 +423,7 @@
}
/**
- * @todo Needs documentation.
+ * Generic file format support for JavaScript formatted files.
* @ingroup FFS
*/
abstract class JavaScriptFFS extends SimpleFFS {
@@ -620,7 +620,8 @@
}
/**
- * @todo Needs documentation.
+ * New style file format support for specific kind of JavaScript
+ * formatted files used by OpenLayers.
* @ingroup FFS
*/
class OpenLayersFFS extends JavaScriptFFS {
@@ -664,7 +665,7 @@
}
/**
- * @todo Needs documentation.
+ * File format support for Shapado, which uses JavaScript based format.
* @ingroup FFS
*/
class ShapadoJsFFS extends JavaScriptFFS {
Modified: trunk/extensions/Translate/FirstSteps.i18n.php
===================================================================
--- trunk/extensions/Translate/FirstSteps.i18n.php 2010-09-06 09:26:14 UTC
(rev 72473)
+++ trunk/extensions/Translate/FirstSteps.i18n.php 2010-09-06 09:44:24 UTC
(rev 72474)
@@ -1,6 +1,6 @@
<?php
/**
- * Message for Special:FirstSteps of the Translate extension.
+ * %Messages for Special:FirstSteps of the Translate extension.
*
* @file
* @author Niklas Laxström
Modified: trunk/extensions/Translate/Groups.php
===================================================================
--- trunk/extensions/Translate/Groups.php 2010-09-06 09:26:14 UTC (rev
72473)
+++ trunk/extensions/Translate/Groups.php 2010-09-06 09:44:24 UTC (rev
72474)
@@ -403,6 +403,10 @@
}
}
+/**
+ * New style message group for %MediaWiki.
+ * @todo Currently unused?
+ */
class MediaWikiMessageGroup extends FileBasedMessageGroup {
public function mapCode( $code ) {
return ucfirst( str_replace( '-', '_', parent::mapCode( $code )
) );
Modified: trunk/extensions/Translate/TranslateEditAddons.php
===================================================================
--- trunk/extensions/Translate/TranslateEditAddons.php 2010-09-06 09:26:14 UTC
(rev 72473)
+++ trunk/extensions/Translate/TranslateEditAddons.php 2010-09-06 09:44:24 UTC
(rev 72474)
@@ -11,11 +11,15 @@
*/
/**
- * @todo Needs documentation.
+ * Various editing enhancements to the edit page interface.
+ * Partly succeeded by the new ajax-enhanced editor but kept for compatibility.
+ * Also has code that is still relevant, like the hooks on save.
*/
class TranslateEditAddons {
- const MSG = 'translate-edit-';
+ /**
+ * Add some ugly navigation links below translations.
+ */
static function addNavigation( &$outputpage, &$text ) {
global $wgUser, $wgTitle;
@@ -63,7 +67,7 @@
continue;
}
- /**
+ /*
* Keys can have mixed case, but they have to be unique
in a case
* insensitive manner. It is therefore safe and a must
to use case
* insensitive comparison method.
@@ -140,13 +144,18 @@
return true;
}
+ /**
+ * Keep the usual diiba daaba hidden from translators.
+ */
static function intro( $object ) {
$object->suppressIntro = true;
return true;
}
-
+ /**
+ * Adds the translation aids and navigation to the normal edit page.
+ */
static function addTools( $object ) {
if ( !self::isMessageNamespace( $object->mTitle ) ) {
return true;
@@ -158,6 +167,10 @@
return true;
}
+ /**
+ * Replace the normal save button with one that says if you are editing
+ * message documentation to try to avoid accidents.
+ */
static function buttonHack( $editpage, &$buttons, $tabindex ) {
global $wgTranslateDocumentationLanguageCode;
@@ -382,18 +395,14 @@
}
}
- /**
- * Update it.
- */
+ // Update it.
if ( $revision === null ) {
$rev = $article->getTitle()->getLatestRevId();
} else {
$rev = $revision->getID();
}
- /**
- * begin fuzzy tag.
- */
+ // begin fuzzy tag.
$dbw = wfGetDB( DB_MASTER );
$id = $dbw->selectField( 'revtag_type', 'rtt_id', array(
'rtt_name' => 'fuzzy' ), __METHOD__ );
@@ -403,24 +412,16 @@
'rt_type' => $id,
'rt_revision' => $rev
);
- /**
- * Remove any existing fuzzy tags for this revision
- */
+ // Remove any existing fuzzy tags for this revision
$dbw->delete( 'revtag', $conds, __METHOD__ );
- /**
- * Add the fuzzy tag if needed.
- */
+ // Add the fuzzy tag if needed.
if ( $fuzzy !== false ) {
$dbw->insert( 'revtag', $conds, __METHOD__ );
}
- /**
- * End fuzzy
- */
- /**
- * Diffs for changed messages.
- */
+
+ // Diffs for changed messages.
if ( $fuzzy !== false ) {
return true;
}
Modified: trunk/extensions/Translate/TranslateUtils.php
===================================================================
--- trunk/extensions/Translate/TranslateUtils.php 2010-09-06 09:26:14 UTC
(rev 72473)
+++ trunk/extensions/Translate/TranslateUtils.php 2010-09-06 09:44:24 UTC
(rev 72474)
@@ -42,7 +42,7 @@
/**
* Splits page name into message key and language code.
* @param $text \string
- * @return \type{Tuple{String,String}} Key and language code.
+ * @return \type{Tuple[String,String]} Key and language code.
* @todo Handle names without slash.
*/
public static function figureMessage( $text ) {
@@ -57,7 +57,7 @@
* Loads page content *without* side effects.
* @param $key \string Message key.
* @param $language \string Language code.
- * @param $namespace \ing Namespace number.
+ * @param $namespace \int Namespace number.
* @return \types{\string,\null} The contents or null.
*/
public static function getMessageContent( $key, $language,
@@ -74,7 +74,7 @@
*
* @param $titles \types{String,\list{String}} Database page names.
* @param $namespace \int The number of the namespace.
- * @return \arrayof{\String,\type{Tuple{String,String}}} Tuples of page
+ * @return \arrayof{\string,\type{Tuple[String,String]}} Tuples of page
* text and last author indexed by page name.
*/
public static function getContents( $titles, $namespace ) {
@@ -148,7 +148,7 @@
/**
* Makes a selector from name and options.
* @param $name \string
- * @param $options \List{String} Html \<option> elements.
+ * @param $options \list{String} Html \<option> elements.
* @return \string Html.
*/
public static function selector( $name, $options ) {
@@ -158,7 +158,7 @@
/**
* Makes a selector from name and options.
* @param $name \string
- * @param $options \list{String} The name and value of options.
+ * @param $items \list{String} The name and value of options.
* @param $selected \string The default selected value.
* @return \string Html.
*/
@@ -246,7 +246,7 @@
* Returns the primary group message belongs to.
* @param $namespace \int
* @param $key \string
- * @return \types{\String,\null} Group id or null.
+ * @return \types{\string,\null} Group id or null.
*/
public static function messageKeyToGroup( $namespace, $key ) {
if ( self::$mi === null ) {
Modified: trunk/extensions/Translate/ffs/Gettext.php
===================================================================
--- trunk/extensions/Translate/ffs/Gettext.php 2010-09-06 09:26:14 UTC (rev
72473)
+++ trunk/extensions/Translate/ffs/Gettext.php 2010-09-06 09:44:24 UTC (rev
72474)
@@ -10,12 +10,12 @@
*/
/**
- * Extends class MwException. Currently empty.
+ * Identifies Gettext plural exceptions.
*/
-class GettextPluralException extends MwException { }
+class GettextPluralException extends MwException {}
/**
- * Read the gettext file.
+ * Old-style parser for gettext file format.
*/
class GettextFormatReader extends SimpleFormatReader {
protected $pot = false;
@@ -102,6 +102,9 @@
}
}
+/**
+ * Old-style writer for gettext file format.
+ */
class GettextFormatWriter extends SimpleFormatWriter {
protected $data = array();
protected $plural = array( false, 0 );
@@ -354,7 +357,7 @@
}
/**
- * FFS class that implements support for gettext file format.
+ * New-style FFS class that implements support for gettext file format.
* @ingroup FFS
*/
class GettextFFS extends SimpleFFS {
Modified: trunk/extensions/Translate/ffs/OpenLayers.php
===================================================================
--- trunk/extensions/Translate/ffs/OpenLayers.php 2010-09-06 09:26:14 UTC
(rev 72473)
+++ trunk/extensions/Translate/ffs/OpenLayers.php 2010-09-06 09:44:24 UTC
(rev 72474)
@@ -8,6 +8,9 @@
* @file
*/
+/**
+ * Old style parser for JavaScript format files.
+ */
class OpenLayersFormatReader extends SimpleFormatReader {
protected $keyquote = true;
@@ -111,6 +114,9 @@
}
}
+/**
+ * Old style writer for JavaScript format files.
+ */
class OpenLayersFormatWriter extends SimpleFormatWriter {
/**
Modified: trunk/extensions/Translate/ffs/PhpVariables.php
===================================================================
--- trunk/extensions/Translate/ffs/PhpVariables.php 2010-09-06 09:26:14 UTC
(rev 72473)
+++ trunk/extensions/Translate/ffs/PhpVariables.php 2010-09-06 09:44:24 UTC
(rev 72474)
@@ -10,7 +10,8 @@
*/
/**
- * @todo Needs documentation.
+ * Implements file format support for PHP files which consist of multiple
+ * variable assignments.
*/
class FlatPhpFFS extends SimpleFFS {
//
Modified: trunk/extensions/Translate/ffs/Simple.php
===================================================================
--- trunk/extensions/Translate/ffs/Simple.php 2010-09-06 09:26:14 UTC (rev
72473)
+++ trunk/extensions/Translate/ffs/Simple.php 2010-09-06 09:44:24 UTC (rev
72474)
@@ -3,13 +3,14 @@
* Simple file format handler for testing import and export.
*
* @author Niklas Laxström
- * @copyright Copyright © 2008, Niklas Laxström
+ * @copyright Copyright © 2008-2010, Niklas Laxström
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
* @file
*/
/**
- * @todo Needs documentation.
+ * Example implementation of old-style file format reader.
+ * @see FFS
*/
class SimpleFormatReader {
const SEPARATOR = '----';
@@ -98,7 +99,8 @@
}
/**
- * @todo Needs documentation.
+ * Example implementation of old-style file format writer.
+ * @see FFS
*/
class SimpleFormatWriter {
const SEPARATOR = '----';
Modified: trunk/extensions/Translate/ffs/Wiki.php
===================================================================
--- trunk/extensions/Translate/ffs/Wiki.php 2010-09-06 09:26:14 UTC (rev
72473)
+++ trunk/extensions/Translate/ffs/Wiki.php 2010-09-06 09:44:24 UTC (rev
72474)
@@ -3,13 +3,13 @@
* Wike file format handler.
*
* @author Niklas Laxström
- * @copyright Copyright © 2008, Niklas Laxström
+ * @copyright Copyright © 2008-2010, Niklas Laxström
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
* @file
*/
/**
- * @todo Needs documentation.
+ * Old-style parser for %MediaWiki i18n format (one file per language).
*/
class WikiFormatReader extends SimpleFormatReader {
// Set by creater
@@ -75,7 +75,7 @@
}
/**
- * @todo Needs documentation.
+ * Old-style writer for %MediaWiki i18n format (one file per language).
*/
class WikiFormatWriter extends SimpleFormatWriter {
public $commaToArray = false;
Modified: trunk/extensions/Translate/ffs/WikiExtension.php
===================================================================
--- trunk/extensions/Translate/ffs/WikiExtension.php 2010-09-06 09:26:14 UTC
(rev 72473)
+++ trunk/extensions/Translate/ffs/WikiExtension.php 2010-09-06 09:44:24 UTC
(rev 72474)
@@ -4,11 +4,12 @@
*
* @file
* @author Niklas Laxström
- * @copyright Copyright © 2008, Niklas Laxström
+ * @copyright Copyright © 2008-2010, Niklas Laxström
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
*/
/**
+ * Old-style parser for %MediaWiki extension i18n format.
* @todo Needs documentation and conversion to new style message group.
*/
class WikiExtensionFormatReader extends WikiFormatReader {
@@ -81,6 +82,7 @@
}
/**
+ * Old-style writer for %MediaWiki extension i18n format.
* @todo Needs documentation and conversion to new style message group.
*/
class WikiExtensionFormatWriter extends WikiFormatWriter {
Modified: trunk/extensions/Translate/groups/ComplexMessages.php
===================================================================
--- trunk/extensions/Translate/groups/ComplexMessages.php 2010-09-06
09:26:14 UTC (rev 72473)
+++ trunk/extensions/Translate/groups/ComplexMessages.php 2010-09-06
09:44:24 UTC (rev 72474)
@@ -1,6 +1,6 @@
<?php
/**
- * Classes for complex messages (MediaWiki special page aliases, namespace
names, magic words).
+ * Classes for complex messages (%MediaWiki special page aliases, namespace
names, magic words).
*
* @file
* @author Niklas Laxstr\xF6m
@@ -9,6 +9,8 @@
*/
/**
+ * Base class which implements handling and translation interface of
+ * non-message %MediaWiki items.
* @todo Needs documentation.
*/
abstract class ComplexMessages {
@@ -246,9 +248,6 @@
'<tr>' . implode( "\n", $subheading ) . '</tr>';
}
- /**
- * GLOBALS: $wgRequest
- */
public function output() {
global $wgRequest;
@@ -522,6 +521,7 @@
}
/**
+ * Adds support for translating special page aliases via
Special:AdvancedTranslate.
* @todo Needs documentation.
*/
class SpecialPageAliasesCM extends ComplexMessages {
@@ -602,6 +602,7 @@
}
/**
+ * Adds support for translating magic words via Special:AdvancedTranslate.
* @todo Needs documentation.
*/
class MagicWordsCM extends ComplexMessages {
@@ -653,6 +654,7 @@
}
/**
+ * Adds support for translating namespace names via Special:AdvancedTranslate.
* @todo Needs documentation.
*/
class NamespaceCM extends ComplexMessages {
Modified: trunk/extensions/Translate/groups/MediaWiki/Checker.php
===================================================================
--- trunk/extensions/Translate/groups/MediaWiki/Checker.php 2010-09-06
09:26:14 UTC (rev 72473)
+++ trunk/extensions/Translate/groups/MediaWiki/Checker.php 2010-09-06
09:44:24 UTC (rev 72474)
@@ -1,15 +1,15 @@
<?php
/**
- * Implements MessageChecker for MediaWiki.
+ * Implements MessageChecker for %MediaWiki.
*
* @file
* @author Niklas Laxström
- * @copyright Copyright © 2008-2009, Niklas Laxström
+ * @copyright Copyright © 2008-2010, Niklas Laxström
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
*/
/**
- * MediaWiki specific message checks.
+ * %MediaWiki specific message checks.
*
* @ingroup MessageCheckers
*/
Modified: trunk/extensions/Translate/groups/MediaWiki/setup.php
===================================================================
--- trunk/extensions/Translate/groups/MediaWiki/setup.php 2010-09-06
09:26:14 UTC (rev 72473)
+++ trunk/extensions/Translate/groups/MediaWiki/setup.php 2010-09-06
09:44:24 UTC (rev 72474)
@@ -1,15 +1,15 @@
<?php
/**
- * Support MediaWiki: http://www.mediawiki.org/.
+ * Support %MediaWiki: http://www.mediawiki.org/.
*
* @file
- * @ingroup Extensions
- *
* @author Niklas Laxström
- * @copyright Copyright © 2008-2009, Niklas Laxström
+ * @copyright Copyright © 2008-2010, Niklas Laxström
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
+ * @todo Remove once %MediaWiki core group uses yaml configuration.
*/
-
+/// @cond
$dir = dirname( __FILE__ );
-$wgAutoloadClasses['MediaWikiMessageChecker'] = dirname( __FILE__ ) .
'/Checker.php';
\ No newline at end of file
+$wgAutoloadClasses['MediaWikiMessageChecker'] = dirname( __FILE__ ) .
'/Checker.php';
+/// @endcond
\ No newline at end of file
Modified: trunk/extensions/Translate/groups/MediaWikiExtensions.php
===================================================================
--- trunk/extensions/Translate/groups/MediaWikiExtensions.php 2010-09-06
09:26:14 UTC (rev 72473)
+++ trunk/extensions/Translate/groups/MediaWikiExtensions.php 2010-09-06
09:44:24 UTC (rev 72474)
@@ -1,6 +1,6 @@
<?php
/**
- * Classes for MediaWiki extension translation.
+ * Classes for %MediaWiki extension translation.
*
* @file
* @author Niklas Laxström
@@ -9,7 +9,7 @@
*/
/**
- * @todo Needs documentation.
+ * Class which handles special definition format for %MediaWiki extensions.
*/
class PremadeMediawikiExtensionGroups {
protected $groups;
@@ -24,6 +24,7 @@
$this->path = $wgTranslateExtensionDirectory;
}
+ /// Initialisation function
public function init() {
if ( $this->groups !== null ) return;
@@ -167,10 +168,12 @@
$this->groups = $fixedGroups;
}
+ /// Makes an group id from extension name
static function foldId( $name ) {
return preg_replace( '/\s+/', '', strtolower( $name ) );
}
+ /// Registers all extensions
public function addAll() {
global $wgTranslateAC, $wgTranslateEC;
$this->init();
@@ -229,8 +232,9 @@
}
/**
- * Adds a message group containing all supported MediaWiki extensions in the
+ * Adds a message group containing all supported %MediaWiki extensions in the
* Wikimedia Subversion repository.
+ * @deprecated Replaced by AggregateMessageGroup and yaml configuration.
*/
class AllMediawikiExtensionsGroup extends MessageGroupOld {
protected $label = 'MediaWiki extensions';
Modified: trunk/extensions/Translate/groups/OpenLayers.php
===================================================================
--- trunk/extensions/Translate/groups/OpenLayers.php 2010-09-06 09:26:14 UTC
(rev 72473)
+++ trunk/extensions/Translate/groups/OpenLayers.php 2010-09-06 09:44:24 UTC
(rev 72474)
@@ -9,7 +9,9 @@
*/
/**
- * @deprecated Use new style class OpenLayersFFS.
+ * %Message group for OpenLayers.
+ * @todo Use new style group configuration.
+ * @todo Use new style class OpenLayersFFS.
*/
class OpenLayersMessageGroup extends MessageGroupOld {
protected $label = 'OpenLayers (slippy maps)';
Modified: trunk/extensions/Translate/groups/Voctrain.php
===================================================================
--- trunk/extensions/Translate/groups/Voctrain.php 2010-09-06 09:26:14 UTC
(rev 72473)
+++ trunk/extensions/Translate/groups/Voctrain.php 2010-09-06 09:44:24 UTC
(rev 72474)
@@ -4,12 +4,13 @@
* http://www.omegawiki.org/extensions/Wikidata/util/voctrain/trainer.php
*
* @file
- * @ingroup Extensions
- *
- * @copyright Copyright © 2009, Niklas Laxström
+ * @copyright Copyright © 2009-2010, Niklas Laxström
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
*/
+/**
+ * Old-style message group for Vocabulary trainer.
+ */
class VoctrainMessageGroup extends ExtensionMessageGroup {
public function getChecker() {
@@ -23,6 +24,9 @@
}
+/**
+ * %Message checker for Vocabulary trainer.
+ */
class VoctrainMessageChecker extends MessageChecker {
/**
* Checks for missing and unknown parameters
Modified: trunk/extensions/Translate/groups/Wikia/WikiaExtensions.php
===================================================================
--- trunk/extensions/Translate/groups/Wikia/WikiaExtensions.php 2010-09-06
09:26:14 UTC (rev 72473)
+++ trunk/extensions/Translate/groups/Wikia/WikiaExtensions.php 2010-09-06
09:44:24 UTC (rev 72474)
@@ -9,7 +9,7 @@
*/
/**
- * @todo Needs documentation.
+ * Support for %MediaWiki extensions in Wikias repository.
*/
class PremadeWikiaExtensionGroups extends PremadeMediawikiExtensionGroups {
protected $useConfigure = false;
@@ -43,7 +43,7 @@
* Adds a message group containing all supported Wikia extensions in the
* Wikia Subversion repository and the Wikimedia Subversion.
*
- * @todo Needs documentation.
+ * @todo Migrate to yaml configuration
*/
class AllWikiaExtensionsGroup extends AllMediawikiExtensionsGroup {
protected $description = '{{int:translate-group-desc-wikiaextensions}}';
Modified: trunk/extensions/Translate/scripts/fuzzy.php
===================================================================
--- trunk/extensions/Translate/scripts/fuzzy.php 2010-09-06 09:26:14 UTC
(rev 72473)
+++ trunk/extensions/Translate/scripts/fuzzy.php 2010-09-06 09:44:24 UTC
(rev 72474)
@@ -8,6 +8,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
*/
+/// @cond
+
require( dirname( __FILE__ ) . '/cli.inc' );
# Override the memory limit for wfShellExec, 100 MB seems to be too little
@@ -54,16 +56,27 @@
$bot->execute();
+/// @endcond
+
+
/**
- * @todo Needs documentation.
+ * Class for marking translation fuzzy.
*/
class FuzzyBot {
+ /// \list{String} List of patterns to mark.
private $titles = array();
+ /// \bool Check for configuration problems.
private $allclear = false;
+ /// \bool Dont do anything unless confirmation is given
public $dryrun = true;
+ /// \string Edit summary.
public $comment = null;
+ /// \list{String} List of language codes to skip.
public $skipLanguages = array();
+ /**
+ * @param $titles \list{String}
+ */
public function __construct( $titles ) {
$this->titles = $titles;
@@ -93,6 +106,7 @@
}
}
+ /// Searches pages that match given patterns
private function getPages() {
global $wgTranslateMessageNamespaces;
$dbr = wfGetDB( DB_SLAVE );
@@ -136,6 +150,10 @@
return $messagesContents;
}
+ /**
+ * Create FuzzyBot user if necessary.
+ * @return \type{User}
+ */
public function getImportUser() {
static $user = null;
@@ -152,6 +170,13 @@
return $user;
}
+ /**
+ * Does the actual edit if possible.
+ * @param $title \type{Title}
+ * @param $text \string
+ * @param $dryrun \bool Whether to really do it or just show what would
be done.
+ * @param $comment \string Edit summary.
+ */
private function updateMessage( $title, $text, $dryrun, $comment = null
) {
global $wgTranslateDocumentationLanguageCode, $wgUser;
@@ -175,7 +200,7 @@
return;
}
- $article = new Article( $title );
+ $article = new Article( $title, 0 );
$status = $article->doEdit( $text, $comment ? $comment :
'Marking as fuzzy', EDIT_FORCE_BOT | EDIT_UPDATE );
Modified: trunk/extensions/Translate/scripts/mwcore-export.php
===================================================================
--- trunk/extensions/Translate/scripts/mwcore-export.php 2010-09-06
09:26:14 UTC (rev 72473)
+++ trunk/extensions/Translate/scripts/mwcore-export.php 2010-09-06
09:44:24 UTC (rev 72474)
@@ -1,14 +1,15 @@
<?php
/**
- * Script to export special core features of MediaWiki.
+ * Script to export special core features of %MediaWiki.
*
* @author Niklas Laxstrom
- *
- * @copyright Copyright © 2009, Niklas Laxström
+ * @copyright Copyright © 2009-2010, Niklas Laxström
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
* @file
*/
+/// @cond
+
$optionsWithArgs = array( 'lang', 'target', 'type' );
require( dirname( __FILE__ ) . '/cli.inc' );
@@ -126,3 +127,5 @@
file_put_contents( $outFile, $data );
}
}
+
+/// @endcond
\ No newline at end of file
Modified: trunk/extensions/Translate/scripts/pagetranslation-check-database.php
===================================================================
--- trunk/extensions/Translate/scripts/pagetranslation-check-database.php
2010-09-06 09:26:14 UTC (rev 72473)
+++ trunk/extensions/Translate/scripts/pagetranslation-check-database.php
2010-09-06 09:44:24 UTC (rev 72474)
@@ -18,7 +18,9 @@
require_once( "$IP/maintenance/Maintenance.php" );
/**
- * @todo Needs documentation.
+ * Script to check the consistency of the databases of the page translation
+ * feature and fix problems.
+ * @todo Document methods.
*/
class PTCheckDB extends Maintenance {
public function __construct() {
Modified: trunk/extensions/Translate/scripts/pagetranslation-test-parser.php
===================================================================
--- trunk/extensions/Translate/scripts/pagetranslation-test-parser.php
2010-09-06 09:26:14 UTC (rev 72473)
+++ trunk/extensions/Translate/scripts/pagetranslation-test-parser.php
2010-09-06 09:44:24 UTC (rev 72474)
@@ -3,7 +3,6 @@
* Script to test page translation parser
*
* @author Niklas Laxstrom
- *
* @copyright Copyright © 2010, Niklas Laxström
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
* @file
@@ -18,7 +17,8 @@
require_once( "$IP/maintenance/Maintenance.php" );
/**
- * @todo Needs documentation.
+ * Custom testing framework for page translation parser.
+ * @ingroup PageTranslation Maintenance
*/
class PageTranslationParserTester extends Maintenance {
public function __construct() {
Modified: trunk/extensions/Translate/scripts/sync-group.php
===================================================================
--- trunk/extensions/Translate/scripts/sync-group.php 2010-09-06 09:26:14 UTC
(rev 72473)
+++ trunk/extensions/Translate/scripts/sync-group.php 2010-09-06 09:44:24 UTC
(rev 72474)
@@ -2,15 +2,14 @@
/**
* Command line script to import/update source messages and translations into
the wiki database.
*
- * @file
- * @ingroup Extensions
- *
* @author Niklas Laxström
- * @copyright Copyright © 2007-2009, Niklas Laxström
+ * @copyright Copyright © 2007-2010, Niklas Laxström
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
* @file
*/
+/// @cond
+
$optionsWithArgs = array( 'group', 'lang', 'start', 'end' );
require( dirname( __FILE__ ) . '/cli.inc' );
@@ -129,20 +128,27 @@
unset( $group );
}
+/// @endcond
+
/**
- * @todo Needs documentation.
+ * Simple external changes syncer and conflict resolution.
*/
class ChangeSyncer {
- public $group;
- public $norc = false;
- public $interactive = true;
- public $nocolor = false;
+ public $group; ///< \type{MessageGroup}
+ public $norc = false; ///< \bool Don't list changes in recent changes
table.
+ public $interactive = true; ///< \bool Whether the script can ask
questions.
+ public $nocolor = false; ///< \bool Disable colour output.
public function __construct( MessageGroup $group ) {
$this->group = $group;
}
// svn component from pecl doesn't seem to have this in quick sight
+ /**
+ * Fetch last changed timestamp for a versioned file for conflict
resolution.
+ * @param $file \string Filename with full path.
+ * @return \string Timestamp or false.
+ */
public function getTimestampsFromSvn( $file ) {
$file = escapeshellarg( $file );
$retval = 0;
@@ -166,6 +172,11 @@
return false;
}
+ /**
+ * Fetch last changed timestamp for any file for conflict resolution.
+ * @param $file \string Filename with full path.
+ * @return \string Timestamp or false.
+ */
public function getTimestampsFromFs( $file ) {
if ( !file_exists( $file ) ) {
return false;
@@ -176,6 +187,13 @@
return $stat['mtime'];
}
+ /**
+ * Do some conflict resolution for translations.
+ * @param $code \string Language code.
+ * @param $startTs \int Time of the last export (changes in wiki after
this will conflict)
+ * @param $endTs \int Time of the last export (changes in source before
this wont conflict)
+ * @param $changeTs \int When change happened in the source.
+ */
public function checkConflicts( $code, $startTs = false, $endTs =
false, $changeTs = false ) {
$messages = $this->group->load( $code );
@@ -294,6 +312,12 @@
}
}
+ /**
+ * Colours text for shell output
+ * @param $color \string Either blue, green or bold.
+ * @param $text \string
+ * @return \string
+ */
public function color( $color, $text ) {
switch ( $color ) {
case 'blue':
@@ -307,6 +331,12 @@
}
}
+ /**
+ * Try to identify when the translation was last changed in the wiki.
+ * @param $title \type{Title} Title of the page which contains
translation.
+ * @param $startTs \int Timestamp how far back to go before giving up.
+ * @return \int Timestamp or false.
+ */
public function getLastGoodChange( $title, $startTs = false ) {
global $wgTranslateFuzzyBotName;
@@ -330,6 +360,10 @@
return $wikiTs;
}
+ /**
+ * Initialises FuzzyBot if necessary.
+ * @return \type{User}
+ */
public function getImportUser() {
static $user = null;
@@ -347,6 +381,12 @@
return $user;
}
+ /**
+ * Does the actual edit.
+ * @param $title \type{Title}
+ * @param $translation \string
+ * @param $comment \string Edit summary.
+ */
public function import( $title, $translation, $comment ) {
global $wgUser;
@@ -358,7 +398,7 @@
$flags |= EDIT_SUPPRESS_RC;
}
- $article = new Article( $title );
+ $article = new Article( $title, 0 );
STDOUT( "Importing {$title->getPrefixedText()}: ", $title );
$status = $article->doEdit( $translation, $comment, $flags );
$success = $status === true || ( is_object( $status ) &&
$status->isOK() );
@@ -368,4 +408,5 @@
}
}
+// Print timestamp if the user wants to store it
STDOUT( wfTimestamp( TS_RFC2822 ) );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs