jenkins-bot has submitted this change and it was merged.
Change subject: add object ExtSQI as a wrapper of SemanticQueryInterface
extension (v 1.1.0)
......................................................................
add object ExtSQI as a wrapper of SemanticQueryInterface extension (v 1.1.0)
Change-Id: Ia703b70cc30005ec74c4f9ac696bdc625d19e608
---
M PhpTagsSMW.init.php
M PhpTagsSMW.php
M i18n/en.json
M i18n/qqq.json
A includes/SMWExtSQI.php
5 files changed, 111 insertions(+), 4 deletions(-)
Approvals:
Pastakhov: Looks good to me, but someone else must approve
JoelKP: Looks good to me, approved
jenkins-bot: Verified
diff --git a/PhpTagsSMW.init.php b/PhpTagsSMW.init.php
index 3ee59e5..464d988 100644
--- a/PhpTagsSMW.init.php
+++ b/PhpTagsSMW.init.php
@@ -6,6 +6,7 @@
\PhpTags\Hooks::setObjects(
array(
'ExtArrays' => 'SMWExtArrays',
+ 'ExtSQI' => 'SMWExtSQI',
)
);
return true;
diff --git a/PhpTagsSMW.php b/PhpTagsSMW.php
index 5d3aaa0..d338032 100644
--- a/PhpTagsSMW.php
+++ b/PhpTagsSMW.php
@@ -32,7 +32,7 @@
);
}
-define( 'PHPTAGS_SMW_VERSION' , '1.0.1' );
+define( 'PHPTAGS_SMW_VERSION' , '1.1.0' );
// Register this extension on Special:Version
$wgExtensionCredits['phptagssmw'][] = array(
@@ -57,7 +57,8 @@
// Preparing classes for autoloading
$wgAutoloadClasses['PhpTagsSMWInit'] = __DIR__ . '/PhpTagsSMW.init.php';
-$wgAutoloadClasses['PhpTagsObjects\\SMWExtArrays'] =
__DIR__ . '/includes/SMWExtArrays.php';
+$wgAutoloadClasses['PhpTagsObjects\\SMWExtArrays'] = __DIR__ .
'/includes/SMWExtArrays.php';
+$wgAutoloadClasses['PhpTagsObjects\\SMWExtSQI'] = __DIR__ .
'/includes/SMWExtSQI.php';
/**
* Add files to phpunit test
diff --git a/i18n/en.json b/i18n/en.json
index f67e5d2..8ab7f9f 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -5,5 +5,6 @@
]
},
"phptagssmw-desc": "Objects for
[https://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki Semantic
MediaWiki]-related data access",
- "phptagssmw-ext-arrays-not-installed": "Requires the
[https://www.mediawiki.org/wiki/Extension:Arrays Arrays] extension, but it's
not installed."
+ "phptagssmw-ext-arrays-not-installed": "Requires the
[https://www.mediawiki.org/wiki/Extension:Arrays Arrays] extension, but it's
not installed.",
+ "phptagssmw-ext-sqi-not-installed": "Requires the
[https://www.mediawiki.org/wiki/User:Vedmaka/Semantic_Query_Interface Semantic
Query Interface] extension, but it's not installed."
}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 9d72166..bd98ca2 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -5,5 +5,6 @@
]
},
"phptagssmw-desc": "{{desc|name=PhpTags
SMW|url=http://www.mediawiki.org/wiki/Extension:PhpTags_SMW}}",
- "phptagssmw-ext-arrays-not-installed": "Error message when trying to
use functionality from the [https://www.mediawiki.org/wiki/Extension:Arrays
Arrays] extension without it being installed."
+ "phptagssmw-ext-arrays-not-installed": "Error message when trying to
use functionality from the [https://www.mediawiki.org/wiki/Extension:Arrays
Arrays] extension without it being installed.",
+ "phptagssmw-ext-sqi-not-installed": "Error message when trying to use
functionality from the
[https://www.mediawiki.org/wiki/User:Vedmaka/Semantic_Query_Interface Semantic
Query Interface] extension without it being installed."
}
diff --git a/includes/SMWExtSQI.php b/includes/SMWExtSQI.php
new file mode 100644
index 0000000..f0265f0
--- /dev/null
+++ b/includes/SMWExtSQI.php
@@ -0,0 +1,103 @@
+<?php
+namespace PhpTagsObjects;
+
+/**
+ * Description of SMWExtSQI
+ *
+ * @author pastakhov
+ */
+class SMWExtSQI extends \PhpTags\GenericObject {
+
+ public function m___construct() {
+ if ( false === class_exists( '\\SQI\\SemanticQueryInterface' )
) {
+ throw new \Exception( wfMessage(
'phptagssmw-ext-sqi-not-installed' )->text() );
+ }
+ $this->value = new \SQI\SemanticQueryInterface();
+ return true;
+ }
+
+ /**
+ *
+ * @return \SQI\SemanticQueryInterface
+ */
+ private function getSQI() {
+ return $this->value;
+ }
+
+ public function m_from( $page, $flatResult = false ) {
+ $this->getSQI()->from( $page, (bool)$flatResult );
+ return $this;
+ }
+
+ public function m_condition( $condition, $conditionValue = null ) {
+ $this->getSQI()->condition( $condition, $conditionValue );
+ return $this;
+ }
+
+ public function m_category( $category ) {
+ $this->getSQI()->category( $category );
+ return $this;
+ }
+
+ public function m_printout( $printout ) {
+ $this->getSQI()->printout( $printout );
+ return $this;
+ }
+
+ public function m_limit( $limit ) {
+ $this->getSQI()->limit( $limit );
+ return $this;
+ }
+
+ public function m_offset( $offset ) {
+ $this->getSQI()->offset( $offset );
+ return $this;
+ }
+
+ public function m_count() {
+ return $this->getSQI()->count();
+ }
+
+ public function m_toArray( $stringifyPropValues = false ) {
+ return $this->getSQI()->toArray( (bool)$stringifyPropValues );
+ }
+
+ public static function checkArguments( $object, $method, &$arguments,
$expects = false ) {
+ switch ( $method ) {
+ case 'from':
+ $expects = array(
+ \PhpTags\Hooks::TYPE_STRING,
+
\PhpTags\Hooks::EXPECTS_MINIMUM_PARAMETERS => 1,
+
\PhpTags\Hooks::EXPECTS_MAXIMUM_PARAMETERS => 2,
+ );
+ break;
+ case 'toArray':
+ $expects = array(
+
\PhpTags\Hooks::EXPECTS_MAXIMUM_PARAMETERS => 1,
+ );
+ break;
+ case 'condition':
+ $expects = array(
+ \PhpTags\Hooks::TYPE_NOT_OBJECT,
+ \PhpTags\Hooks::TYPE_NOT_OBJECT,
+ );
+ break;
+ case 'printout':
+ case 'category':
+ $expects = array(
+ \PhpTags\Hooks::TYPE_STRING,
+
\PhpTags\Hooks::EXPECTS_EXACTLY_PARAMETERS => 1,
+ );
+ break;
+ case 'limit':
+ case 'offset':
+ $expects = array(
+ \PhpTags\Hooks::TYPE_INT,
+
\PhpTags\Hooks::EXPECTS_EXACTLY_PARAMETERS => 1,
+ );
+ break;
+ }
+ return parent::checkArguments( $object, $method, $arguments,
$expects );
+ }
+
+}
--
To view, visit https://gerrit.wikimedia.org/r/152930
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia703b70cc30005ec74c4f9ac696bdc625d19e608
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/PhpTagsSMW
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <[email protected]>
Gerrit-Reviewer: JoelKP <[email protected]>
Gerrit-Reviewer: Pastakhov <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits