Hiong3-eng5 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/74311
Change subject: Created Expressions Class;Jobs cleaned;some Setup
......................................................................
Created Expressions Class;Jobs cleaned;some Setup
Change-Id: I02ee0dba0d9178d2cb24bcc95bddd87adff3c714
---
M OmegaWiki/Expression.php
M includes/jobs/OWDefinedExpressionListJob.php
M includes/jobs/OWExpressionListJob.php
M includes/setup/OWSpecials.php
4 files changed, 70 insertions(+), 96 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiLexicalData
refs/changes/11/74311/1
diff --git a/OmegaWiki/Expression.php b/OmegaWiki/Expression.php
index c3463c0..3bf36e0 100644
--- a/OmegaWiki/Expression.php
+++ b/OmegaWiki/Expression.php
@@ -44,3 +44,56 @@
}
}
}
+
+class Expressions {
+
+ public function __construct() {
+ }
+
+ /**
+ * returns an array of "Expression" objects
+ * for a language
+ *
+ * else returns null
+ */
+ function getLanguageIdExpressions( $languageId, $options = array(), $dc
= null ) {
+ if ( is_null( $dc ) ) {
+ $dc = wdGetDataSetContext();
+ }
+ $dbr = wfGetDB( DB_SLAVE );
+
+ if ( isset( $options['ORDER BY'] ) ) {
+ $cond['ORDER BY']= $options['ORDER BY'];
+ } else {
+ $cond['ORDER BY']= 'spelling';
+ }
+
+ if ( isset( $options['LIMIT'] ) ) {
+ $cond['LIMIT']= $options['LIMIT'];
+ }
+ if ( isset( $options['OFFSET'] ) ) {
+ $cond['OFFSET']= $options['OFFSET'];
+ }
+
+ $queryResult = $dbr->select(
+ "{$dc}_expression",
+ 'spelling',
+ array(
+ 'language_id' => $languageId,
+ 'remove_transaction_id' => null
+ ),
+ __METHOD__,
+ $cond
+ );
+
+ $expression = array();
+ foreach ( $queryResult as $exp ) {
+ $expression[] = $exp;
+ }
+
+ if ( $expression ) {
+ return $expression;
+ }
+ return null;
+ }
+}
diff --git a/includes/jobs/OWDefinedExpressionListJob.php
b/includes/jobs/OWDefinedExpressionListJob.php
index dd1fbb9..4816a7a 100644
--- a/includes/jobs/OWDefinedExpressionListJob.php
+++ b/includes/jobs/OWDefinedExpressionListJob.php
@@ -4,7 +4,7 @@
*
*/
global $wgWldOwScriptPath, $wgWldIncludesScriptPath;
-require_once( $wgWldOwScriptPath . 'languages.php' );
+require_once( $wgWldOwScriptPath . 'Expression.php' );
require_once( $wgWldIncludesScriptPath . 'formatCSV.php' );
Class CreateDefinedExpressionListJob extends Job {
@@ -69,7 +69,8 @@
// language specifics
$languageId = getLanguageIdForIso639_3( $code );
- $languageExpressions = $this->getLanguageIdExpressions(
$languageId, $options );
+ $this->Expressions = new Expressions;
+ $languageExpressions =
$this->Expressions->getLanguageIdExpressions( $languageId, $options );
// create File name
$fileName = $wgWldDownloadScriptPath;
@@ -142,50 +143,4 @@
return $express;
}
- /**
- * returns an array of "Expression" objects
- * for a language
- *
- * else returns null
- */
- function getLanguageIdExpressions( $languageId, $options = array(), $dc
= null ) {
- if ( is_null( $dc ) ) {
- $dc = wdGetDataSetContext();
- }
- $dbr = wfGetDB( DB_SLAVE );
-
- if ( isset( $options['ORDER BY'] ) ) {
- $cond['ORDER BY']= $options['ORDER BY'];
- } else {
- $cond['ORDER BY']= 'spelling';
- }
-
- if ( isset( $options['LIMIT'] ) ) {
- $cond['LIMIT']= $options['LIMIT'];
- }
- if ( isset( $options['OFFSET'] ) ) {
- $cond['OFFSET']= $options['OFFSET'];
- }
-
- $queryResult = $dbr->select(
- "{$dc}_expression",
- 'spelling',
- array(
- 'language_id' => $languageId,
- 'remove_transaction_id' => null
- ),
- __METHOD__,
- $cond
- );
-
- $expression = array();
- foreach ( $queryResult as $exp ) {
- $expression[] = $exp;
- }
-
- if ( $expression ) {
- return $expression;
- }
- return null;
- }
}
diff --git a/includes/jobs/OWExpressionListJob.php
b/includes/jobs/OWExpressionListJob.php
index 75f4874..c37ab28 100644
--- a/includes/jobs/OWExpressionListJob.php
+++ b/includes/jobs/OWExpressionListJob.php
@@ -4,7 +4,7 @@
*
*/
global $wgWldOwScriptPath, $wgWldIncludesScriptPath;
-require_once( $wgWldOwScriptPath . 'languages.php' );
+require_once( $wgWldOwScriptPath . 'Expression.php' );
require_once( $wgWldIncludesScriptPath . 'formatCSV.php' );
Class CreateExpressionListJob extends Job {
@@ -48,7 +48,8 @@
// language specifics
$languageId = getLanguageIdForIso639_3( $code );
- $languageExpressions = $this->getLanguageIdExpressions(
$languageId );
+ $this->Expressions = new Expressions;
+ $languageExpressions =
$this->Expressions->getLanguageIdExpressions( $languageId );
// create File name
$fileName = $wgWldDownloadScriptPath;
@@ -75,50 +76,4 @@
rename( $tempFileName, $fileName );
}
- /**
- * returns an array of "Expression" objects
- * for a language
- *
- * else returns null
- */
- function getLanguageIdExpressions( $languageId, $options = array(), $dc
= null ) {
- if ( is_null( $dc ) ) {
- $dc = wdGetDataSetContext();
- }
- $dbr = wfGetDB( DB_SLAVE );
-
- if ( isset( $options['ORDER BY'] ) ) {
- $cond['ORDER BY']= $options['ORDER BY'];
- } else {
- $cond['ORDER BY']= 'spelling';
- }
-
- if ( isset( $options['LIMIT'] ) ) {
- $cond['LIMIT']= $options['LIMIT'];
- }
- if ( isset( $options['OFFSET'] ) ) {
- $cond['OFFSET']= $options['OFFSET'];
- }
-
- $queryResult = $dbr->select(
- "{$dc}_expression",
- 'spelling',
- array(
- 'language_id' => $languageId,
- 'remove_transaction_id' => null
- ),
- __METHOD__,
- $cond
- );
-
- $expression = array();
- foreach ( $queryResult as $exp ) {
- $expression[] = $exp;
- }
-
- if ( $expression ) {
- return $expression;
- }
- return null;
- }
}
diff --git a/includes/setup/OWSpecials.php b/includes/setup/OWSpecials.php
index ae9e305..716bed5 100644
--- a/includes/setup/OWSpecials.php
+++ b/includes/setup/OWSpecials.php
@@ -41,6 +41,13 @@
);
$wgExtensionCredits['specialpage'][] = array(
+ 'name' => 'SpecialPopupEditor',
+ 'author' => array(
+ 'Kipcool',
+ ),
+);
+
+$wgExtensionCredits['specialpage'][] = array(
'name' => 'SpecialAddCollection',
'author' => array(
'Erik Möller',
@@ -110,11 +117,15 @@
// $wgSpecialPages['Transaction'] = 'SpecialTransaction';
# Tell MediaWiki about which group the new special page belongs to
+# maintenance = Maintenance reports
+# wiki = Data and tools
+# others = Other Special pages
/**
* == UnlistedSpecialPage ==
* SpecialCopy
* SpecialSelect
* SpecialSuggest
+ * SpecialPopupEditor
*/
$wgSpecialPageGroups[ 'AddCollection' ] = 'other';
--
To view, visit https://gerrit.wikimedia.org/r/74311
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I02ee0dba0d9178d2cb24bcc95bddd87adff3c714
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiLexicalData
Gerrit-Branch: master
Gerrit-Owner: Hiong3-eng5 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits