Kipcool has submitted this change and it was merged.
Change subject: Created Expressions Class;Jobs cleaned;some Setup
......................................................................
Created Expressions Class;Jobs cleaned;some Setup
*P2 changes according to recommendations
*P3 corrected wrong Expression.php due to rebase interactive problem
*P4 corrected missed correction of P3
*P5 rebased to master
*P6 "public static function"
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, 68 insertions(+), 98 deletions(-)
Approvals:
Kipcool: Verified; Looks good to me, approved
diff --git a/OmegaWiki/Expression.php b/OmegaWiki/Expression.php
index c3463c0..01a0fd8 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
+ */
+ public static 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..7d3d75e 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,7 @@
// language specifics
$languageId = getLanguageIdForIso639_3( $code );
- $languageExpressions = $this->getLanguageIdExpressions(
$languageId, $options );
+ $languageExpressions = Expressions::getLanguageIdExpressions(
$languageId, $options );
// create File name
$fileName = $wgWldDownloadScriptPath;
@@ -140,52 +140,5 @@
}
$dmlist = array();
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..e837833 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,7 @@
// language specifics
$languageId = getLanguageIdForIso639_3( $code );
- $languageExpressions = $this->getLanguageIdExpressions(
$languageId );
+ $languageExpressions = Expressions::getLanguageIdExpressions(
$languageId );
// create File name
$fileName = $wgWldDownloadScriptPath;
@@ -73,52 +73,5 @@
unlink( $fileName );
}
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: merged
Gerrit-Change-Id: I02ee0dba0d9178d2cb24bcc95bddd87adff3c714
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/WikiLexicalData
Gerrit-Branch: master
Gerrit-Owner: Hiong3-eng5 <[email protected]>
Gerrit-Reviewer: Kipcool <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits