if ( $module->mustBePosted() ) {
$items[] = "action=" . $wgRequest->getVal( 'action' );
} else {
- $items[] = wfArrayToCGI( $wgRequest->getValues() );
+ $items[] = wfArrayToCgi( $wgRequest->getValues() );
}
wfErrorLog( implode( ',', $items ) . "\n", $wgAPIRequestLog );
wfDebug( "Logged API request to $wgAPIRequestLog\n" );
if [ "$3" -gt 0 ]; then
ulimit -f "$3"
fi
-if [ "$4" -gt 0 ]; then
- timeout $4 /bin/bash -c "$5"
+if [ "$4" -gt 0 -a -x "/usr/bin/timeout" ]; then
+ /usr/bin/timeout $4 /bin/bash -c "$5"
STATUS="$?"
if [ "$STATUS" == 124 ]; then
echo "ulimit5.sh: timed out." 1>&2
$this->getRequest()->getQueryValues(),
array( 'action' => null, 'title' => null )
);
- $form->addHiddenField( 'redirectparams', wfArrayToCGI( $params ) );
+ $form->addHiddenField( 'redirectparams', wfArrayToCgi( $params ) );
$form->addPreText( $this->preText() );
$form->addPostText( $this->postText() );
parent::execute();
if ( is_array( $this->postData ) ) {
- $this->postData = wfArrayToCGI( $this->postData );
+ $this->postData = wfArrayToCgi( $this->postData );
}
if ( $this->parsedUrl['scheme'] != 'http' &&
unset( $returntoquery['title'] );
unset( $returntoquery['returnto'] );
unset( $returntoquery['returntoquery'] );
- $query['returntoquery'] = wfArrayToCGI( $returntoquery );
+ $query['returntoquery'] = wfArrayToCgi( $returntoquery );
}
}
$loginLink = Linker::linkKnown(
unset( $query['returnto'] );
unset( $query['returntoquery'] );
}
- $this->thisquery = wfArrayToCGI( $query );
+ $this->thisquery = wfArrayToCgi( $query );
$this->loggedin = $user->isLoggedIn();
$this->username = $user->getName();
$a['wpStickHTTPS'] = true;
}
- $returnto = wfArrayToCGI( $a );
+ $returnto = wfArrayToCgi( $a );
if( $this->loggedin ) {
$personal_urls['userpage'] = array(
'text' => $this->username,
foreach ( $wgFeedClasses as $format => $class ) {
$theseParams = $params + array( 'feedformat' => $format );
- $url = $feedTemplate . wfArrayToCGI( $theseParams );
+ $url = $feedTemplate . wfArrayToCgi( $theseParams );
$this->getOutput()->addFeedLink( $format, $url );
}
}
// Retain query parameters (uselang etc)
$params = array_diff_key(
$this->getRequest()->getQueryValues(), array( 'title' => null ) );
- $form->addHiddenField( 'redirectparams', wfArrayToCGI( $params ) );
+ $form->addHiddenField( 'redirectparams', wfArrayToCgi( $params ) );
$form->addPreText( $this->preText() );
$form->addPostText( $this->postText() );
// Redirect to index.php with query parameters
} elseif ( $redirect === true ) {
global $wgScript;
- $url = $wgScript . '?' . wfArrayToCGI( $query );
+ $url = $wgScript . '?' . wfArrayToCgi( $query );
$this->getOutput()->redirect( $url );
return $redirect;
} else {
if ( $name != $page->getLocalName() && !$context->getRequest()->wasPosted() ) {
$query = $context->getRequest()->getQueryValues();
unset( $query['title'] );
- $query = wfArrayToCGI( $query );
+ $query = wfArrayToCgi( $query );
$title = $page->getTitle( $par );
$url = $title->getFullUrl( $query );
$context->getOutput()->redirect( $url );
* second argument named variant. This was deprecated in favor
* of passing an array of option with a "variant" key
* Once $query2 is removed for good, this helper can be dropped
- * andthe wfArrayToCGI moved to getLocalURL();
+ * andthe wfArrayToCgi moved to getLocalURL();
*
* @since 1.19 (r105919)
* @param $query
wfDeprecated( "Title::get{Canonical,Full,Link,Local} method called with a second parameter is deprecated. Add your parameter to an array passed as the first parameter.", "1.19" );
}
if ( is_array( $query ) ) {
- $query = wfArrayToCGI( $query );
+ $query = wfArrayToCgi( $query );
}
if ( $query2 ) {
if ( is_string( $query2 ) ) {
// $query2 is a string, we will consider this to be
// a deprecated $variant argument and add it to the query
- $query2 = wfArrayToCGI( array( 'variant' => $query2 ) );
+ $query2 = wfArrayToCgi( array( 'variant' => $query2 ) );
} else {
- $query2 = wfArrayToCGI( $query2 );
+ $query2 = wfArrayToCgi( $query2 );
}
// If we have $query content add a & to it first
if ( $query ) {
$newquery = $this->getQueryValues();
unset( $newquery['title'] );
$newquery = array_merge( $newquery, $array );
- $query = wfArrayToCGI( $newquery );
+ $query = wfArrayToCgi( $newquery );
return $onlyquery ? $query : $wgTitle->getLocalURL( $query );
}
) .
Html::hidden( 'title', $this->getTitle()->getPrefixedDBKey() ) . "\n" .
Html::hidden( 'action', 'history' ) . "\n" .
- Xml::dateMenu( $year, $month ) . ' ' .
+ Xml::dateMenu( ( $year == null ? date( "Y" ) : $year ), $month ) . ' ' .
( $tagSelector ? ( implode( ' ', $tagSelector ) . ' ' ) : '' ) .
$checkDeleted .
Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "\n" .
$this->checkCanExecute( $this->getUser() );
if ( $this->getUser()->isAllowed( 'purge' ) ) {
- $this->redirectParams = wfArrayToCGI( array_diff_key(
+ $this->redirectParams = wfArrayToCgi( array_diff_key(
$this->getRequest()->getQueryValues(),
array( 'title' => null, 'action' => null )
) );
throw new MWException( "Cannot register a backend with no name." );
}
$name = $config['name'];
- if ( !isset( $config['class'] ) ) {
+ if ( isset( $this->backends[$name] ) ) {
+ throw new MWException( "Backend with name `{$name}` already registered." );
+ } elseif ( !isset( $config['class'] ) ) {
throw new MWException( "Cannot register backend `{$name}` with no class." );
}
$class = $config['class'];
public function getDescriptionStylesheetUrl() {
if ( isset( $this->scriptDirUrl ) ) {
return $this->makeUrl( 'title=MediaWiki:Filepage.css&' .
- wfArrayToCGI( Skin::getDynamicStylesheetQuery() ) );
+ wfArrayToCgi( Skin::getDynamicStylesheetQuery() ) );
}
return false;
}
}
}
- $wgMemc->set( $key, $cache, 60 * 60 * 24 * 7 ); // A week
+ // Cache presence for 1 week and negatives for 1 day
+ $wgMemc->set( $key, $cache, $this->fileExists ? 86400 * 7 : 86400 );
}
/**
$url = preg_replace( '/\?.*$/', '', $url );
if ( $query ) {
- $url .= '?' . wfArrayToCGI( $query );
+ $url .= '?' . wfArrayToCgi( $query );
}
return $url;
$styleUrl = $server . dirname( dirname( $this->parent->getUrl() ) ) .
'/skins/common/config-cc.css';
$iframeUrl = 'http://creativecommons.org/license/?' .
- wfArrayToCGI( array(
+ wfArrayToCgi( array(
'partner' => 'MediaWiki',
'exit_url' => $exitUrl,
'lang' => $this->getVar( '_UserLang' ),
if ( !$this->normaliseParams( $image, $params ) ) {
return false;
}
- $url = $script . '&' . wfArrayToCGI( $this->getScriptParams( $params ) );
+ $url = $script . '&' . wfArrayToCgi( $this->getScriptParams( $params ) );
if( $image->mustRender() || $params['width'] < $image->getWidth() ) {
return new ThumbnailImage( $image, $url, false, $params );
"};\n";
// Conditional script injection
- $scriptTag = Html::linkedScript( $wgLoadScript . '?' . wfArrayToCGI( $query ) );
+ $scriptTag = Html::linkedScript( $wgLoadScript . '?' . wfArrayToCgi( $query ) );
$out .= "if ( isCompatible() ) {\n" .
"\t" . Xml::encodeJsCall( 'document.write', array( $scriptTag ) ) .
"}\n" .
$apiParams['month'] = $this->opts['month'];
}
- $url = wfScript( 'api' ) . '?' . wfArrayToCGI( $apiParams );
+ $url = wfScript( 'api' ) . '?' . wfArrayToCgi( $apiParams );
$out->redirect( $url, '301' );
return;
$allValues = $this->opts->getAllValues();
unset( $allValues['feed'] );
- $out->setFeedAppendQuery( wfArrayToCGI( $allValues ) );
+ $out->setFeedAppendQuery( wfArrayToCgi( $allValues ) );
}
$pager = new NewPagesPager( $this, $this->opts );
'usermessage-template' => 'MediaWiki:UserMessage', # only translate this message to other languages if you have to change it
# Watchlist
-'watchlist' => 'My watchlist',
+'watchlist' => 'Watchlist',
'watchlist-summary' => '', # do not translate or duplicate this message to other languages
'mywatchlist' => 'Watchlist',
'watchlistfor2' => 'For $1 $2',
return htmlspecialchars(
'?' .
- wfArrayToCGI( array(
+ wfArrayToCgi( array(
'filter' => $_filter ? $_filter : $filter,
'sort' => $_sort ? $_sort : $sort,
'expand' => implode( ',', array_keys( $_expand ) )
* @dataProvider provideArrayToCGI
*/
function testArrayToCGI( $array, $result ) {
- $this->assertEquals( $result, wfArrayToCGI( $array ) );
+ $this->assertEquals( $result, wfArrayToCgi( $array ) );
}
function testArrayToCGI2() {
$this->assertEquals(
"baz=bar&foo=bar",
- wfArrayToCGI(
+ wfArrayToCgi(
array( 'baz' => 'bar' ),
array( 'foo' => 'bar', 'baz' => 'overridden value' ) ) );
}
* @dataProvider provideCgiRoundTrip
*/
function testCgiRoundTrip( $cgi ) {
- $this->assertEquals( $cgi, wfArrayToCGI( wfCgiToArray( $cgi ) ) );
+ $this->assertEquals( $cgi, wfArrayToCgi( wfCgiToArray( $cgi ) ) );
}
function testMimeTypeMatch() {