@@ -50,16 +50,21 @@ public static function setup () {
50
50
public static function onAfterDataUpdateComplete ( SMWStore $ store , SMWSemanticData $ newData , $ compositePropertyTableDiffIterator ) {
51
51
52
52
global $ wgSDUProperty ;
53
+ global $ wgSDUTraversed ;
54
+
55
+ if (!isset ($ wgSDUTraversed )) {
56
+ $ wgSDUTraversed = array ();
57
+ }
53
58
54
59
$ wgSDUProperty = str_replace (' ' , '_ ' , $ wgSDUProperty );
55
60
$ subject = $ newData ->getSubject ();
56
61
$ title = $ subject ->getTitle ();
62
+ $ id = $ title ->getPrefixedDBKey ();
57
63
58
64
wfDebugLog ('SemanticDependencyUpdater ' , "[SDU] --> " . $ title );
59
65
60
66
61
67
// FIRST CHECK: Does the page data contain a $wgSUTPropertyName semantic property ?
62
-
63
68
$ properties = $ newData ->getProperties ();
64
69
$ diffTable = $ compositePropertyTableDiffIterator ->getOrderedDiffByTable ();
65
70
@@ -68,19 +73,34 @@ public static function onAfterDataUpdateComplete( SMWStore $store, SMWSemanticDa
68
73
return true ;
69
74
}
70
75
76
+
71
77
// SECOND CHECK: Have there been actual changes in the data? (Ignore internal SMW data!)
72
78
// TODO: Introduce an explicit list of Semantic Properties to watch ?
73
-
74
79
unset($ diffTable ['smw_fpt_mdat ' ]); // Ignore SMW's internal properties "smw_fpt_mdat"
75
80
76
81
if (count ($ diffTable ) > 0 ) {
82
+ // wfDebugLog('SemanticDependencyUpdater', "[SDU] diffTable: " . print_r($diffTable, true));
77
83
wfDebugLog ('SemanticDependencyUpdater ' , "[SDU] -----> Data changes detected " );
78
84
} else {
79
85
wfDebugLog ('SemanticDependencyUpdater ' , "[SDU] <-- No semantic data changes detected " );
80
86
return true ;
81
87
}
82
88
83
89
90
+ // THIRD CHECK: Has this page been already traversed more than twice?
91
+ // This should only be the case when SMW errors occur.
92
+ // In that case, the diffTable contains everything and SDU can't know if changes happend
93
+ if (array_key_exists ($ id , $ wgSDUTraversed )) {
94
+ $ wgSDUTraversed [$ id ] = $ wgSDUTraversed [$ id ] + 1 ;
95
+ } else {
96
+ $ wgSDUTraversed [$ id ] = 1 ;
97
+ }
98
+ if ($ wgSDUTraversed [$ id ] > 2 ) {
99
+ wfDebugLog ('SemanticDependencyUpdater ' , "[SDU] <-- Already traversed " );
100
+ return true ;
101
+ }
102
+
103
+
84
104
// QUERY AND UPDATE DEPENDENCIES
85
105
86
106
$ dataItem = $ newData ->getPropertyValues ($ properties [$ wgSDUProperty ]);
0 commit comments