$this->mInterlangs[$key] = $title;
}
+ foreach ( $this->mCategories as $cat => &$sortkey ) {
+ # If the sortkey is longer then 255 bytes,
+ # it truncated by DB, and then doesn't get
+ # matched when comparing existing vs current
+ # categories, causing bug 25254.
+ $sortkey = substr( $sortkey, 0, 255 );
+ }
+
$this->mRecursive = $recursive;
wfRunHooks( 'LinksUpdateConstructed', array( &$this ) );
'page_touched < ' . $this->mDb->addQuotes( $now )
), __METHOD__
);
- while ( $row = $this->mDb->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
$ids[] = $row->page_id;
}
if ( !count( $ids ) ) {
function getLinkInsertions( $existing = array() ) {
$arr = array();
foreach( $this->mLinks as $ns => $dbkeys ) {
- # array_diff_key() was introduced in PHP 5.1, there is a compatibility function
- # in GlobalFunctions.php
$diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
foreach ( $diffs as $dbk => $id ) {
$arr[] = array(
* @private
*/
function getCategoryInsertions( $existing = array() ) {
- global $wgContLang, $wgCollationVersion;
+ global $wgContLang, $wgCategoryCollation;
$diffs = array_diff_assoc( $this->mCategories, $existing );
$arr = array();
foreach ( $diffs as $name => $sortkey ) {
'cl_sortkey' => $sortkey,
'cl_timestamp' => $this->mDb->timestamp(),
'cl_sortkey_prefix' => $prefix,
- 'cl_collation' => $wgCollationVersion,
+ 'cl_collation' => $wgCategoryCollation,
'cl_type' => $type,
);
}
function getInterwikiInsertions( $existing = array() ) {
$arr = array();
foreach( $this->mInterwikis as $prefix => $dbkeys ) {
- # array_diff_key() was introduced in PHP 5.1, there is a compatibility function
- # in GlobalFunctions.php
$diffs = isset( $existing[$prefix] ) ? array_diff_key( $dbkeys, $existing[$prefix] ) : $dbkeys;
foreach ( $diffs as $dbk => $id ) {
$arr[] = array(
return $arr;
}
-
-
/**
* Given an array of existing links, returns those links which are not in $this
* and thus should be deleted.
$res = $this->mDb->select( 'pagelinks', array( 'pl_namespace', 'pl_title' ),
array( 'pl_from' => $this->mId ), __METHOD__, $this->mOptions );
$arr = array();
- while ( $row = $this->mDb->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
if ( !isset( $arr[$row->pl_namespace] ) ) {
$arr[$row->pl_namespace] = array();
}
$res = $this->mDb->select( 'templatelinks', array( 'tl_namespace', 'tl_title' ),
array( 'tl_from' => $this->mId ), __METHOD__, $this->mOptions );
$arr = array();
- while ( $row = $this->mDb->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
if ( !isset( $arr[$row->tl_namespace] ) ) {
$arr[$row->tl_namespace] = array();
}
$res = $this->mDb->select( 'imagelinks', array( 'il_to' ),
array( 'il_from' => $this->mId ), __METHOD__, $this->mOptions );
$arr = array();
- while ( $row = $this->mDb->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
$arr[$row->il_to] = 1;
}
return $arr;
$res = $this->mDb->select( 'externallinks', array( 'el_to' ),
array( 'el_from' => $this->mId ), __METHOD__, $this->mOptions );
$arr = array();
- while ( $row = $this->mDb->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
$arr[$row->el_to] = 1;
}
return $arr;
* @private
*/
function getExistingCategories() {
- $res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey' ),
+ $res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey_prefix' ),
array( 'cl_from' => $this->mId ), __METHOD__, $this->mOptions );
$arr = array();
- while ( $row = $this->mDb->fetchObject( $res ) ) {
- $arr[$row->cl_to] = $row->cl_sortkey;
+ foreach ( $res as $row ) {
+ if ( $row->cl_sortkey_prefix !== '' ) {
+ $arr[$row->cl_to] = $row->cl_sortkey_prefix;
+ } else {
+ $arr[$row->cl_to] = $this->mTitle->getCategorySortkey();
+ }
}
return $arr;
}
$res = $this->mDb->select( 'langlinks', array( 'll_lang', 'll_title' ),
array( 'll_from' => $this->mId ), __METHOD__, $this->mOptions );
$arr = array();
- while ( $row = $this->mDb->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
$arr[$row->ll_lang] = $row->ll_title;
}
return $arr;
$res = $this->mDb->select( 'iwlinks', array( 'iwl_prefix', 'iwl_title' ),
array( 'iwl_from' => $this->mId ), __METHOD__, $this->mOptions );
$arr = array();
- while ( $row = $this->mDb->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
if ( !isset( $arr[$row->iwl_prefix] ) ) {
$arr[$row->iwl_prefix] = array();
}
$res = $this->mDb->select( 'page_props', array( 'pp_propname', 'pp_value' ),
array( 'pp_page' => $this->mId ), __METHOD__, $this->mOptions );
$arr = array();
- while ( $row = $this->mDb->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
$arr[$row->pp_propname] = $row->pp_value;
}
return $arr;