forked from hermannschwaerzlerUIBK/HaloACL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch_for_SMW2.0.txt
105 lines (101 loc) · 3.7 KB
/
patch_for_SMW2.0.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
--- includes/src/InTextAnnotationParser.php
+++ includes/src/InTextAnnotationParser.php
@@ -291,7 +291,9 @@
// Return the text representation
$result = $dataValue->getShortWikitext( true );
-
+/*op-patch|TS|2014-09-30|HaloACL|Semantic protection|start*/
+ wfRunHooks('PropertyBeforeOutput', array(&$dataValue, &$result));
+/*op-patch|TS|2014-09-30|end*/
// If necessary add an error text
if ( ( $this->settings->get( 'smwgInlineErrors' ) &&
$this->isEnabledNamespace && $this->isAnnotation ) &&
--- includes/storage/SMW_QueryResult.php
+++ includes/storage/SMW_QueryResult.php
@@ -80,6 +80,38 @@
$this->mStore = $store;
}
+ /*op-patch|TS|2014-09-30|HaloACL|Semantic protection|start*/
+ /**
+ * Creates a new query result based on $this query result. Everything
+ * but the content of $this query result is copied into the new one.
+ * This is useful for query result filters which copy the content only partly.
+ *
+ * @param SMWQueryResult $this
+ * The following parts of this query result are copied into the new q.r.:
+ * - print requests
+ * - query, querystring
+ * - furtherres
+ * - extra printouts
+ * @param array
+ * An array of results e.g. the set of filtered results of the original query.
+ * If the new q.r. should have no results then pass an empty array.
+ *
+ * @return SMWQueryResult
+ * A partly copied $queryResult
+ */
+ public function newFromQueryResult($results) {
+ $classname = get_class($this);
+
+ $qr = new $classname($this->mPrintRequests,
+ $this->mQuery,
+ $results,
+ $this->mStore,
+ $this->mFurtherResults);
+
+ return $qr;
+ }
+ /*op-patch|TS|2014-09-30|end*/
+
/**
* Get the SMWStore object that this result is based on.
*
--- includes/storage/SQLStore/SMW_SQLStore3_Queries.php
+++ includes/storage/SQLStore/SMW_SQLStore3_Queries.php
@@ -654,7 +654,25 @@
// No defaultnamespaces here; If any, these are already in the concept.
// Unescaping is the same as in SMW_DV_Conept's getWikiValue().
$desc = $qp->getQueryDescription( str_replace( array( '<', '>', '&' ), array( '<', '>', '&' ), $row->concept_txt ) );
+/*op-patch|TS|2010-07-14|HaloACL|Semantic protection|start*/
+ global $haclgProtectProperties;
+ if (isset($haclgProtectProperties) && $haclgProtectProperties) {
+ $query = new SMWQuery($desc);
+ wfRunHooks('RewriteQuery', array(&$query, &$queryEmpty) );
+ $errors = $query->getErrors();
+ if (!empty($errors)) {
+ $this->m_errors += $errors;
+ }
+ if ($queryEmpty) {
+ $qid = -1;
+ } else {
+ $desc = $query->getDescription();
+ $qid = $this->compileQueries( $desc );
+ }
+ } else {
$qid = $this->compileQueries( $desc );
+ }
+/*op-patch|TS|2010-07-14|end*/
if ($qid != -1) {
$query = $this->m_queries[$qid];
} else { // somehow the concept query is no longer valid; maybe some syntax changed (upgrade) or global settings were modified since storing it
--- includes/storage/StoreFactory.php
+++ includes/storage/StoreFactory.php
@@ -38,11 +38,20 @@
if ( self::$defaultStore === null ) {
self::$defaultStore = self::getConfiguration()->get( 'smwgDefaultStore' );
}
+
+ global $smwgMasterStore;
+ if ( !empty( $smwgMasterStore) && ( get_class( $smwgMasterStore ) == "HACLSMWStore" ) ) {
+ return $smwgMasterStore;
+ }
if ( $store === null ) {
$store = self::$defaultStore;
}
+ if ( empty( $smwgMasterStore ) ) {
+ $smwgMasterStore = new $store;
+ }
+
if ( !isset( self::$instance[ $store ] ) ) {
self::$instance[ $store ] = self::newInstance( $store );
self::$instance[ $store ]->setConfiguration( self::getConfiguration() );