http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72091
Revision: 72091
Author: nikerabbit
Date: 2010-09-01 09:07:05 +0000 (Wed, 01 Sep 2010)
Log Message:
-----------
Documentation updates
Modified Paths:
--------------
trunk/extensions/Translate/utils/MemProfile.php
trunk/extensions/Translate/utils/MemoryCache.php
trunk/extensions/Translate/utils/MessageGroupCache.php
Modified: trunk/extensions/Translate/utils/MemProfile.php
===================================================================
--- trunk/extensions/Translate/utils/MemProfile.php 2010-09-01 08:25:55 UTC
(rev 72090)
+++ trunk/extensions/Translate/utils/MemProfile.php 2010-09-01 09:07:05 UTC
(rev 72091)
@@ -1,7 +1,7 @@
<?php
if ( !defined( 'MEDIAWIKI' ) ) die();
/**
- * Helper functions to locate when memory is consumed
+ * Very crude tools to track memory usage
*
* @file
* @author Niklas Laxström
@@ -9,11 +9,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
*/
+/// Memory usage at checkpoints
$wgMemUse = array();
+/// Tracks the deepness of the stack
$wgMemStack = 0;
/**
- * @todo Needs documentation.
+ * Call to start memory counting for a block.
+ * @param $a \string Block name.
*/
function wfMemIn( $a ) {
global $wgLang, $wgMemUse, $wgMemStack;
@@ -32,7 +35,8 @@
}
/**
- * @todo Needs documentation.
+ * Call to start stop counting for a block. Difference from start is shown.
+ * @param $a \string Block name.
*/
function wfMemOut( $a ) {
global $wgLang, $wgMemUse, $wgMemStack;
Modified: trunk/extensions/Translate/utils/MemoryCache.php
===================================================================
--- trunk/extensions/Translate/utils/MemoryCache.php 2010-09-01 08:25:55 UTC
(rev 72090)
+++ trunk/extensions/Translate/utils/MemoryCache.php 2010-09-01 09:07:05 UTC
(rev 72091)
@@ -1,6 +1,6 @@
<?php
/**
- * @todo Needs documentation.
+ * Code for caching translation completion percentages.
*
* @file
* @author Niklas Laxström
@@ -9,27 +9,39 @@
*/
/**
- * @todo Needs documentation.
+ * Class for caching translation completion percentages.
+ * @todo Figure out a better name.
+ * @todo Tries to be generic, but is not.
*/
class ArrayMemoryCache {
- protected $table;
+ /// Key for the data stored
protected $key;
+ /// Memory cache wrapper
protected $memc;
+ /// Object cache of the data
protected $cache;
+ /**
+ * Constructor
+ * @param $table \string Name of the cache.
+ */
public function __construct( $table ) {
- $this->table = $table;
- $this->key = wfMemcKey( $this->table );
+ $this->key = wfMemcKey( $table );
global $wgMemc;
$this->memc = $wgMemc;
}
+ /// Destructor
public function __destruct() {
$this->save();
}
+ /**
+ * @copydoc ArrayMemoryCache::__construct()
+ * Static factory function for the constructor.
+ */
public static function factory( $table ) {
// __CLASS__ doesn't work, but this is PHP
return new ArrayMemoryCache( $table );
Modified: trunk/extensions/Translate/utils/MessageGroupCache.php
===================================================================
--- trunk/extensions/Translate/utils/MessageGroupCache.php 2010-09-01
08:25:55 UTC (rev 72090)
+++ trunk/extensions/Translate/utils/MessageGroupCache.php 2010-09-01
09:07:05 UTC (rev 72091)
@@ -45,7 +45,7 @@
/**
* Returns list of message keys that are stored.
- * @return \List{String} Message keys that can be passed one-by-one to
get() method.
+ * @return \list{String} Message keys that can be passed one-by-one to
get() method.
*/
public function getKeys() {
return unserialize( $this->open()->get( '#keys' ) );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs