Complex classes like SMWSql3SmwIds often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use SMWSql3SmwIds, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
54 | class SMWSql3SmwIds { |
||
|
|||
55 | |||
56 | /** |
||
57 | * Specifies the border limit for pre-defined properties declared |
||
58 | * in SMWSql3SmwIds::special_ids |
||
59 | */ |
||
60 | const FXD_PROP_BORDER_ID = SMWSQLStore3::FIXED_PROPERTY_ID_UPPERBOUND; |
||
61 | |||
62 | /** |
||
63 | * Name of the table to store IDs in. |
||
64 | * |
||
65 | * @note This should never change. Existing wikis will have to drop and |
||
66 | * rebuild their SMW tables completely to recover from any change here. |
||
67 | */ |
||
68 | const TABLE_NAME = SMWSQLStore3::ID_TABLE; |
||
69 | |||
70 | const POOLCACHE_ID = 'sql.store.id.cache'; |
||
71 | |||
72 | /** |
||
73 | * Id for which property table hashes are cached, if any. |
||
74 | * |
||
75 | * @since 1.8 |
||
76 | * @var integer |
||
77 | */ |
||
78 | protected $hashCacheId = 0; |
||
79 | |||
80 | /** |
||
81 | * Cached property table hashes for $hashCacheId. |
||
82 | * |
||
83 | * @since 1.8 |
||
84 | * @var string |
||
85 | */ |
||
86 | protected $hashCacheContents = ''; |
||
87 | |||
88 | /** |
||
89 | * Maximal number of cached property IDs. |
||
90 | * |
||
91 | * @since 1.8 |
||
92 | * @var integer |
||
93 | */ |
||
94 | public static $PROP_CACHE_MAX_SIZE = 250; |
||
95 | |||
96 | /** |
||
97 | * Maximal number of cached non-property IDs. |
||
98 | * |
||
99 | * @since 1.8 |
||
100 | * @var integer |
||
101 | */ |
||
102 | public static $PAGE_CACHE_MAX_SIZE = 500; |
||
103 | |||
104 | protected $selectrow_sort_debug = 0; |
||
105 | protected $selectrow_redi_debug = 0; |
||
106 | protected $prophit_debug = 0; |
||
107 | protected $propmiss_debug = 0; |
||
108 | protected $reghit_debug = 0; |
||
109 | protected $regmiss_debug = 0; |
||
110 | |||
111 | static protected $singleton_debug = null; |
||
112 | |||
113 | /** |
||
114 | * Parent SMWSQLStore3. |
||
115 | * |
||
116 | * @since 1.8 |
||
117 | * @var SMWSQLStore3 |
||
118 | */ |
||
119 | public $store; |
||
120 | |||
121 | /** |
||
122 | * Cache for property IDs. |
||
123 | * |
||
124 | * @note Tests indicate that it is more memory efficient to have two |
||
125 | * arrays (IDs and sortkeys) than to have one array that stores both |
||
126 | * values in some data structure (other than a single string). |
||
127 | * |
||
128 | * @since 1.8 |
||
129 | * @var array |
||
130 | */ |
||
131 | protected $prop_ids = array(); |
||
132 | |||
133 | /** |
||
134 | * @var IdToDataItemMatchFinder |
||
135 | */ |
||
136 | private $idToDataItemMatchFinder; |
||
137 | |||
138 | /** |
||
139 | * @var RedirectInfoStore |
||
140 | */ |
||
141 | private $redirectInfoStore; |
||
142 | |||
143 | /** |
||
144 | * Cache for property sortkeys. |
||
145 | * |
||
146 | * @since 1.8 |
||
147 | * @var array |
||
148 | */ |
||
149 | protected $prop_sortkeys = array(); |
||
150 | |||
151 | /** |
||
152 | * Cache for non-property IDs. |
||
153 | * |
||
154 | * @since 1.8 |
||
155 | * @var array |
||
156 | */ |
||
157 | protected $regular_ids = array(); |
||
158 | |||
159 | /** |
||
160 | * Cache for non-property sortkeys. |
||
161 | * |
||
162 | * @since 1.8 |
||
163 | * @var array |
||
164 | */ |
||
165 | protected $regular_sortkeys = array(); |
||
166 | |||
167 | /** |
||
168 | * Use pre-defined ids for Very Important Properties, avoiding frequent |
||
169 | * ID lookups for those. |
||
170 | * |
||
171 | * @note These constants also occur in the store. Changing them will |
||
172 | * require to run setup.php again. They can also not be larger than 50. |
||
173 | * |
||
174 | * @since 1.8 |
||
175 | * @var array |
||
176 | */ |
||
177 | public static $special_ids = array( |
||
178 | '_TYPE' => 1, |
||
179 | '_URI' => 2, |
||
180 | '_INST' => 4, |
||
181 | '_UNIT' => 7, |
||
182 | '_IMPO' => 8, |
||
183 | '_PPLB' => 9, |
||
184 | '_PDESC' => 10, |
||
185 | '_PREC' => 11, |
||
186 | '_CONV' => 12, |
||
187 | '_SERV' => 13, |
||
188 | '_PVAL' => 14, |
||
189 | '_REDI' => 15, |
||
190 | '_DTITLE' => 16, |
||
191 | '_SUBP' => 17, |
||
192 | '_SUBC' => 18, |
||
193 | '_CONC' => 19, |
||
194 | // '_SF_DF' => 20, // Semantic Form's default form property |
||
195 | // '_SF_AF' => 21, // Semantic Form's alternate form property |
||
196 | '_ERRP' => 22, |
||
197 | // '_1' => 23, // properties for encoding (short) lists |
||
198 | // '_2' => 24, |
||
199 | // '_3' => 25, |
||
200 | // '_4' => 26, |
||
201 | // '_5' => 27, |
||
202 | // '_SOBJ' => 27 |
||
203 | '_LIST' => 28, |
||
204 | '_MDAT' => 29, |
||
205 | '_CDAT' => 30, |
||
206 | '_NEWP' => 31, |
||
207 | '_LEDT' => 32, |
||
208 | // properties related to query management |
||
209 | '_ASK' => 33, |
||
210 | '_ASKST' => 34, |
||
211 | '_ASKFO' => 35, |
||
212 | '_ASKSI' => 36, |
||
213 | '_ASKDE' => 37, |
||
214 | '_ASKPA' => 38, |
||
215 | '_ASKSC' => 39, |
||
216 | '_LCODE' => 40, |
||
217 | '_TEXT' => 41, |
||
218 | ); |
||
219 | |||
220 | /** |
||
221 | * Constructor. |
||
222 | * |
||
223 | * @since 1.8 |
||
224 | * @param SMWSQLStore3 $store |
||
225 | 30 | */ |
|
226 | 30 | public function __construct( SMWSQLStore3 $store, IdToDataItemMatchFinder $idToDataItemMatchFinder ) { |
|
239 | |||
240 | /** |
||
241 | * @since 2.1 |
||
242 | * |
||
243 | * @param DIWikiPage $subject |
||
244 | * |
||
245 | * @return boolean |
||
246 | 145 | */ |
|
247 | public function checkIsRedirect( DIWikiPage $subject ) { |
||
256 | |||
257 | /** |
||
258 | * @see RedirectInfoStore::findRedirectIdFor |
||
259 | * |
||
260 | * @since 2.1 |
||
261 | * |
||
262 | * @param string $title DB key |
||
263 | * @param integer $namespace |
||
264 | * |
||
265 | * @return integer |
||
266 | 289 | */ |
|
267 | 289 | public function findRedirectIdFor( $title, $namespace ) { |
|
270 | |||
271 | /** |
||
272 | * @see RedirectInfoStore::addRedirectForId |
||
273 | * |
||
274 | * @since 2.1 |
||
275 | * |
||
276 | * @param integer $id |
||
277 | * @param string $title |
||
278 | * @param integer $namespace |
||
279 | 26 | */ |
|
280 | 26 | public function addRedirectForId( $id, $title, $namespace ) { |
|
283 | |||
284 | /** |
||
285 | * @see RedirectInfoStore::deleteRedirectEntry |
||
286 | * |
||
287 | * @since 2.1 |
||
288 | * |
||
289 | * @param string $title |
||
290 | * @param integer $namespace |
||
291 | 25 | */ |
|
292 | 25 | public function deleteRedirectEntry( $title, $namespace ) { |
|
295 | |||
296 | /** |
||
297 | * Find the numeric ID used for the page of the given title, |
||
298 | * namespace, interwiki, and subobject. If $canonical is set to true, |
||
299 | * redirects are taken into account to find the canonical alias ID for |
||
300 | * the given page. If no such ID exists, 0 is returned. The Call-By-Ref |
||
301 | * parameter $sortkey is set to the current sortkey, or to '' if no ID |
||
302 | * exists. |
||
303 | * |
||
304 | * If $fetchhashes is true, the property table hash blob will be |
||
305 | * retrieved in passing if the opportunity arises, and cached |
||
306 | * internally. This will speed up a subsequent call to |
||
307 | * getPropertyTableHashes() for this id. This should only be done |
||
308 | * if such a call is intended, both to safe the previous cache and |
||
309 | * to avoid extra work (even if only a little) to fill it. |
||
310 | * |
||
311 | * @since 1.8 |
||
312 | * @param string $title DB key |
||
313 | * @param integer $namespace namespace |
||
314 | * @param string $iw interwiki prefix |
||
315 | * @param string $subobjectName name of subobject |
||
316 | * @param string $sortkey call-by-ref will be set to sortkey |
||
317 | * @param boolean $canonical should redirects be resolved? |
||
318 | * @param boolean $fetchHashes should the property hashes be obtained and cached? |
||
319 | * @return integer SMW id or 0 if there is none |
||
320 | 298 | */ |
|
321 | 298 | public function getSMWPageIDandSort( $title, $namespace, $iw, $subobjectName, &$sortkey, $canonical, $fetchHashes = false ) { |
|
329 | |||
330 | /** |
||
331 | * Find the numeric ID used for the page of the given normalized title, |
||
332 | * namespace, interwiki, and subobjectName. Predefined IDs are not |
||
333 | * taken into account (however, they would still be found correctly by |
||
334 | * an avoidable database read if they are stored correctly in the |
||
335 | * database; this should always be the case). In all other aspects, the |
||
336 | * method works just like getSMWPageIDandSort(). |
||
337 | * |
||
338 | * @since 1.8 |
||
339 | * @param string $title DB key |
||
340 | * @param integer $namespace namespace |
||
341 | * @param string $iw interwiki prefix |
||
342 | * @param string $subobjectName name of subobject |
||
343 | * @param string $sortkey call-by-ref will be set to sortkey |
||
344 | * @param boolean $canonical should redirects be resolved? |
||
345 | * @param boolean $fetchHashes should the property hashes be obtained and cached? |
||
346 | * @return integer SMW id or 0 if there is none |
||
347 | 299 | */ |
|
348 | 299 | protected function getDatabaseIdAndSort( $title, $namespace, $iw, $subobjectName, &$sortkey, $canonical, $fetchHashes ) { |
|
458 | |||
459 | /** |
||
460 | * @since 2.3 |
||
461 | * |
||
462 | * @param string $title DB key |
||
463 | * @param integer $namespace namespace |
||
464 | * @param string $iw interwiki prefix |
||
465 | * @param string $subobjectName name of subobject |
||
466 | * |
||
467 | * @param array |
||
468 | 249 | */ |
|
469 | public function getListOfIdMatchesFor( $title, $namespace, $iw, $subobjectName = '' ) { |
||
495 | |||
496 | /** |
||
497 | * @since 2.4 |
||
498 | * |
||
499 | * @param DIWikiPage $subject |
||
500 | * |
||
501 | * @param boolean |
||
502 | 39 | */ |
|
503 | 39 | public function exists( DIWikiPage $subject ) { |
|
506 | |||
507 | /** |
||
508 | * @note SMWSql3SmwIds::getSMWPageID has some issues with the cache as it returned |
||
509 | * 0 even though an object was matchable, using this method is safer then trying |
||
510 | * to encipher getSMWPageID related methods. |
||
511 | * |
||
512 | * It uses the PoolCache which means Lru is in place to avoid memory leakage. |
||
513 | * |
||
514 | * @since 2.4 |
||
515 | * |
||
516 | * @param DIWikiPage $subject |
||
517 | * |
||
518 | * @param integer |
||
519 | 102 | */ |
|
520 | public function getIDFor( DIWikiPage $subject ) { |
||
574 | |||
575 | /** |
||
576 | * Convenience method for calling getSMWPageIDandSort without |
||
577 | * specifying a sortkey (if not asked for). |
||
578 | * |
||
579 | * @since 1.8 |
||
580 | * @param string $title DB key |
||
581 | * @param integer $namespace namespace |
||
582 | * @param string $iw interwiki prefix |
||
583 | * @param string $subobjectName name of subobject |
||
584 | * @param boolean $canonical should redirects be resolved? |
||
585 | * @param boolean $fetchHashes should the property hashes be obtained and cached? |
||
586 | * @return integer SMW id or 0 if there is none |
||
587 | 242 | */ |
|
588 | 242 | public function getSMWPageID( $title, $namespace, $iw, $subobjectName, $canonical = true, $fetchHashes = false ) { |
|
592 | |||
593 | /** |
||
594 | * Find the numeric ID used for the page of the given title, namespace, |
||
595 | * interwiki, and subobjectName. If $canonical is set to true, |
||
596 | * redirects are taken into account to find the canonical alias ID for |
||
597 | * the given page. If no such ID exists, a new ID is created and |
||
598 | * returned. In any case, the current sortkey is set to the given one |
||
599 | * unless $sortkey is empty. |
||
600 | * |
||
601 | * @note Using this with $canonical==false can make sense, especially when |
||
602 | * the title is a redirect target (we do not want chains of redirects). |
||
603 | * But it is of no relevance if the title does not have an id yet. |
||
604 | * |
||
605 | * @since 1.8 |
||
606 | * @param string $title DB key |
||
607 | * @param integer $namespace namespace |
||
608 | * @param string $iw interwiki prefix |
||
609 | * @param string $subobjectName name of subobject |
||
610 | * @param boolean $canonical should redirects be resolved? |
||
611 | * @param string $sortkey call-by-ref will be set to sortkey |
||
612 | * @param boolean $fetchHashes should the property hashes be obtained and cached? |
||
613 | * @return integer SMW id or 0 if there is none |
||
614 | 277 | */ |
|
615 | 277 | public function makeSMWPageID( $title, $namespace, $iw, $subobjectName, $canonical = true, $sortkey = '', $fetchHashes = false ) { |
|
623 | |||
624 | /** |
||
625 | * Find the numeric ID used for the page of the given normalized title, |
||
626 | * namespace, interwiki, and subobjectName. Predefined IDs are not |
||
627 | * taken into account (however, they would still be found correctly by |
||
628 | * an avoidable database read if they are stored correctly in the |
||
629 | * database; this should always be the case). In all other aspects, the |
||
630 | * method works just like makeSMWPageID(). Especially, if no ID exists, |
||
631 | * a new ID is created and returned. |
||
632 | * |
||
633 | * @since 1.8 |
||
634 | * @param string $title DB key |
||
635 | * @param integer $namespace namespace |
||
636 | * @param string $iw interwiki prefix |
||
637 | * @param string $subobjectName name of subobject |
||
638 | * @param boolean $canonical should redirects be resolved? |
||
639 | * @param string $sortkey call-by-ref will be set to sortkey |
||
640 | * @param boolean $fetchHashes should the property hashes be obtained and cached? |
||
641 | * @return integer SMW id or 0 if there is none |
||
642 | 277 | */ |
|
643 | protected function makeDatabaseId( $title, $namespace, $iw, $subobjectName, $canonical, $sortkey, $fetchHashes ) { |
||
709 | |||
710 | /** |
||
711 | * Properties have a mechanisms for being predefined (i.e. in PHP instead |
||
712 | * of in wiki). Special "interwiki" prefixes separate the ids of such |
||
713 | * predefined properties from the ids for the current pages (which may, |
||
714 | * e.g., be moved, while the predefined object is not movable). |
||
715 | * |
||
716 | * @todo This documentation is out of date. Right now, the special |
||
717 | * interwiki is used only for special properties without a label, i.e., |
||
718 | * which cannot be shown to a user. This allows us to filter such cases |
||
719 | * from all queries that retrieve lists of properties. It should be |
||
720 | * checked that this is really the only use that this has throughout |
||
721 | * the code. |
||
722 | * |
||
723 | * @since 1.8 |
||
724 | * @param SMWDIProperty $property |
||
725 | * @return string |
||
726 | 270 | */ |
|
727 | 270 | public function getPropertyInterwiki( SMWDIProperty $property ) { |
|
730 | |||
731 | /** |
||
732 | * @since 2.1 |
||
733 | * |
||
734 | * @param integer $sid |
||
735 | * @param DIWikiPage $subject |
||
736 | * @param integer|string|null $interWiki |
||
737 | 244 | */ |
|
738 | public function updateInterwikiField( $sid, DIWikiPage $subject, $interWiki = null ) { |
||
756 | |||
757 | /** |
||
758 | * Fetch the ID for an SMWDIProperty object. This method achieves the |
||
759 | * same as getSMWPageID(), but avoids additional normalization steps |
||
760 | * that have already been performed when creating an SMWDIProperty |
||
761 | * object. |
||
762 | * |
||
763 | * @note There is no distinction between properties and inverse |
||
764 | * properties here. A property and its inverse have the same ID in SMW. |
||
765 | * |
||
766 | * @param SMWDIProperty $property |
||
767 | * @return integer |
||
768 | 272 | */ |
|
769 | 272 | public function getSMWPropertyID( SMWDIProperty $property ) { |
|
777 | |||
778 | /** |
||
779 | * Fetch and possibly create the ID for an SMWDIProperty object. The |
||
780 | * method achieves the same as getSMWPageID() but avoids additional |
||
781 | * normalization steps that have already been performed when creating |
||
782 | * an SMWDIProperty object. |
||
783 | * |
||
784 | * @see getSMWPropertyID |
||
785 | * @param SMWDIProperty $property |
||
786 | * @return integer |
||
787 | 254 | */ |
|
788 | 254 | public function makeSMWPropertyID( SMWDIProperty $property ) { |
|
803 | |||
804 | /** |
||
805 | * Normalize the information for an SMW object (page etc.) and return |
||
806 | * the predefined ID if any. All parameters are call-by-reference and |
||
807 | * will be changed to perform any kind of built-in normalization that |
||
808 | * SMW requires. This mainly applies to predefined properties that |
||
809 | * should always use their property key as a title, have fixed |
||
810 | * sortkeys, etc. Some very special properties also have fixed IDs that |
||
811 | * do not require any DB lookups. In such cases, the method returns |
||
812 | * this ID; otherwise it returns 0. |
||
813 | * |
||
814 | * @note This function could be extended to account for further kinds |
||
815 | * of normalization and predefined ID. However, both getSMWPropertyID |
||
816 | * and makeSMWPropertyID must then also be adjusted to do the same. |
||
817 | * |
||
818 | * @since 1.8 |
||
819 | * @param string $title DB key |
||
820 | * @param integer $namespace namespace |
||
821 | * @param string $iw interwiki prefix |
||
822 | * @param string $subobjectName |
||
823 | * @param string $sortkey |
||
824 | * @return integer predefined id or 0 if none |
||
825 | 300 | */ |
|
826 | 300 | protected function getPredefinedData( &$title, &$namespace, &$iw, &$subobjectName, &$sortkey ) { |
|
852 | |||
853 | /** |
||
854 | * Change an internal id to another value. If no target value is given, the |
||
855 | * value is changed to become the last id entry (based on the automatic id |
||
856 | * increment of the database). Whatever currently occupies this id will be |
||
857 | * moved consistently in all relevant tables. Whatever currently occupies |
||
858 | * the target id will be ignored (it should be ensured that nothing is |
||
859 | * moved to an id that is still in use somewhere). |
||
860 | * |
||
861 | * @since 1.8 |
||
862 | * @param integer $curid |
||
863 | * @param integer $targetid |
||
864 | 1 | */ |
|
865 | 1 | public function moveSMWPageID( $curid, $targetid = 0 ) { |
|
938 | |||
939 | /** |
||
940 | * Add or modify a cache entry. The key consists of the |
||
941 | * parameters $title, $namespace, $interwiki, and $subobject. The |
||
942 | * cached data is $id and $sortkey. |
||
943 | * |
||
944 | * @since 1.8 |
||
945 | * @param string $title |
||
946 | * @param integer $namespace |
||
947 | * @param string $interwiki |
||
948 | * @param string $subobject |
||
949 | * @param integer $id |
||
950 | * @param string $sortkey |
||
951 | 300 | */ |
|
952 | public function setCache( $title, $namespace, $interwiki, $subobject, $id, $sortkey ) { |
||
977 | |||
978 | /** |
||
979 | * @since 2.1 |
||
980 | * |
||
981 | * @param integer $id |
||
982 | * |
||
983 | * @return DIWikiPage|null |
||
984 | 270 | */ |
|
985 | 270 | public function getDataItemById( $id ) { |
|
988 | |||
989 | /** |
||
990 | * @since 2.3 |
||
991 | * |
||
992 | * @param integer $id |
||
993 | * @param RequestOptions|null $requestOptions |
||
994 | * |
||
995 | 79 | * @return string[] |
|
996 | 79 | */ |
|
997 | public function getDataItemPoolHashListFor( array $idlist, RequestOptions $requestOptions = null ) { |
||
1000 | |||
1001 | /** |
||
1002 | * Get a cached SMW ID, or false if no cache entry is found. |
||
1003 | * |
||
1004 | * @since 1.8 |
||
1005 | * @param string $title |
||
1006 | * @param integer $namespace |
||
1007 | * @param string $interwiki |
||
1008 | * @param string $subobject |
||
1009 | 299 | * @return integer|boolean |
|
1010 | 299 | */ |
|
1011 | 282 | protected function getCachedId( $title, $namespace, $interwiki, $subobject ) { |
|
1031 | |||
1032 | /** |
||
1033 | * Get a cached SMW sortkey, or false if no cache entry is found. |
||
1034 | * |
||
1035 | * @since 1.8 |
||
1036 | * @param string $title |
||
1037 | * @param integer $namespace |
||
1038 | * @param string $interwiki |
||
1039 | * @param string $subobject |
||
1040 | 288 | * @return string|boolean |
|
1041 | 288 | */ |
|
1042 | 261 | protected function getCachedSortKey( $title, $namespace, $interwiki, $subobject ) { |
|
1058 | |||
1059 | /** |
||
1060 | * Remove any cache entry for the given data. The key consists of the |
||
1061 | * parameters $title, $namespace, $interwiki, and $subobject. The |
||
1062 | * cached data is $id and $sortkey. |
||
1063 | * |
||
1064 | * @since 1.8 |
||
1065 | * @param string $title |
||
1066 | * @param integer $namespace |
||
1067 | * @param string $interwiki |
||
1068 | 9 | * @param string $subobject |
|
1069 | */ |
||
1070 | 9 | public function deleteCache( $title, $namespace, $interwiki, $subobject ) { |
|
1087 | |||
1088 | /** |
||
1089 | * Move all cached information about subobjects. |
||
1090 | * |
||
1091 | * @todo This method is neither efficient nor very convincing |
||
1092 | * architecturally; it should be redesigned. |
||
1093 | * |
||
1094 | * @since 1.8 |
||
1095 | * @param string $oldtitle |
||
1096 | * @param integer $oldnamespace |
||
1097 | * @param string $newtitle |
||
1098 | 22 | * @param integer $newnamespace |
|
1099 | */ |
||
1100 | public function moveSubobjects( $oldtitle, $oldnamespace, $newtitle, $newnamespace ) { |
||
1112 | |||
1113 | /** |
||
1114 | * Delete all cached information. |
||
1115 | * |
||
1116 | 26 | * @since 1.8 |
|
1117 | 26 | */ |
|
1118 | 26 | public function clearCaches() { |
|
1125 | |||
1126 | /** |
||
1127 | * Ensure that the property ID and sortkey caches have space to insert |
||
1128 | * at least one more element. If not, some other entries will be unset. |
||
1129 | * |
||
1130 | 278 | * @since 1.8 |
|
1131 | 278 | */ |
|
1132 | protected function checkPropertySizeLimit() { |
||
1141 | |||
1142 | /** |
||
1143 | * Ensure that the non-property ID and sortkey caches have space to |
||
1144 | * insert at least one more element. If not, some other entries will be |
||
1145 | * unset. |
||
1146 | * |
||
1147 | 287 | * @since 1.8 |
|
1148 | 287 | */ |
|
1149 | protected function checkRegularSizeLimit() { |
||
1158 | |||
1159 | /** |
||
1160 | * Return an array of hashes with table names as keys. These |
||
1161 | * hashes are used to compare new data with old data for each |
||
1162 | * property-value table when updating data |
||
1163 | * |
||
1164 | * @since 1.8 |
||
1165 | * |
||
1166 | * @param integer $subjectId ID of the page as stored in the SMW IDs table |
||
1167 | * |
||
1168 | 269 | * @return array |
|
1169 | 269 | */ |
|
1170 | 269 | public function getPropertyTableHashes( $subjectId ) { |
|
1196 | |||
1197 | /** |
||
1198 | * Update the proptable_hash for a given page. |
||
1199 | * |
||
1200 | * @since 1.8 |
||
1201 | * @param integer $sid ID of the page as stored in SMW IDs table |
||
1202 | 254 | * @param string[] of hash values with table names as keys |
|
1203 | 254 | */ |
|
1204 | 254 | public function setPropertyTableHashes( $sid, array $newTableHashes ) { |
|
1219 | |||
1220 | /** |
||
1221 | * Temporarily cache a property tablehash that has been retrieved for |
||
1222 | * the given SMW ID. |
||
1223 | * |
||
1224 | * @since 1.8 |
||
1225 | * @param $id integer |
||
1226 | 273 | * @param $propertyTableHash string |
|
1227 | 273 | */ |
|
1228 | 2 | protected function setPropertyTableHashesCache( $id, $propertyTableHash ) { |
|
1236 | |||
1237 | /** |
||
1238 | * Simple helper method for debugging cache performance. Prints |
||
1239 | * statistics about the SMWSql3SmwIds object created last. |
||
1240 | * The following code can be used in LocalSettings.php to enable |
||
1241 | * this in a wiki: |
||
1242 | * |
||
1243 | * $wgHooks['SkinAfterContent'][] = 'showCacheStats'; |
||
1244 | * function showCacheStats() { |
||
1245 | * self::debugDumpCacheStats(); |
||
1246 | * return true; |
||
1247 | * } |
||
1248 | * |
||
1249 | * @note This is a debugging/profiling method that no published code |
||
1250 | * should rely on. |
||
1251 | * |
||
1252 | * @since 1.8 |
||
1253 | */ |
||
1254 | public static function debugDumpCacheStats() { |
||
1276 | |||
1277 | /** |
||
1278 | * Returns store Id table name |
||
1279 | * |
||
1280 | 274 | * @return string |
|
1281 | 274 | */ |
|
1282 | public function getIdTable() { |
||
1285 | |||
1286 | } |
||
1287 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.