Revision: 43538
Author: ialex
Date: 2008-11-15 09:16:52 +0000 (Sat, 15 Nov 2008)
Log Message:
-----------
* Added CHANGLEOG entry
* Document $wgConfigureAPI
* Fixed some code style
* Removed trailing whitespaces
Modified Paths:
--------------
trunk/extensions/Configure/CHANGELOG
trunk/extensions/Configure/Configure.api.php
trunk/extensions/Configure/Configure.ext.php
trunk/extensions/Configure/Configure.func.php
trunk/extensions/Configure/Configure.handler-db.php
trunk/extensions/Configure/Configure.handler-files.php
trunk/extensions/Configure/Configure.handler.php
trunk/extensions/Configure/Configure.js
trunk/extensions/Configure/Configure.obj.php
trunk/extensions/Configure/Configure.page.php
trunk/extensions/Configure/Configure.pager-files.php
trunk/extensions/Configure/Configure.php
trunk/extensions/Configure/Configure.settings-core.php
trunk/extensions/Configure/Configure.settings-ext.php
trunk/extensions/Configure/Configure.settings.php
trunk/extensions/Configure/SpecialConfigure.php
trunk/extensions/Configure/SpecialExtensions.php
trunk/extensions/Configure/SpecialViewConfig.php
trunk/extensions/Configure/findSettings.php
trunk/extensions/Configure/manage.inc
trunk/extensions/Configure/manage.php
trunk/extensions/Configure/migrateToDB.inc
trunk/extensions/Configure/translateSettings.php
trunk/extensions/Configure/writePHP.inc
Modified: trunk/extensions/Configure/CHANGELOG
===================================================================
--- trunk/extensions/Configure/CHANGELOG 2008-11-15 09:07:31 UTC (rev
43537)
+++ trunk/extensions/Configure/CHANGELOG 2008-11-15 09:16:52 UTC (rev
43538)
@@ -1,6 +1,12 @@
This file lists changes on this extension.
Localisation updates are done on betawiki and aren't listed here.
+0.10.0 - 15 November 2008
+ * Added $wgConfigureFileSystemCache to allow file-system cache (only with
+ database handler)
+ * Added description for each setting.
+ * API module can now be disabled with $wgConfigureAPI.
+
0.9.7 - 14 November 2008
* Added SocialProfile, SpamRegex and UserMerge extensions.
* Updated Inputbox extension.
Modified: trunk/extensions/Configure/Configure.api.php
===================================================================
--- trunk/extensions/Configure/Configure.api.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/Configure.api.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -11,9 +11,9 @@
global $wgConf, $wgUser, $wgConfigureWikis;
$params = $this->extractRequestParams();
$result = $this->getResult();
-
+
if( !$wgConf instanceof WebConfiguration ){
- $this->dieUsage( 'You need to call efConfigureSetup()
to use this module', 'noconf' );
+ $this->dieUsage( 'You need to call efConfigureSetup()
to use this module', 'noconf' );
}
// Version list
@@ -95,7 +95,7 @@
}
$result->addValue( 'configure', 'settings', $ret );
}
-
+
// Extensions
if( in_array( 'extensions', $params['prop'] ) ) {
if( !$wgUser->isAllowed( 'extensions' ) )
@@ -148,6 +148,7 @@
break;
case 'text':
case 'lang':
+ case 'image-url':
$settingVal = (string)$settingVal;
case 'int':
$settingRet['type'] = $type;
Modified: trunk/extensions/Configure/Configure.ext.php
===================================================================
--- trunk/extensions/Configure/Configure.ext.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/Configure.ext.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -43,7 +43,7 @@
* @return string
*/
public function getName(){
- return $this->mName;
+ return $this->mName;
}
/**
@@ -108,7 +108,7 @@
public function hasSchemaChange(){
return $this->mDbChange;
}
-
+
/**
* Get a url for the description of this extension (or null)
*
@@ -168,7 +168,7 @@
$ret .= "</fieldset>\n";
return $ret;
}
-
+
/**
* Return the name of the check that's used to select whether the
extension
* should be activated
@@ -176,7 +176,7 @@
public function getCheckName(){
return 'wpUse'.$this->mName;
}
-
+
/**
* Is this extension activated?
*
@@ -184,9 +184,9 @@
*/
public function isActivated(){
global $wgConf;
- return in_array( $this->getFile(), $wgConf->getIncludedFiles()
);
+ return in_array( $this->getFile(), $wgConf->getIncludedFiles()
);
}
-
+
/**
* Is this extension installed so that it can be used?
*
Modified: trunk/extensions/Configure/Configure.func.php
===================================================================
--- trunk/extensions/Configure/Configure.func.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/Configure.func.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -72,6 +72,9 @@
$wgConf->extract();
}
+/**
+ * Declare the API module only if $wgConfigureAPI is true
+ */
function efConfigureSetupAPI() {
global $wgConfigureAPI, $wgAPIModules;
if( $wgConfigureAPI === true ) {
@@ -86,5 +89,5 @@
global $wgRestrictionLevels;
$newrights = array_diff( $wgRestrictionLevels, array( '', 'sysop' ) );
// Pseudo rights
$rights = array_unique( array_merge( $rights, $newrights ) );
- return true;
-}
\ No newline at end of file
+ return true;
+}
Modified: trunk/extensions/Configure/Configure.handler-db.php
===================================================================
--- trunk/extensions/Configure/Configure.handler-db.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/Configure.handler-db.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -24,7 +24,7 @@
* @return Database object
*/
public function getSlaveDB() {
- return wfGetDB( DB_SLAVE, 'config', $this->mDb );
+ return wfGetDB( DB_SLAVE, 'config', $this->mDb );
}
/**
@@ -32,7 +32,7 @@
* @return Database object
*/
public function getMasterDB() {
- return wfGetDB( DB_MASTER, 'config', $this->mDb );
+ return wfGetDB( DB_MASTER, 'config', $this->mDb );
}
/**
@@ -50,40 +50,40 @@
protected function getCache() {
return wfGetMainCache();
}
-
+
/**
* Checks if it's cached on the filesystem.
*/
protected function getFSCached() {
global $wgConfigureFileSystemCache,
$wgConfigureFileSystemCacheExpiry;
-
+
$expiry = $wgConfigureFileSystemCacheExpiry;
-
- if (!($path = $wgConfigureFileSystemCache))
+
+ if ( !( $path = $wgConfigureFileSystemCache ) )
return null;
-
- if (!file_exists($path))
+
+ if ( !file_exists( $path ) )
return null;
-
- $mtime = filemtime($path);
-
- if ( time() > ($mtime + $expiry) ) ## Regenerate every five
minutes or so
+
+ $mtime = filemtime( $path );
+
+ if ( time() > ( $mtime + $expiry ) ) ## Regenerate every five
minutes or so
return null;
-
+
## Suppress errors, if there's an error, it'll just be null and
we'll do it again.
$data = @unserialize( file_get_contents( $path ) );
-
+
return $data;
}
-
+
/**
* Cache the data to the filesystem.
* @returns int bytes
*/
protected function cacheToFS( $data ) {
global $wgConfigureFileSystemCache;
-
- return @file_put_contents( $wgConfigureFileSystemCache,
serialize($data) );
+
+ return @file_put_contents( $wgConfigureFileSystemCache,
serialize( $data ) );
}
/**
@@ -92,22 +92,22 @@
*/
public function getCurrent( $useCache = true ){
static $ipCached = null;
-
+
if ($ipCached && $useCache) ## In-process caching...
return $ipCached;
-
+
## Check filesystem cache
- if (($cached = $this->getFSCached()) && $useCache) {
- $this->cacheToFS($cached);
+ if ( ( $cached = $this->getFSCached()) && $useCache ) {
+ $this->cacheToFS( $cached );
return $ipCached = $cached;
}
-
+
$cacheKey = $this->cacheKey( 'configure', 'current' );
$cached = $this->getCache()->get( $cacheKey );
if( is_array( $cached ) && $useCache ){
return $ipCached = $cached;
}
-
+
try {
$dbr = $this->getSlaveDB();
$ret = $dbr->select(
@@ -124,7 +124,7 @@
}
$this->getCache()->set( $cacheKey, $arr, 3600 );
$this->cacheToFS($arr);
-
+
return $ipCached = $arr;
} catch( MWException $e ) {
return array();
@@ -181,7 +181,7 @@
* Save a new configuration
* @param $settings array of settings
* @param $wiki String: wiki name or true for all
- * @param $ts
+ * @param $ts
* @return bool true on success
*/
public function saveNewSettings( $settings, $wiki, $ts = false ){
@@ -215,8 +215,8 @@
__METHOD__
);
$newId = $dbw->insertId();
- $dbw->update( 'config_version',
- array( 'cv_is_latest' => 0 ),
+ $dbw->update( 'config_version',
+ array( 'cv_is_latest' => 0 ),
array( 'cv_wiki' => $wiki, 'cv_timestamp <>
'.$dbw->addQuotes( $ts ) ),
__METHOD__ );
$insert = array();
@@ -265,7 +265,7 @@
return array( 'configure-db-table-error' );
return array();
}
-
+
/**
* Get settings that are not editable with the database handler
*/
@@ -302,6 +302,6 @@
'wgMemCachedDebug',
'wgMemCachedPersistent',
'wgMemCachedServers',
- );
+ );
}
}
Modified: trunk/extensions/Configure/Configure.handler-files.php
===================================================================
--- trunk/extensions/Configure/Configure.handler-files.php 2008-11-15
09:07:31 UTC (rev 43537)
+++ trunk/extensions/Configure/Configure.handler-files.php 2008-11-15
09:16:52 UTC (rev 43538)
@@ -11,9 +11,6 @@
/**
* Construct a new object.
- *
- * @param string $path path to the directory that contains the
configuration
- * files
*/
public function __construct(){
global $wgConfigureFilesPath;
@@ -129,12 +126,12 @@
if( !is_dir( $this->getDir() ) ){
return array( 'configure-no-directory', $this->getDir()
);
}
-
+
// And that it's writable by PHP
if( !is_writable( $this->getDir() ) ){
return array( 'configure-directory-not-writable',
$this->getDir() );
}
-
+
return array();
}
@@ -142,7 +139,7 @@
* All settings are editable!
*/
public function getNotEditableSettings(){
- return array();
+ return array();
}
/**
Modified: trunk/extensions/Configure/Configure.handler.php
===================================================================
--- trunk/extensions/Configure/Configure.handler.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/Configure.handler.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -61,7 +61,7 @@
* @return array
*/
public function doChecks();
-
+
/**
* Get settings that are not editable with this handler
* @return array
Modified: trunk/extensions/Configure/Configure.js
===================================================================
--- trunk/extensions/Configure/Configure.js 2008-11-15 09:07:31 UTC (rev
43537)
+++ trunk/extensions/Configure/Configure.js 2008-11-15 09:16:52 UTC (rev
43538)
@@ -99,7 +99,7 @@
toggleToc.style.align = "right";
toggleToc.onmousedown = toggleToc.onclick = configTocToggle;
toggleToc.appendChild( getArrowImg( 'l' ) );
-
+
var par = configform.parentNode;
var table = document.createElement( 'table' );
var tr = document.createElement( 'tr' );
@@ -121,7 +121,7 @@
var tables = getElementsByClassName( configform, 'table', 'assoc' );
var reg = new RegExp( '(^| )disabled($| )' );
for( var t = 0; t < tables.length ; t++ ){
- table = tables[t];
+ table = tables[t];
if( reg.test( table.className ) )
continue;
// Button "remove this row"
@@ -143,7 +143,7 @@
tr.appendChild( td );
}
}
- // Button "add a new row"
+ // Button "add a new row"
var button = document.createElement( 'input' );
button.type = 'button';
button.className = 'button-add';
@@ -151,20 +151,20 @@
button.onclick = createAssocCallback( table );
table.parentNode.appendChild( button );
}
-
+
var thumbs = getElementsByClassName( configform, 'input',
'image-selector' );
for( var t = 0; t < thumbs.length; t++ ){
var textbox = thumbs[t];
-
+
var button = document.createElement( 'input' );
button.type = 'button';
button.className = 'mw-button-get-image-url';
button.value = wgConfigureGetImageUrl;
button.onclick = createImageUrlCallback( textbox );
-
+
textbox.parentNode.appendChild( button );
}
-
+
// $wgGroupPermissions stuff, only if ajax is enabled
// --------------------------------------------------
@@ -191,7 +191,7 @@
tr.appendChild( td );
}
}
- // Button "add a new row"
+ // Button "add a new row"
var button = document.createElement( 'input' );
button.type = 'button';
button.className = 'button-add';
@@ -199,7 +199,7 @@
button.onclick = createGroupBoolCallback( table );
table.parentNode.appendChild( button );
}
-
+
document.getElementById( 'configure-form' ).onsubmit =
function(){
var tables = getElementsByClassName( configform,
'table', 'group-bool' );
for( var t = 0; t < tables.length ; t++ ){
@@ -290,7 +290,7 @@
* Remove a new row in a associative
*
* @param Dom object representing a table
- * @param integer
+ * @param integer
*/
function removeAssocRow( table, r ){
var trs = table.getElementsByTagName( 'tr' );
@@ -393,7 +393,7 @@
* Remove a new row in a "group-bool" table
*
* @param Dom object representing a table
- * @param integer
+ * @param integer
*/
function removeGroupBoolRow( table, r ){
var trs = table.getElementsByTagName( 'tr' );
Modified: trunk/extensions/Configure/Configure.obj.php
===================================================================
--- trunk/extensions/Configure/Configure.obj.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/Configure.obj.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -64,7 +64,7 @@
$this->settings["+$name"][$site] = $val;
}
else {
- $this->settings[$name][$site] =
$val;
+ $this->settings[$name][$site] =
$val;
}
}
}
@@ -103,7 +103,7 @@
$includes = $this->getIncludedFiles();
if( !count( $includes ) )
return;
-
+
// Since the files should be included from the global scope,
we'll need
// to import that variabled in this function
extract( $GLOBALS, EXTR_REFS );
@@ -190,7 +190,7 @@
$savedSettings = $this->settings;
$this->settings = $this->mOldSettings;
$globalDefaults = $this->getDefaults();
-
+
$savedGlobals = array();
foreach( $this->settings as $name => $val ){
if( substr( $name, 0, 1 ) == '+' ){
@@ -281,9 +281,9 @@
* @return ConfigurationHandler
*/
public function getHandler(){
- return $this->mHandler;
+ return $this->mHandler;
}
-
+
/**
* Merge array settings
*
Modified: trunk/extensions/Configure/Configure.page.php
===================================================================
--- trunk/extensions/Configure/Configure.page.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/Configure.page.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -54,7 +54,7 @@
return;
}
}
-
+
$wikiParam = ( $this->mCanEdit && $wgRequest->wasPosted() ) ?
'wpWiki' : 'wiki';
if( $wiki = $wgRequest->getVal( $wikiParam, false ) ){
if( $wgConf->getWiki() != $wiki ){
@@ -65,7 +65,7 @@
if( is_array( $wgConfigureWikis ) && !in_array(
$wiki, $wgConfigureWikis ) ){
$wgOut->wrapWikiMsg( '<div
class="errorbox"><strong>$1</strong></div>',
array(
'configure-transwiki-not-in-range', $wiki, implode( ', ', $wgConfigureWikis ) )
);
- return;
+ return;
}
}
$this->mWiki = $wiki;
@@ -95,7 +95,7 @@
} else {
$type = 'initial';
}
-
+
switch( $type ){
case 'submit':
$this->doSubmit();
@@ -211,7 +211,7 @@
}
return $notEditable;
}
-
+
/**
* Get a list of editable settings
*
@@ -303,7 +303,7 @@
if( is_null( $current ) )
$current =
$wgConf->getCurrent( $this->mWiki );
$this->conf[$name] +=
$current[$name];
- }
+ }
}
$wgOut->addWikiMsg( 'configure-edit-old' );
} else {
@@ -602,7 +602,7 @@
unset(
$settings[$name][$group] );
}
break;
- }
+ }
}
}
}
@@ -645,7 +645,7 @@
$this->buildAllSettings() . "\n" .
- ( $this->mCanEdit ?
+ ( $this->mCanEdit ?
Xml::openElement( 'div', array( 'id' =>
'prefsubmit' ) ) . "\n" .
Xml::openElement( 'div', array() ) . "\n" .
Xml::element( 'input', array( 'type' =>
'submit', 'name' => 'wpSave', 'class' => 'btnSavePrefs', 'value' => wfMsgHtml(
'configure-btn-save' ) ) ) . "\n" .
@@ -698,7 +698,7 @@
"<script type=\"{$wgJsMimeType}\"
src=\"{$wgScriptPath}/extensions/Configure/Configure.js?{$wgConfigureStyleVersion}\"></script>",
);
$wgOut->addScript( implode( "\n\t\t", $script ) . "\n" );
- }
+ }
/**
* Like before but only for the header
@@ -937,7 +937,7 @@
'rows' => 5, ) ) .
( isset( $default[$ns] ) ? implode(
"\n", (array)$default[$ns] ) : '' ) .
Xml::closeElement( 'textarea' ) .
"<br/>\n";
- else
+ else
$text .= "<pre>" . ( isset(
$default[$ns] ) ? htmlspecialchars( implode( "\n",(array)$default[$ns] ) ) : ''
) . "\n</pre>";
$text .= '</td></tr>';
}
@@ -1018,12 +1018,12 @@
if( $this->isSettingAvailable( $conf ) )
$td2 = Xml::openElement( 'td', $attribs ) .
$this->buildInput( $conf, $params ) . '</td>';
else
- $td2 = Xml::openElement( 'td', $attribs ) .
+ $td2 = Xml::openElement( 'td', $attribs ) .
wfMsgExt( 'configure-setting-not-available',
array( 'parseinline' ) ) . '</td>';
return '<tr>' . $td1 . $td2 . "</tr>\n";
}
-
+
/**
* Really build the content of the form
*
@@ -1033,7 +1033,7 @@
*/
protected function buildSettings( $settings, $param = array() ){
wfLoadExtensionMessages( 'ConfigureSettings' );
-
+
$ret = '';
$perms = array();
$notEditableSet = $this->getNotEditableSettings();
@@ -1046,7 +1046,7 @@
$res = $param['restrict'][$title];
elseif( isset( $param['restrict']['_default'] )
)
$res = $param['restrict']['_default'];
- else
+ else
$res = true;
} else {
$res = (bool)$param['restrict'];
@@ -1061,7 +1061,7 @@
$edit = $this->userCanEdit( $setting );
if( $edit )
$res = false;
- $perms[$setting] = array( 'read' =>
$read, 'edit' => $edit );
+ $perms[$setting] = array( 'read' =>
$read, 'edit' => $edit );
}
if( !count( $groups[$name] ) )
unset( $groups[$name] );
@@ -1079,7 +1079,7 @@
$showlink =
$param['showlink'][$title];
elseif( isset(
$param['showlink']['_default'] ) )
$showlink =
$param['showlink']['_default'];
- else
+ else
$showlink = true;
} else {
$showlink = (bool)$param['showlink'];
Modified: trunk/extensions/Configure/Configure.pager-files.php
===================================================================
--- trunk/extensions/Configure/Configure.pager-files.php 2008-11-15
09:07:31 UTC (rev 43537)
+++ trunk/extensions/Configure/Configure.pager-files.php 2008-11-15
09:16:52 UTC (rev 43538)
@@ -18,7 +18,7 @@
if( empty( $versions ) ){
return wfMsgExt( 'configure-no-old', array( 'parse' ) );
}
-
+
$text = "<ul>\n";
$count = 0;
foreach( $versions as $version ){
@@ -36,7 +36,7 @@
}
function getNumRows() {
- return count( $this->mHandler->listArchiveVersions() );
+ return count( $this->mHandler->listArchiveVersions() );
}
function getNavigationBar() {
Modified: trunk/extensions/Configure/Configure.php
===================================================================
--- trunk/extensions/Configure/Configure.php 2008-11-15 09:07:31 UTC (rev
43537)
+++ trunk/extensions/Configure/Configure.php 2008-11-15 09:16:52 UTC (rev
43538)
@@ -17,7 +17,7 @@
'url' => 'http://www.mediawiki.org/wiki/Extension:Configure',
'description' => 'Allow authorised users to configure the wiki via a
web-based interface',
'descriptionmsg' => 'configure-desc',
- 'version' => '0.9.7',
+ 'version' => '0.10.0',
);
## Configuration part
@@ -39,11 +39,14 @@
$wgConfigureDatabase = 'config';
/**
- * Path for file-system cache
+ * Path for file-system cache, only works when $wgConfigureHandler is 'db'.
*/
$wgConfigureFileSystemCache = false;
-/** Expiry */
+/**
+ * Expiry for the file-system cache, note that it is not purged when saving a
+ * new version of the configuration, so let this to a low value.
+ */
$wgConfigureFileSystemCacheExpiry = 180;
/**
@@ -98,9 +101,14 @@
$wgConfigureNotEditableSettings = array();
/**
+ * Whether to use the API module
+ */
+$wgConfigureAPI = false;
+
+/**
* Whether to update $wgCacheEpoch when saving changes in Special:Configure
*/
-$wgConfigureUpdateCacheEpoch = false;
+$wgConfigureUpdateCacheEpoch = false;
/**
* Styles versions, you shouldn't change it
@@ -199,7 +207,6 @@
## API module
$wgAutoloadClasses['ApiConfigure'] = $dir . 'Configure.api.php';
$wgExtensionFunctions[] = 'efConfigureSetupAPI';
-$wgConfigureAPI = false;
## Adding the ajax function
$wgAjaxExportList[] = 'efConfigureAjax';
Modified: trunk/extensions/Configure/Configure.settings-core.php
===================================================================
--- trunk/extensions/Configure/Configure.settings-core.php 2008-11-15
09:07:31 UTC (rev 43537)
+++ trunk/extensions/Configure/Configure.settings-core.php 2008-11-15
09:16:52 UTC (rev 43538)
@@ -1059,7 +1059,7 @@
* Array of settings depending of the Core version
*/
$settingsVersion = array(
-# 1.14
+# 1.14
'wgExemptFromUserRobotsControl' => array( array( '1.14alpha', '>=' ) ),
'wgHandheldStyle' => array( array( '1.14alpha', '>=' ) ),
'wgHandheldForIPhone' => array( array( '1.14alpha', '>=' ) ),
Modified: trunk/extensions/Configure/Configure.settings-ext.php
===================================================================
--- trunk/extensions/Configure/Configure.settings-ext.php 2008-11-15
09:07:31 UTC (rev 43537)
+++ trunk/extensions/Configure/Configure.settings-ext.php 2008-11-15
09:16:52 UTC (rev 43538)
@@ -303,7 +303,7 @@
'wgNoticeLocalPath' => false,
'wgNoticeCentralDirectory' => false,
'wgNoticeLocalDirectory' => false,
- ),
+ ),
'url' =>
'http://www.mediawiki.org/wiki/Extension:CentralNotice',
),
array(
@@ -551,7 +551,7 @@
),
'url' => 'http://www.mediawiki.org/wiki/Extension:CSS',
),
-
+
// D
array(
'name' => 'DeleteBatch',
@@ -829,7 +829,7 @@
'file' => 'SpecialNuke.php',
'url' => 'http://www.mediawiki.org/wiki/Extension:Nuke',
),
-
+
// O
array(
'name' => 'OggHandler',
@@ -877,7 +877,7 @@
'name' => 'Renameuser',
'file' => 'SpecialRenameuser.php',
'url' => 'http://www.mediawiki.org/wiki/Extension:Renameuser',
- ),
+ ),
// S
array(
@@ -912,7 +912,7 @@
'name' => 'SyntaxHighlight_GeSHi',
'url' =>
'http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi',
),
-
+
// T
array(
'name' => 'Timeline',
Modified: trunk/extensions/Configure/Configure.settings.php
===================================================================
--- trunk/extensions/Configure/Configure.settings.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/Configure.settings.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -7,7 +7,7 @@
*/
class ConfigurationSettings {
protected $types, $initialized = false;
-
+
// Core settings
protected $settings, $arrayDefs, $emptyValues, $editRestricted,
$viewRestricted, $notEditableSettings, $settingsVersion;
@@ -77,7 +77,7 @@
* Callback to sort extensions
*/
public static function compExt( $e1, $e2 ){
- return strcmp( $e1['name'], $e2['name'] );
+ return strcmp( $e1['name'], $e2['name'] );
}
/**
Modified: trunk/extensions/Configure/SpecialConfigure.php
===================================================================
--- trunk/extensions/Configure/SpecialConfigure.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/SpecialConfigure.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -24,7 +24,7 @@
$settings += $current;
$settings = $this->removeDefaults( $settings );
if( $wgConfigureUpdateCacheEpoch )
- $settings['wgCacheEpoch'] = max(
$settings['wgCacheEpoch'], wfTimestampNow() );
+ $settings['wgCacheEpoch'] = max(
$settings['wgCacheEpoch'], wfTimestampNow() );
$ok = $wgConf->saveNewSettings( $settings, $this->mWiki );
$msg = wfMsgNoTrans( $ok ? 'configure-saved' :
'configure-error' );
$class = $ok ? 'successbox' : 'errorbox';
@@ -33,7 +33,7 @@
}
protected function getSettingMask(){
- return CONF_SETTINGS_CORE;
+ return CONF_SETTINGS_CORE;
}
/**
Modified: trunk/extensions/Configure/SpecialExtensions.php
===================================================================
--- trunk/extensions/Configure/SpecialExtensions.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/SpecialExtensions.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -16,7 +16,7 @@
}
protected function getSettingMask(){
- return CONF_SETTINGS_EXT;
+ return CONF_SETTINGS_EXT;
}
/**
@@ -28,7 +28,7 @@
$settings = $this->importFromRequest();
$new = $settings + $current;
$new = $this->removeDefaults( $new );
- $new['__includes'] = $this->getRequiredFiles();
+ $new['__includes'] = $this->getRequiredFiles();
$ok = $wgConf->saveNewSettings( $new, $this->mWiki );
$msg = wfMsgNoTrans( $ok ? 'configure-saved' :
'configure-error' );
$class = $ok ? 'successbox' : 'errorbox';
@@ -74,7 +74,7 @@
* Same as before
*/
public function getSettingValue( $setting ){
- return parent::getSettingValue( $setting );
+ return parent::getSettingValue( $setting );
}
/**
@@ -97,7 +97,7 @@
require_once( $ext->getFile() );
if( isset( $$setting ) )
$this->conf[$setting] =
$$setting;
- }
+ }
}
$ext->setPageObj( $this );
$ret .= $ext->getHtml();
Modified: trunk/extensions/Configure/SpecialViewConfig.php
===================================================================
--- trunk/extensions/Configure/SpecialViewConfig.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/SpecialViewConfig.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -20,7 +20,7 @@
}
protected function getSettingMask(){
- return CONF_SETTINGS_BOTH;
+ return CONF_SETTINGS_BOTH;
}
protected function getVersion(){
@@ -96,9 +96,9 @@
$wgOut->addHTML(
Xml::openElement( 'div', array( 'id' =>
'configure-form' ) ) . "\n" .
Xml::openElement( 'div', array( 'id' =>
'configure' ) ) . "\n" .
-
+
$this->buildAllSettings() . "\n" .
-
+
Xml::closeElement( 'div' ) . "\n" .
Xml::closeElement( 'div' ) . "\n"
);
@@ -111,7 +111,7 @@
/**
* Build links to old version of the configuration
- *
+ *
*/
protected function buildOldVersionSelect(){
global $wgConf, $wgLang, $wgUser, $wgScript;
@@ -162,7 +162,7 @@
global $wgLang;
$ts = $arr['timestamp'];
- $wikis = $arr['wikis'];
+ $wikis = $arr['wikis'];
$c = $arr['count'];
$hasSelf = in_array( $this->mWiki, $wikis );
@@ -221,13 +221,13 @@
$diffCheck = $c == 2 ? array( 'checked' => 'checked' )
: array();
$versionCheck = $c == 1 ? array( 'checked' => 'checked'
) : array();
$buttons =
- Xml::element( 'input', array_merge(
+ Xml::element( 'input', array_merge(
array( 'type' => 'radio', 'name' =>
'diff', 'value' => $ts ),
$diffCheck ) ) .
Xml::element( 'input', array_merge(
array( 'type' => 'radio', 'name' =>
'version', 'value' => $ts ),
$versionCheck ) );
-
+
} else {
$buttons = '';
}
Modified: trunk/extensions/Configure/findSettings.php
===================================================================
--- trunk/extensions/Configure/findSettings.php 2008-11-15 09:07:31 UTC (rev
43537)
+++ trunk/extensions/Configure/findSettings.php 2008-11-15 09:16:52 UTC (rev
43538)
@@ -45,7 +45,7 @@
* @param $sort Boolean : wheter to sort the array (Default: true)
*/
function printArray( $msg, $arr, $sort = true ) {
- if($sort) asort($arr);
+ if($sort) asort($arr);
foreach($arr as $v) echo "$msg: $v\n";
}
@@ -75,7 +75,7 @@
preg_match_all( '/\$(wg[A-Za-z0-9]+)\s*\=/', $file, $m );
$definedSettings = array_unique( $m[1] );
$allSettings = array_keys( $ext->getSettings() );
-
+
$remain = array_diff( $definedSettings, $allSettings );
$obsolete = array_diff( $allSettings, $definedSettings );
$missing = array();
@@ -106,13 +106,13 @@
} else {
$allSettings = array_keys( $coreSettings->getAllSettings() );
}
-
+
// Now we'll need to open DefaultSettings.php
$m = array();
$defaultSettings = file_get_contents(
"$IP/includes/DefaultSettings.php" );
preg_match_all( '/\$(wg[A-Za-z0-9]+)\s*\=/', $defaultSettings, $m );
$definedSettings = array_unique( $m[1] );
-
+
$missing = array_diff( $definedSettings, $allSettings );
$remain = array_diff( $allSettings, $definedSettings );
$obsolete = array();
@@ -120,11 +120,11 @@
if( $coreSettings->isSettingAvailable( $setting ) )
$obsolete[] = $setting;
}
-
+
// let's show the results:
printArray('missing', $missing );
printArray('obsolete', $obsolete );
-
- if( count( $missing ) == 0 && count( $obsolete ) == 0 )
+
+ if( count( $missing ) == 0 && count( $obsolete ) == 0 )
echo "Looks good!\n";
}
\ No newline at end of file
Modified: trunk/extensions/Configure/manage.inc
===================================================================
--- trunk/extensions/Configure/manage.inc 2008-11-15 09:07:31 UTC (rev
43537)
+++ trunk/extensions/Configure/manage.inc 2008-11-15 09:16:52 UTC (rev
43538)
@@ -23,7 +23,7 @@
if( !is_callable( $callback ) )
// Ingnore silenty
continue;
- call_user_func_array( $callback, array( $arg ) );
+ call_user_func_array( $callback, array( $arg ) );
}
}
@@ -37,12 +37,12 @@
$deleter = $this->getDeleter();
$deleter->doDelete( $version );
}
-
+
protected function DoList(){
global $wgConf;
echo implode( "\n", $wgConf->listArchiveVersions() ) . "\n";
}
-
+
protected function DoRevert( $version ){
global $wgConf;
$arr = $wgConf->getOldSettings( $version );
@@ -52,7 +52,7 @@
}
$wgConf->saveNewSettings( $arr, null );
}
-
+
protected function DoHelp(){
echo "Script that helps to do maintenance with configuration
files.\n";
echo "\n";
@@ -73,16 +73,16 @@
*/
class ConfigurationDeleterFiles {
protected $mConf;
-
+
function __construct( WebConfiguration $conf ){
$this->mConf = $conf;
}
-
+
function doDelete( $version ){
$file = $this->mConf->getHandler()->getArchiveFileName(
$version );
if( !file_exists( $file ) ){
fwrite( STDERR, "delete: The version given ($version)
does not exist.\n" );
- return;
+ return;
}
unlink( $file );
}
@@ -93,19 +93,19 @@
*/
class ConfigurationDeleterDb {
protected $mConf;
-
+
function __construct( WebConfiguration $conf ){
$this->mConf = $conf;
}
-
+
function doDelete( $version ){
$dbw = $this->mConf->getHandler()->getMasterDB();
$rev = $dbw->selectRow( 'config_version', '*', array(
'cv_timestamp' => $version ), __METHOD__ );
if( !isset( $rev->cv_id ) ){
fwrite( STDERR, "delete: The version given ($version)
does not exist.\n" );
- return;
+ return;
}
-
+
$id = $rev->cv_id;
$dbw->begin();
$dbw->delete( 'config_version', array( 'cv_id' => $id ),
__METHOD__ );
Modified: trunk/extensions/Configure/manage.php
===================================================================
--- trunk/extensions/Configure/manage.php 2008-11-15 09:07:31 UTC (rev
43537)
+++ trunk/extensions/Configure/manage.php 2008-11-15 09:16:52 UTC (rev
43538)
@@ -18,7 +18,7 @@
require_once( "$IP/maintenance/commandLine.inc" );
-require_once( dirname( __FILE__ ) . "/manage.inc" );
+require_once( dirname( __FILE__ ) . '/manage.inc' );
$obj = new ConfigurationManager( $options );
$obj->run();
Modified: trunk/extensions/Configure/migrateToDB.inc
===================================================================
--- trunk/extensions/Configure/migrateToDB.inc 2008-11-15 09:07:31 UTC (rev
43537)
+++ trunk/extensions/Configure/migrateToDB.inc 2008-11-15 09:16:52 UTC (rev
43538)
@@ -22,13 +22,13 @@
public function run(){
if( isset( $this->mOptions['help'] ) ){
$this->doHelp();
- return;
+ return;
}
if( !$this->doChecks() )
return;
$this->saveLatest();
foreach( $this->getVersions() as $version ){
- $this->migrateVersion( $version );
+ $this->migrateVersion( $version );
}
$this->restoreLatest();
echo "done\n";
@@ -52,7 +52,7 @@
echo "{$row->cv_wiki}: {$row->cv_id}\n";
}
}
-
+
protected function restoreLatest(){
$dbw = $this->mDBHandler->getMasterDB();
foreach( $this->mLatest as $wiki => $id ){
@@ -64,7 +64,7 @@
protected function getVersions(){
return array_reverse(
$this->mFilesHandler->listArchiveVersions() );
}
-
+
protected function migrateVersion( $version ){
$now = $this->mFilesHandler->getOldSettings( $version );
echo "doing $version...\n";
Modified: trunk/extensions/Configure/translateSettings.php
===================================================================
--- trunk/extensions/Configure/translateSettings.php 2008-11-15 09:07:31 UTC
(rev 43537)
+++ trunk/extensions/Configure/translateSettings.php 2008-11-15 09:16:52 UTC
(rev 43538)
@@ -44,15 +44,15 @@
print "Please describe the following setting: \$$name\n";
print trim($defaultNames[$name])."\n";
-
+
$input = readline( '> ' );
-
+
if (trim($input) == '~')
break;
-
+
if (trim($input) == '')
$input = $defaultNames[$name];
-
+
$translated[$name] = trim($input);
}
Modified: trunk/extensions/Configure/writePHP.inc
===================================================================
--- trunk/extensions/Configure/writePHP.inc 2008-11-15 09:07:31 UTC (rev
43537)
+++ trunk/extensions/Configure/writePHP.inc 2008-11-15 09:16:52 UTC (rev
43538)
@@ -7,7 +7,7 @@
* @author Alexandre Emsenhuber
*/
class ConfigurationWriter {
- public $options, $file;
+ public $options, $file;
public function __construct( $options ){
$this->options = $options;
@@ -111,7 +111,7 @@
} else {
$this->write( "# Missing
\$$name\n" );
}
- }
+ }
}
}
$this->write( "\n\n## extensions\n" );
@@ -120,7 +120,7 @@
foreach( ConfigurationSettings::singleton( CONF_SETTINGS_BOTH
)->getAllExtensionsObjects() as $ext ){
if( $ext->isActivated() ){
$this->write( "\n## " . $ext->getName() . "\n"
);
- $path = str_replace( $IP, '$IP',
$ext->getFile() );
+ $path = str_replace( $IP, '$IP',
$ext->getFile() );
$paths[] = ( "require( \"$path\" );" );
foreach( $ext->getSettings() as $name => $type
){
if( isset( $settingsVal[$name] ) )
@@ -156,7 +156,7 @@
}
if( !isset( $arr[$wiki] ) ){
fwrite( STDERR, "'$wiki' could not be found in
this version\n" );
- return;
+ return;
}
$settingsVal = $arr[$wiki];
} else {
@@ -172,7 +172,7 @@
$this->write( "\$$name = " .
$this->writeSetting( $name, $type, $settingsVal[$name] ) . ";\n" );
else
$this->write( "# Missing
\$$name\n" );
- }
+ }
}
}
$this->write( "\n\n## extensions\n" );
@@ -180,7 +180,7 @@
foreach( ConfigurationSettings::singleton( CONF_SETTINGS_BOTH
)->getAllExtensionsObjects() as $ext ){
if( $ext->isActivated() ){
$this->write( "\n## " . $ext->getName() . "\n"
);
- $path = str_replace( $IP, '$IP',
$ext->getFile() );
+ $path = str_replace( $IP, '$IP',
$ext->getFile() );
$this->write( "require( \"$path\" );\n" );
foreach( $ext->getSettings() as $name => $type
){
if( isset( $settingsVal[$name] ) )
@@ -191,7 +191,7 @@
}
}
}
-
+
/**
* Get a 3D array of settings
*/
@@ -210,7 +210,7 @@
* Callback for simple arrays
*/
public static function map_simple( $val ){
- return var_export( $val, true );
+ return var_export( $val, true );
}
/**
@@ -219,7 +219,7 @@
public static function map_simple_dual( $val ){
return 'array( ' . var_export( $val[0], true ) . ', ' .
var_export( $val[1], true ) . ' )';
}
-
+
protected static function getNsConst( $ns ){
static $map = array(
-2 => 'NS_MEDIA',
@@ -246,7 +246,7 @@
else
return $ns;
}
-
+
public static function map_assoc_ns( &$val, $index ){
$val = self::getNsConst( $index ) . ' => ' . var_export( $val,
true );
}
@@ -285,37 +285,37 @@
if( $arrType == 'simple' ){
$ret = "array(\n " . implode( ",\n ", array_map(
array( __CLASS__, 'map_simple' ), (array)$val ) ) . "\n)";
return $ret;
-
+
}
-
+
if( $arrType == 'simple-dual' ){
$ret = "array(\n " . implode( ",\n ", array_map(
array( __CLASS__, 'map_simple_dual' ), $val ) ) . "\n)";
return $ret;
-
+
}
if( in_array( $arrType, array( 'ns-bool', 'ns-text' ) ) ){
array_walk( $val, array( __CLASS__, 'map_assoc_ns' ) );
$ret = "array(\n " . implode( ",\n ", $val ) . "\n)";
- return $ret;
+ return $ret;
}
if( $arrType == 'ns-simple' ){
$ret = "array(\n " . implode( ",\n ", array_map(
array( __CLASS__, 'getNsConst' ), $val ) ) . "\n)";
return $ret;
-
+
}
if( $arrType == 'ns-array' ){
array_walk( $val, array( __CLASS__, 'map_array_ns' ) );
$ret = "array(\n " . implode( ",\n ", $val ) . "\n)";
- return $ret;
+ return $ret;
}
# Should no happend
return var_export( $val, true );
}
-
+
protected function help(){
echo "Script that writes the configuration.\n";
echo "\n";
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs