summaryrefslogtreecommitdiff
path: root/includes/LinksUpdate.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /includes/LinksUpdate.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'includes/LinksUpdate.php')
-rw-r--r--includes/LinksUpdate.php44
1 files changed, 33 insertions, 11 deletions
diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php
index b86ea565..1fe6118a 100644
--- a/includes/LinksUpdate.php
+++ b/includes/LinksUpdate.php
@@ -2,6 +2,21 @@
/**
* See docs/deferred.txt
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
* @todo document (e.g. one-sentence top-level class description).
*/
class LinksUpdate {
@@ -67,7 +82,7 @@ class LinksUpdate {
$this->mInterlangs[$key] = $title;
}
- foreach ( $this->mCategories as $cat => &$sortkey ) {
+ foreach ( $this->mCategories as &$sortkey ) {
# If the sortkey is longer then 255 bytes,
# it truncated by DB, and then doesn't get
# matched when comparing existing vs current
@@ -110,7 +125,8 @@ class LinksUpdate {
$existing = $this->getExistingImages();
$imageDeletes = $this->getImageDeletions( $existing );
- $this->incrTableUpdate( 'imagelinks', 'il', $imageDeletes, $this->getImageInsertions( $existing ) );
+ $this->incrTableUpdate( 'imagelinks', 'il', $imageDeletes,
+ $this->getImageInsertions( $existing ) );
# Invalidate all image description pages which had links added or removed
$imageUpdates = $imageDeletes + array_diff_key( $this->mImages, $existing );
@@ -141,7 +157,8 @@ class LinksUpdate {
$categoryDeletes = $this->getCategoryDeletions( $existing );
- $this->incrTableUpdate( 'categorylinks', 'cl', $categoryDeletes, $this->getCategoryInsertions( $existing ) );
+ $this->incrTableUpdate( 'categorylinks', 'cl', $categoryDeletes,
+ $this->getCategoryInsertions( $existing ) );
# Invalidate all categories which were added, deleted or changed (set symmetric difference)
$categoryInserts = array_diff_assoc( $this->mCategories, $existing );
@@ -154,7 +171,8 @@ class LinksUpdate {
$propertiesDeletes = $this->getPropertyDeletions( $existing );
- $this->incrTableUpdate( 'page_props', 'pp', $propertiesDeletes, $this->getPropertyInsertions( $existing ) );
+ $this->incrTableUpdate( 'page_props', 'pp', $propertiesDeletes,
+ $this->getPropertyInsertions( $existing ) );
# Invalidate the necessary pages
$changed = $propertiesDeletes + array_diff_assoc( $this->mProperties, $existing );
@@ -362,7 +380,9 @@ class LinksUpdate {
function getLinkInsertions( $existing = array() ) {
$arr = array();
foreach( $this->mLinks as $ns => $dbkeys ) {
- $diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
+ $diffs = isset( $existing[$ns] )
+ ? array_diff_key( $dbkeys, $existing[$ns] )
+ : $dbkeys;
foreach ( $diffs as $dbk => $id ) {
$arr[] = array(
'pl_from' => $this->mId,
@@ -418,11 +438,13 @@ class LinksUpdate {
$arr = array();
$diffs = array_diff_key( $this->mExternals, $existing );
foreach( $diffs as $url => $dummy ) {
- $arr[] = array(
- 'el_from' => $this->mId,
- 'el_to' => $url,
- 'el_index' => wfMakeUrlIndex( $url ),
- );
+ foreach( wfMakeUrlIndexes( $url ) as $index ) {
+ $arr[] = array(
+ 'el_from' => $this->mId,
+ 'el_to' => $url,
+ 'el_index' => $index,
+ );
+ }
}
return $arr;
}
@@ -749,7 +771,7 @@ class LinksUpdate {
function getTitle() {
return $this->mTitle;
}
-
+
/**
* Return the list of images used as generated by the parser
*/