http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88183
Revision: 88183
Author: janpaul123
Date: 2011-05-15 14:18:07 +0000 (Sun, 15 May 2011)
Log Message:
-----------
API and setup cleanup
Modified Paths:
--------------
trunk/extensions/WikiLove/WikiLove.api.php
trunk/extensions/WikiLove/WikiLove.php
Modified: trunk/extensions/WikiLove/WikiLove.api.php
===================================================================
--- trunk/extensions/WikiLove/WikiLove.api.php 2011-05-15 14:17:42 UTC (rev
88182)
+++ trunk/extensions/WikiLove/WikiLove.api.php 2011-05-15 14:18:07 UTC (rev
88183)
@@ -1,7 +1,7 @@
<?php
class WikiLoveApi extends ApiBase {
public function execute() {
- global $wgRequest;
+ global $wgRequest, $wgWikiLoveLogging;
$params = $this->extractRequestParams();
@@ -16,9 +16,13 @@
}
if ( stripos( $params['text'], $params['template'] ) === false
) {
- // error
+ $this->dieUsage( 'Template could not be found in the
message!', 'invalidtemplate' );
}
+ if ( $wgWikiLoveLogging ) {
+ $this->saveInDb( $talk, $params['subject'],
$params['text'], $params['type'], $params['template'] );
+ }
+
$api = new ApiMain( new FauxRequest( array(
'action' => 'edit',
'title' => $talk->getFullText(),
@@ -37,8 +41,6 @@
$talk->setFragment( '#' . $params['subject'] );
$this->getResult()->addValue( 'redirect', 'pageName',
$talk->getPrefixedDBkey() );
$this->getResult()->addValue( 'redirect', 'fragment',
$talk->getFragmentForURL() );
-
- $this->saveInDb( $talk, $params['subject'], $params['text'],
$params['type'], $params['template'] );
}
/**
@@ -128,6 +130,10 @@
'code' => 'nologging',
'info' => 'Warning: action was not logged!'
),
+ array(
+ 'code' => 'invalidtemplate',
+ 'info' => 'Template could not be found in the
message!'
+ ),
) );
}
Modified: trunk/extensions/WikiLove/WikiLove.php
===================================================================
--- trunk/extensions/WikiLove/WikiLove.php 2011-05-15 14:17:42 UTC (rev
88182)
+++ trunk/extensions/WikiLove/WikiLove.php 2011-05-15 14:18:07 UTC (rev
88183)
@@ -67,7 +67,9 @@
$wgAPIModules['wikiLove'] = 'WikiLoveApi';
// default user options
+$wgWikiLoveGlobal = false;
$wgWikiLoveTabIcon = true;
+$wgWikiLoveLogging = false;
// resources
$wikiLoveTpl = array(
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs