Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php |
— | — | @@ -477,7 +477,7 @@ |
478 | 478 | if ( $description->getDataItem() instanceof SMWDIWikiPage ) { |
479 | 479 | if ( $description->getComparator() == SMW_CMP_EQ ) { |
480 | 480 | $query->type = SMW_SQL2_VALUE; |
481 | | - $oid = $this->m_store->getSMWPageID( $description->getDataItem()->getDBkey(), $description->getDataItem()->getNamespace(), $description->getDataItem()->getInterwiki(), $description->getDataItem()->getSubobjectId() ); |
| 481 | + $oid = $this->m_store->getSMWPageID( $description->getDataItem()->getDBkey(), $description->getDataItem()->getNamespace(), $description->getDataItem()->getInterwiki(), $description->getDataItem()->getSubobjectName() ); |
482 | 482 | $query->joinfield = array( $oid ); |
483 | 483 | } else { // Join with smw_ids needed for other comparators (apply to title string). |
484 | 484 | $query->jointable = 'smw_ids'; |
— | — | @@ -778,7 +778,7 @@ |
779 | 779 | if ( $i >= count( $keys ) ) break; |
780 | 780 | |
781 | 781 | if ( $ftype == 'p' ) { // Special case: page id, resolve this in advance |
782 | | - $oid = $this->getSMWPageID( $dataItem->getDBkey(), $dataItem->getNamespace(), $dataItem->getInterwiki(), $dataItem->getSubobjectId() ); |
| 782 | + $oid = $this->getSMWPageID( $dataItem->getDBkey(), $dataItem->getNamespace(), $dataItem->getInterwiki(), $dataItem->getSubobjectName() ); |
783 | 783 | $where .= ( $where ? ' AND ' : '' ) . "{$query->alias}.$fname=" . $this->m_dbs->addQuotes( $oid ); |
784 | 784 | break; |
785 | 785 | } elseif ( $ftype != 'l' ) { // plain value, but not a text blob |
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php |
— | — | @@ -119,7 +119,7 @@ |
120 | 120 | |
121 | 121 | // *** Find out if this subject exists ***// |
122 | 122 | $sortkey = ''; |
123 | | - $sid = $this->getSMWPageIDandSort( $subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subject->getSubobjectId(), $sortkey, true ); |
| 123 | + $sid = $this->getSMWPageIDandSort( $subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subject->getSubobjectName(), $sortkey, true ); |
124 | 124 | if ( $sid == 0 ) { // no data, safe our time |
125 | 125 | /// NOTE: we consider redirects for getting $sid, so $sid == 0 also means "no redirects" |
126 | 126 | self::$in_getSemanticData--; |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | // *** Prepare the cache ***// |
132 | 132 | if ( !array_key_exists( $sid, $this->m_semdata ) ) { // new cache entry |
133 | 133 | $this->m_semdata[$sid] = new SMWSqlStubSemanticData( $subject, false ); |
134 | | - if ( $subject->getSubobjectId() == '' ) { // no sortkey for subobjects |
| 134 | + if ( $subject->getSubobjectName() == '' ) { // no sortkey for subobjects |
135 | 135 | $this->m_semdata[$sid]->addPropertyStubValue( '_SKEY', array( $sortkey ) ); |
136 | 136 | } |
137 | 137 | $this->m_sdstate[$sid] = array(); |
— | — | @@ -502,7 +502,7 @@ |
503 | 503 | if ( $i >= count( $dbkeys ) ) break; |
504 | 504 | |
505 | 505 | if ( $typeid == 'p' ) { // Special case: page id, resolve this in advance |
506 | | - $oid = $this->getSMWPageID( $value->getDBkey(), $value->getNamespace(), $value->getInterwiki(), $value->getSubobjectId() ); |
| 506 | + $oid = $this->getSMWPageID( $value->getDBkey(), $value->getNamespace(), $value->getInterwiki(), $value->getSubobjectName() ); |
507 | 507 | $where .= ( $where ? ' AND ' : '' ) . "t$tableindex.$fieldname=" . $db->addQuotes( $oid ); |
508 | 508 | break; |
509 | 509 | } elseif ( $typeid != 'l' ) { // plain value, but not a text blob |
— | — | @@ -538,7 +538,7 @@ |
539 | 539 | */ |
540 | 540 | public function getProperties( SMWDIWikiPage $subject, $requestoptions = null ) { |
541 | 541 | wfProfileIn( "SMWSQLStore2::getProperties (SMW)" ); |
542 | | - $sid = $this->getSMWPageID( $subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subject->getSubobjectId() ); |
| 542 | + $sid = $this->getSMWPageID( $subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subject->getSubobjectName() ); |
543 | 543 | |
544 | 544 | if ( $sid == 0 ) { // no id, no page, no properties |
545 | 545 | wfProfileOut( "SMWSQLStore2::getProperties (SMW)" ); |
— | — | @@ -726,7 +726,7 @@ |
727 | 727 | } |
728 | 728 | |
729 | 729 | // Always make an ID (pages without ID cannot be in query results, not even in fixed value queries!): |
730 | | - $sid = $this->makeSMWPageID( $subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subject->getSubobjectId(), true, $sortkey ); |
| 730 | + $sid = $this->makeSMWPageID( $subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subject->getSubobjectName(), true, $sortkey ); |
731 | 731 | $updates = array(); // collect data for bulk updates; format: tableid => updatearray |
732 | 732 | $this->prepareDBUpdates( $updates, $data, $sid, $subject ); |
733 | 733 | |
— | — | @@ -799,8 +799,8 @@ |
800 | 800 | protected function prepareDBUpdates( &$updates, SMWSemanticData $data, $sid, SMWDIWikiPage $subject ) { |
801 | 801 | if ( $sid == 0 ) { |
802 | 802 | $sid = $this->makeSMWPageID( $subject->getDBkey(), $subject->getNamespace(), |
803 | | - $subject->getInterwiki(), $subject->getSubobjectId(), true, |
804 | | - str_replace( '_', ' ', $subject->getDBkey() ) . $subject->getSubobjectId() ); |
| 803 | + $subject->getInterwiki(), $subject->getSubobjectName(), true, |
| 804 | + str_replace( '_', ' ', $subject->getDBkey() ) . $subject->getSubobjectName() ); |
805 | 805 | } |
806 | 806 | |
807 | 807 | $proptables = self::getPropertyTables(); |
— | — | @@ -845,7 +845,7 @@ |
846 | 846 | $namespace = next( $dbkeys ); |
847 | 847 | $iw = next( $dbkeys ); |
848 | 848 | $sortkey = next( $dbkeys ); // not used; sortkeys are not set on writing objects |
849 | | - $uvals[$fieldname] = $this->makeSMWPageID( $di->getDBkey(), $di->getNamespace(), $di->getInterwiki(), $di->getSubobjectId() ); |
| 849 | + $uvals[$fieldname] = $this->makeSMWPageID( $di->getDBkey(), $di->getNamespace(), $di->getInterwiki(), $di->getSubobjectName() ); |
850 | 850 | } |
851 | 851 | |
852 | 852 | next( $dbkeys ); |
— | — | @@ -1898,9 +1898,9 @@ |
1899 | 1899 | * the canonical alias ID for the given page. If no such ID exists, 0 is |
1900 | 1900 | * returned. |
1901 | 1901 | */ |
1902 | | - public function getSMWPageID( $title, $namespace, $iw, $subobjectId, $canonical = true ) { |
| 1902 | + public function getSMWPageID( $title, $namespace, $iw, $subobjectName, $canonical = true ) { |
1903 | 1903 | $sort = ''; |
1904 | | - return $this->getSMWPageIDandSort( $title, $namespace, $iw, $subobjectId, $sort, $canonical ); |
| 1904 | + return $this->getSMWPageIDandSort( $title, $namespace, $iw, $subobjectName, $sort, $canonical ); |
1905 | 1905 | } |
1906 | 1906 | |
1907 | 1907 | /** |
— | — | @@ -1910,13 +1910,13 @@ |
1911 | 1911 | * @todo Centralise creation of id cache keys, and make sure non-local pages have only one key |
1912 | 1912 | * (no need to distinguish canonical/non-canonical in this case). |
1913 | 1913 | */ |
1914 | | - public function getSMWPageIDandSort( $title, $namespace, $iw, $subobjectId, &$sort, $canonical ) { |
| 1914 | + public function getSMWPageIDandSort( $title, $namespace, $iw, $subobjectName, &$sort, $canonical ) { |
1915 | 1915 | global $smwgQEqualitySupport; |
1916 | 1916 | |
1917 | 1917 | wfProfileIn( 'SMWSQLStore2::getSMWPageID (SMW)' ); |
1918 | 1918 | |
1919 | | - $ckey = "$iw $namespace $title $subobjectId C"; |
1920 | | - $nkey = "$iw $namespace $title $subobjectId -"; |
| 1919 | + $ckey = "$iw $namespace $title $subobjectName C"; |
| 1920 | + $nkey = "$iw $namespace $title $subobjectName -"; |
1921 | 1921 | $key = ( $canonical ? $ckey : $nkey ); |
1922 | 1922 | |
1923 | 1923 | if ( array_key_exists( $key, $this->m_ids ) ) { |
— | — | @@ -1935,7 +1935,7 @@ |
1936 | 1936 | $res = $db->select( |
1937 | 1937 | 'smw_ids', |
1938 | 1938 | array( 'smw_id', 'smw_sortkey' ), |
1939 | | - array( 'smw_title' => $title, 'smw_namespace' => $namespace, 'smw_iw' => $iw, 'smw_subobject' => $subobjectId ), |
| 1939 | + array( 'smw_title' => $title, 'smw_namespace' => $namespace, 'smw_iw' => $iw, 'smw_subobject' => $subobjectName ), |
1940 | 1940 | 'SMW::getSMWPageID', array( 'LIMIT' => 1 ) |
1941 | 1941 | ); |
1942 | 1942 | $row = $db->fetchObject( $res ); |
— | — | @@ -1951,7 +1951,7 @@ |
1952 | 1952 | ' AND smw_namespace=' . $db->addQuotes( $namespace ) . |
1953 | 1953 | ' AND (smw_iw=' . $db->addQuotes( '' ) . |
1954 | 1954 | ' OR smw_iw=' . $db->addQuotes( SMW_SQL2_SMWREDIIW ) . ')' . |
1955 | | - ' AND smw_subobject=' . $db->addQuotes( $subobjectId ), |
| 1955 | + ' AND smw_subobject=' . $db->addQuotes( $subobjectName ), |
1956 | 1956 | 'SMW::getSMWPageID', array( 'LIMIT' => 1 ) ); |
1957 | 1957 | $row = $db->fetchObject( $res ); |
1958 | 1958 | |
— | — | @@ -1961,7 +1961,7 @@ |
1962 | 1962 | |
1963 | 1963 | if ( ( $row->smw_iw == '' ) ) { // the id found is unique (canonical and non-canonical); fill cache also for the case *not* asked for |
1964 | 1964 | $this->m_ids[ $canonical ? $nkey : $ckey ] = $id; // (the other cache is filled below) |
1965 | | - } elseif ( $canonical && ( $subobjectId == '' ) && ( $smwgQEqualitySupport != SMW_EQ_NONE ) ) { // check for redirect alias |
| 1965 | + } elseif ( $canonical && ( $subobjectName == '' ) && ( $smwgQEqualitySupport != SMW_EQ_NONE ) ) { // check for redirect alias |
1966 | 1966 | if ( $namespace == SMW_NS_PROPERTY ) { // redirect properties only to properties |
1967 | 1967 | ///TODO: Shouldn't this condition be ensured during writing? |
1968 | 1968 | $res2 = $db->select( array( 'smw_redi2', 'smw_ids' ), 'o_id', |
— | — | @@ -2001,11 +2001,11 @@ |
2002 | 2002 | * the title is a redirect target (we do not want chains of redirects). |
2003 | 2003 | * But it is of no relevance if the title does not have an id yet. |
2004 | 2004 | */ |
2005 | | - protected function makeSMWPageID( $title, $namespace, $iw, $subobjectId, $canonical = true, $sortkey = '' ) { |
| 2005 | + protected function makeSMWPageID( $title, $namespace, $iw, $subobjectName, $canonical = true, $sortkey = '' ) { |
2006 | 2006 | wfProfileIn( 'SMWSQLStore2::makeSMWPageID (SMW)' ); |
2007 | 2007 | |
2008 | 2008 | $oldsort = ''; |
2009 | | - $id = $this->getSMWPageIDandSort( $title, $namespace, $iw, $subobjectId, $oldsort, $canonical ); |
| 2009 | + $id = $this->getSMWPageIDandSort( $title, $namespace, $iw, $subobjectName, $oldsort, $canonical ); |
2010 | 2010 | |
2011 | 2011 | if ( $id == 0 ) { |
2012 | 2012 | $db = wfGetDB( DB_MASTER ); |
— | — | @@ -2018,19 +2018,19 @@ |
2019 | 2019 | 'smw_title' => $title, |
2020 | 2020 | 'smw_namespace' => $namespace, |
2021 | 2021 | 'smw_iw' => $iw, |
2022 | | - 'smw_subobject' => $subobjectId, |
| 2022 | + 'smw_subobject' => $subobjectName, |
2023 | 2023 | 'smw_sortkey' => $sortkey |
2024 | 2024 | ), |
2025 | 2025 | 'SMW::makeSMWPageID' |
2026 | 2026 | ); |
2027 | 2027 | |
2028 | 2028 | $id = $db->insertId(); |
2029 | | - $this->m_ids["$iw $namespace $title $subobjectId -"] = $id; // fill that cache, even if canonical was given |
| 2029 | + $this->m_ids["$iw $namespace $title $subobjectName -"] = $id; // fill that cache, even if canonical was given |
2030 | 2030 | |
2031 | 2031 | // This ID is also authorative for the canonical version. |
2032 | 2032 | // This is always the case: if $canonical===false and $id===0, then there is no redi-entry in |
2033 | 2033 | // smw_ids either, hence the object just did not exist at all. |
2034 | | - $this->m_ids["$iw $namespace $title $subobjectId C"] = $id; |
| 2034 | + $this->m_ids["$iw $namespace $title $subobjectName C"] = $id; |
2035 | 2035 | } elseif ( ( $sortkey != '' ) && ( $sortkey != $oldsort ) ) { |
2036 | 2036 | $db = wfGetDB( DB_MASTER ); |
2037 | 2037 | $db->update( 'smw_ids', array( 'smw_sortkey' => $sortkey ), array( 'smw_id' => $id ), 'SMW::makeSMWPageID' ); |
— | — | @@ -2086,9 +2086,9 @@ |
2087 | 2087 | * with iw being SMW_SQL2_SMWREDIIW. This information is used to determine |
2088 | 2088 | * whether the given ID is canonical or not. |
2089 | 2089 | */ |
2090 | | - public function cacheSMWPageID( $id, $title, $namespace, $iw, $subobjectId ) { |
2091 | | - $ckey = "$iw $namespace $title $subobjectId C"; |
2092 | | - $nkey = "$iw $namespace $title $subobjectId -"; |
| 2090 | + public function cacheSMWPageID( $id, $title, $namespace, $iw, $subobjectName ) { |
| 2091 | + $ckey = "$iw $namespace $title $subobjectName C"; |
| 2092 | + $nkey = "$iw $namespace $title $subobjectName -"; |
2093 | 2093 | |
2094 | 2094 | if ( count( $this->m_ids ) > 1500 ) { // prevent memory leak in very long PHP runs |
2095 | 2095 | $this->m_ids = array(); |
— | — | @@ -2226,7 +2226,7 @@ |
2227 | 2227 | * @param $subject SMWDIWikiPage the data of which is deleted |
2228 | 2228 | */ |
2229 | 2229 | protected function deleteSemanticData( SMWDIWikiPage $subject ) { |
2230 | | - if ( $subject->getSubobjectId() != '' ) return; // not needed, and would mess up data |
| 2230 | + if ( $subject->getSubobjectName() != '' ) return; // not needed, and would mess up data |
2231 | 2231 | |
2232 | 2232 | $db = wfGetDB( DB_MASTER ); |
2233 | 2233 | |
Index: trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_WikiPage.php |
— | — | @@ -30,11 +30,11 @@ |
31 | 31 | */ |
32 | 32 | protected $m_interwiki; |
33 | 33 | /** |
34 | | - * Id for subobjects of pages, or empty string if the given object is |
| 34 | + * Name for subobjects of pages, or empty string if the given object is |
35 | 35 | * the page itself (not a subobject). |
36 | 36 | * @var string |
37 | 37 | */ |
38 | | - protected $m_subobjectid; |
| 38 | + protected $m_subobjectname; |
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Contructor. We do not bother with too much detailed validation here, |
— | — | @@ -44,14 +44,14 @@ |
45 | 45 | * would be more work than it is worth, since callers will usually be |
46 | 46 | * careful and since errors here do not have major consequences. |
47 | 47 | */ |
48 | | - public function __construct( $dbkey, $namespace, $interwiki, $subobjectid = '' ) { |
| 48 | + public function __construct( $dbkey, $namespace, $interwiki, $subobjectname = '' ) { |
49 | 49 | if ( !is_numeric( $namespace ) ) { |
50 | 50 | throw new SMWDataItemException( "Given namespace '$namespace' is not an integer." ); |
51 | 51 | } |
52 | 52 | $this->m_dbkey = $dbkey; |
53 | 53 | $this->m_namespace = (int)$namespace; // really make this an integer |
54 | 54 | $this->m_interwiki = $interwiki; |
55 | | - $this->m_subobjectid = $subobjectid; |
| 55 | + $this->m_subobjectname = $subobjectname; |
56 | 56 | } |
57 | 57 | |
58 | 58 | public function getDIType() { |
— | — | @@ -70,8 +70,8 @@ |
71 | 71 | return $this->m_interwiki; |
72 | 72 | } |
73 | 73 | |
74 | | - public function getSubobjectId() { |
75 | | - return $this->m_subobjectid; |
| 74 | + public function getSubobjectName() { |
| 75 | + return $this->m_subobjectname; |
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
— | — | @@ -104,10 +104,10 @@ |
105 | 105 | } |
106 | 106 | |
107 | 107 | public function getSerialization() { |
108 | | - if ( $this->m_subobjectid == '' ) { |
| 108 | + if ( $this->m_subobjectname == '' ) { |
109 | 109 | return strval( $this->m_dbkey . '#' . strval( $this->m_namespace ) . '#' . $this->m_interwiki ); |
110 | 110 | } else { |
111 | | - return strval( $this->m_dbkey . '#' . strval( $this->m_namespace ) . '#' . $this->m_interwiki . '#' . $this->m_subobjectid ); |
| 111 | + return strval( $this->m_dbkey . '#' . strval( $this->m_namespace ) . '#' . $this->m_interwiki . '#' . $this->m_subobjectname ); |
112 | 112 | } |
113 | 113 | } |
114 | 114 | |