/** * Return the array of predefined property table declarations, initialising * it if necessary. The result is an array of SMWSQLStore3Table objects * indexed by table ids. Note that the ids are only for accessing the data * and should not be assumed to agree with the table name. * * @return array of SMWSQLStore3Table */ public static function getPropertyTables() { if (isset(self::$prop_tables)) { return self::$prop_tables; // Don't initialise twice. } self::$prop_tables = array(); //tables for each DI type foreach (self::$di_type_tables as $tableDIType => $tableName) { self::$prop_tables[$tableName] = new SMWSQLStore3Table($tableDIType, $tableName); } //tables for special properties foreach (self::$special_tables as $propertyKey) { $typeId = SMWDIProperty::getPredefinedPropertyTypeId($propertyKey); $diType = SMWDataValueFactory::getDataItemId($typeId); $tableName = 'smw_fpt' . strtolower($propertyKey); self::$prop_tables[$tableName] = new SMWSQLStore3Table($diType, $tableName, $propertyKey); } // Redirect table uses another subject scheme for historic reasons // TODO This should be changed if possible self::$prop_tables['smw_fpt_redi']->idsubject = false; // Get all the tables for the properties that are declared as fixed // (overly used and thus having separate tables) foreach (self::$fixedProperties as $propertyKey => $tableDIType) { $tableName = 'smw_fpt_' . md5($propertyKey); self::$prop_tables[$tableName] = new SMWSQLStore3Table($tableDIType, $tableName, $propertyKey); } wfRunHooks('SMWPropertyTables', array(&self::$prop_tables)); // Build index for finding property tables self::$fixedPropertyTableIds = array(); foreach (self::$prop_tables as $tid => $proptable) { if ($proptable->fixedproperty) { self::$fixedPropertyTableIds[$proptable->fixedproperty] = $tid; } } return self::$prop_tables; }
/** * Return the array of predefined property table declarations, initialising * it if necessary. The result is an array of SMWSQLStore3Table objects * indexed by table ids. * * It is ensured that the keys of the returned array agree with the name of * the table that they refer to. * * @since 1.8 * @return SMWSQLStore3Table[] */ public static function getPropertyTables() { if (isset(self::$prop_tables)) { return self::$prop_tables; // Don't initialise twice. } /** * @var SMWSQLStore3Table[] $propertyTables */ $propertyTables = array(); //tables for each DI type foreach (self::$di_type_tables as $tableDIType => $tableName) { $propertyTables[$tableName] = new SMWSQLStore3Table($tableDIType, $tableName); } //tables for special properties foreach (self::$special_tables as $propertyKey) { $typeId = SMWDIProperty::getPredefinedPropertyTypeId($propertyKey); $diType = SMWDataValueFactory::getDataItemId($typeId); $tableName = 'smw_fpt' . strtolower($propertyKey); $propertyTables[$tableName] = new SMWSQLStore3Table($diType, $tableName, $propertyKey); } // Redirect table uses another subject scheme for historic reasons // TODO This should be changed if possible $propertyTables['smw_fpt_redi']->setUsesIdSubject(false); // Get all the tables for the properties that are declared as fixed // (overly used and thus having separate tables) foreach (self::$fixedProperties as $propertyKey => $tableDIType) { $tableName = 'smw_fpt_' . md5($propertyKey); $propertyTables[$tableName] = new SMWSQLStore3Table($tableDIType, $tableName, $propertyKey); } wfRunHooks('SMWPropertyTables', array(&$propertyTables)); self::$prop_tables = $propertyTables; // Build index for finding property tables self::$fixedPropertyTableIds = array(); foreach (self::$prop_tables as $tid => $propTable) { if ($propTable->isFixedPropertyTable()) { self::$fixedPropertyTableIds[$propTable->getFixedProperty()] = $tid; } } // Specifically set properties that must not be stored in any // property table to null here. Any function that hits this // null unprepared is doing something wrong anyway. self::$fixedPropertyTableIds['_SKEY'] = null; return self::$prop_tables; }
/** * Resets internal objects * * @since 1.9.1.1 */ public function clear() { parent::clear(); $this->m_semdata = array(); $this->m_sdstate = array(); self::$prop_tables = null; $this->getObjectIds()->clearCaches(); }