dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Fix List* in MessagesKo.php"
[lhc/web/wiklou.git]
/
maintenance
/
populateInterwiki.php
diff --git
a/maintenance/populateInterwiki.php
b/maintenance/populateInterwiki.php
index
5d32b99
..
acc66c5
100644
(file)
--- a/
maintenance/populateInterwiki.php
+++ b/
maintenance/populateInterwiki.php
@@
-24,6
+24,8
@@
* @author Katie Filbert < aude.wiki@gmail.com >
*/
* @author Katie Filbert < aude.wiki@gmail.com >
*/
+use MediaWiki\MediaWikiServices;
+
require_once __DIR__ . '/Maintenance.php';
class PopulateInterwiki extends Maintenance {
require_once __DIR__ . '/Maintenance.php';
class PopulateInterwiki extends Maintenance {
@@
-33,11
+35,6
@@
class PopulateInterwiki extends Maintenance {
*/
private $source;
*/
private $source;
- /**
- * @var BagOStuff
- */
- private $cache;
-
public function __construct() {
parent::__construct();
public function __construct() {
parent::__construct();
@@
-61,11
+58,9
@@
TEXT
}
public function execute() {
}
public function execute() {
- $force = $this->
getOption( 'force', false
);
+ $force = $this->
hasOption( 'force'
);
$this->source = $this->getOption( 'source', 'https://en.wikipedia.org/w/api.php' );
$this->source = $this->getOption( 'source', 'https://en.wikipedia.org/w/api.php' );
- $this->cache = wfGetMainCache();
-
$data = $this->fetchLinks();
if ( $data === false ) {
$data = $this->fetchLinks();
if ( $data === false ) {
@@
-126,6
+121,7
@@
TEXT
}
}
}
}
+ $lookup = MediaWikiServices::getInstance()->getInterwikiLookup();
foreach ( $data as $d ) {
$prefix = $d['prefix'];
foreach ( $data as $d ) {
$prefix = $d['prefix'];
@@
-136,7
+132,7
@@
TEXT
__METHOD__
);
__METHOD__
);
- if ( !
$row ) {
+ if ( !$row ) {
$dbw->insert(
'interwiki',
[
$dbw->insert(
'interwiki',
[
@@
-149,7
+145,7
@@
TEXT
);
}
);
}
- $
this->clearCacheEntry
( $prefix );
+ $
lookup->invalidateCache
( $prefix );
}
$this->output( "Interwiki links are populated.\n" );
}
$this->output( "Interwiki links are populated.\n" );
@@
-157,14
+153,6
@@
TEXT
return true;
}
return true;
}
- /**
- * @param string $prefix
- */
- private function clearCacheEntry( $prefix ) {
- $key = wfMemcKey( 'interwiki', $prefix );
- $this->cache->delete( $key );
- }
-
}
$maintClass = PopulateInterwiki::class;
}
$maintClass = PopulateInterwiki::class;