More documentation tweaks/additions

This commit is contained in:
Sam Reed 2011-05-26 20:26:51 +00:00
parent f88d921ca2
commit 912b95a104
9 changed files with 136 additions and 10 deletions

View file

@ -109,7 +109,7 @@ class EditPage {
/**
* @todo document
* @param $article
* @param $article Article
*/
function __construct( $article ) {
$this->mArticle =& $article;
@ -128,6 +128,9 @@ class EditPage {
$this->mPreloadText = "";
}
/**
* @return Article
*/
function getArticle() {
return $this->mArticle;
}

View file

@ -10,7 +10,10 @@ class GenderCache {
protected $default;
protected $misses = 0;
protected $missLimit = 1000;
/**
* @return GenderCache
*/
public static function singleton() {
static $that = null;
if ( $that === null ) {
@ -34,7 +37,7 @@ class GenderCache {
/**
* Returns the gender for given username.
* @param $users String: username
* @param $username String: username
* @param $caller String: the calling method
* @return String
*/
@ -70,6 +73,9 @@ class GenderCache {
/**
* Wrapper for doQuery that processes raw LinkBatch data.
*
* @param $data
* @param $caller
*/
public function doLinkBatch( $data, $caller = '' ) {
$users = array();
@ -82,7 +88,6 @@ class GenderCache {
}
$this->doQuery( array_keys( $users ), $caller );
}
/**

View file

@ -50,8 +50,17 @@
* @ingroup ExternalUser
*/
class ExternalUser_MediaWiki extends ExternalUser {
private $mRow, $mDb;
private $mRow;
/**
* @var DatabaseBase
*/
private $mDb;
/**
* @param $name string
* @return bool
*/
protected function initFromName( $name ) {
# We might not need the 'usable' bit, but let's be safe. Theoretically
# this might return wrong results for old versions, but it's probably
@ -65,10 +74,18 @@ class ExternalUser_MediaWiki extends ExternalUser {
return $this->initFromCond( array( 'user_name' => $name ) );
}
/**
* @param $id int
* @return bool
*/
protected function initFromId( $id ) {
return $this->initFromCond( array( 'user_id' => $id ) );
}
/**
* @param $cond array
* @return bool
*/
private function initFromCond( $cond ) {
global $wgExternalAuthConf;
@ -105,6 +122,9 @@ class ExternalUser_MediaWiki extends ExternalUser {
return $this->mRow->user_id;
}
/**
* @return string
*/
public function getName() {
return $this->mRow->user_name;
}
@ -126,6 +146,9 @@ class ExternalUser_MediaWiki extends ExternalUser {
return null;
}
/**
* @return array
*/
public function getGroups() {
# @todo FIXME: Untested.
$groups = array();

View file

@ -41,6 +41,9 @@ class MysqlInstaller extends DatabaseInstaller {
'CREATE TEMPORARY TABLES',
);
/**
* @return string
*/
public function getName() {
return 'mysql';
}
@ -49,14 +52,23 @@ class MysqlInstaller extends DatabaseInstaller {
parent::__construct( $parent );
}
/**
* @return Bool
*/
public function isCompiled() {
return self::checkExtension( 'mysql' );
}
/**
* @return array
*/
public function getGlobalDefaults() {
return array();
}
/**
* @return string
*/
public function getConnectForm() {
return
$this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
@ -111,6 +123,9 @@ class MysqlInstaller extends DatabaseInstaller {
return $status;
}
/**
* @return Status
*/
public function openConnection() {
$status = Status::newGood();
try {
@ -187,6 +202,8 @@ class MysqlInstaller extends DatabaseInstaller {
/**
* Get a list of storage engines that are available and supported
*
* @return array
*/
public function getEngines() {
$engines = array( 'InnoDB', 'MyISAM' );
@ -215,6 +232,8 @@ class MysqlInstaller extends DatabaseInstaller {
/**
* Get a list of character sets that are available and supported
*
* @return array
*/
public function getCharsets() {
$status = $this->getConnection();
@ -231,6 +250,8 @@ class MysqlInstaller extends DatabaseInstaller {
/**
* Return true if the install user can create accounts
*
* @return bool
*/
public function canCreateAccounts() {
$status = $this->getConnection();
@ -304,6 +325,9 @@ class MysqlInstaller extends DatabaseInstaller {
return true;
}
/**
* @return string
*/
public function getSettingsForm() {
if ( $this->canCreateAccounts() ) {
$noCreateMsg = false;
@ -368,6 +392,9 @@ class MysqlInstaller extends DatabaseInstaller {
return $s;
}
/**
* @return Status
*/
public function submitSettingsForm() {
$this->setVarsFromRequest( array( '_MysqlEngine', '_MysqlCharset' ) );
$status = $this->submitWebUserBox();
@ -423,6 +450,9 @@ class MysqlInstaller extends DatabaseInstaller {
$this->parent->addInstallStep( $callback, 'tables' );
}
/**
* @return Status
*/
public function setupDatabase() {
$status = $this->getConnection();
if ( !$status->isOK() ) {
@ -438,6 +468,9 @@ class MysqlInstaller extends DatabaseInstaller {
return $status;
}
/**
* @return Status
*/
public function setupUser() {
$dbUser = $this->getVar( 'wgDBuser' );
if( $dbUser == $this->getVar( '_InstallUser' ) ) {
@ -580,6 +613,8 @@ class MysqlInstaller extends DatabaseInstaller {
/**
* Get variables to substitute into tables.sql and the SQL patch files.
*
* @return array
*/
public function getSchemaVars() {
return array(

View file

@ -12,6 +12,10 @@
* @ingroup Media
*/
class DjVuHandler extends ImageHandler {
/**
* @return bool
*/
function isEnabled() {
global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuToXML;
if ( !$wgDjvuRenderer || ( !$wgDjvuDump && !$wgDjvuToXML ) ) {
@ -22,9 +26,25 @@ class DjVuHandler extends ImageHandler {
}
}
function mustRender( $file ) { return true; }
function isMultiPage( $file ) { return true; }
/**
* @param $file
* @return bool
*/
function mustRender( $file ) {
return true;
}
/**
* @param $file
* @return bool
*/
function isMultiPage( $file ) {
return true;
}
/**
* @return array
*/
function getParamMap() {
return array(
'img_width' => 'width',
@ -32,6 +52,11 @@ class DjVuHandler extends ImageHandler {
);
}
/**
* @param $name
* @param $value
* @return bool
*/
function validateParam( $name, $value ) {
if ( in_array( $name, array( 'width', 'height', 'page' ) ) ) {
if ( $value <= 0 ) {
@ -44,6 +69,10 @@ class DjVuHandler extends ImageHandler {
}
}
/**
* @param $params
* @return bool|string
*/
function makeParamString( $params ) {
$page = isset( $params['page'] ) ? $params['page'] : 1;
if ( !isset( $params['width'] ) ) {
@ -52,6 +81,10 @@ class DjVuHandler extends ImageHandler {
return "page{$page}-{$params['width']}px";
}
/**
* @param $str
* @return array|bool
*/
function parseParamString( $str ) {
$m = false;
if ( preg_match( '/^page(\d+)-(\d+)px$/', $str, $m ) ) {
@ -61,6 +94,10 @@ class DjVuHandler extends ImageHandler {
}
}
/**
* @param $params
* @return array
*/
function getScriptParams( $params ) {
return array(
'width' => $params['width'],
@ -133,6 +170,8 @@ class DjVuHandler extends ImageHandler {
/**
* Cache an instance of DjVuImage in an Image object, return that instance
*
* @return DjVuImage
*/
function getDjVuImage( $image, $path ) {
if ( !$image ) {

View file

@ -31,7 +31,11 @@ class PNGHandler extends BitmapHandler {
return serialize($metadata);
}
/**
* @param $image File
* @return array|bool
*/
function formatMetadata( $image ) {
$meta = $image->getMetadata();

View file

@ -27,10 +27,17 @@ class Preprocessor_DOM implements Preprocessor {
}
}
/**
* @return PPFrame_DOM
*/
function newFrame() {
return new PPFrame_DOM( $this );
}
/**
* @param $args
* @return PPCustomFrame_DOM
*/
function newCustomFrame( $args ) {
return new PPCustomFrame_DOM( $this, $args );
}

View file

@ -64,10 +64,18 @@ class BrokenRedirectsPage extends PageQueryPage {
);
}
/**
* @return array
*/
function getOrderFields() {
return array ( 'rd_namespace', 'rd_title', 'rd_from' );
}
/**
* @param $skin Skin
* @param $result
* @return String
*/
function formatResult( $skin, $result ) {
global $wgUser, $wgContLang, $wgLang;
@ -101,7 +109,7 @@ class BrokenRedirectsPage extends PageQueryPage {
array(),
array( 'action' => 'edit' )
);
$to = $skin->link(
$to = $skin->link(
$toObj,
null,
array(),

View file

@ -102,7 +102,9 @@ class DisambiguationsPage extends PageQueryPage {
}
/**
* Fetch links and cache their existence
* Fetch links and cache their existence
*
* @param $db DatabaseBase
*/
function preprocessResults( $db, $res ) {
$batch = new LinkBatch;