Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F7505963
federation.md
Lucas_Werkmeister_WMDE (Lucas Werkmeister (WMDE))
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
Lucas_Werkmeister_WMDE
Apr 12 2017, 12:55 PM
2017-04-12 12:55:47 (UTC+0)
Size
10 KB
Referenced Files
None
Subscribers
None
federation.md
View Options
-
I
copy
the
entire
MediaWiki
installation
,
wipe
the
LocalSettings
.
php
and
run
the
setup
on
the
second
instance
.
I
enable
repo
and
client
in
the
second
installation
.
I
now
have
two
installations
:
wiki1
(
local
)
and
wiki2
(
remote
).
-
Now
I
’
m
lost
for
a
bit
.
Presumably
,
the
usual
consumer
of
this
documentation
is
assumed
to
know
how
to
set
up
regular
interwiki
links
already
…
-
I
try
to
set
up
interwiki
links
.
-
<
https
:
//www.mediawiki.org/wiki/Extension:Interwiki> seems to be outdated?
I
don
’
t
have
a
Special
:
Interwiki
page
,
but
the
`
wfLoadExtension
()
`
snippet
doesn
’
t
work
(
Interwiki
.
php
is
in
`
includes
/
interwiki
`
,
not
in
`
extensions
/
Interwiki
`
).
-
Oh
,
according
to
`
api
.
php
?
action
=
query
&
meta
=
siteinfo
&
siprop
=
interwikimap
`
I
already
have
lots
of
interwikis
set
up
?
-
Okay
,
looks
like
<
https
:
//www.mediawiki.org/wiki/Manual:Interwiki> is the more helpful documentation.
INSERT
INTO
interwiki
(
iw_prefix
,
iw_url
,
iw_api
,
iw_wikiid
,
iw_local
,
iw_trans
)
VALUES
(
'
wiki2
'
,
'
http
:
//localhost/wiki2/$1', '', '', 1, 0);
(
I
leave
the
`
iw_api
`
and
`
iw_wikiid
`
fields
blank
,
which
matches
most
of
the
existing
entries
.
However
,
they
don
’
t
have
a
default
values
,
so
I
do
have
to
set
them
explicitly
.)
-
I
create
some
properties
and
items
in
the
remote
wiki
(
wiki2
).
-
I
try
to
configure
the
remote
repository
in
the
local
wiki
:
$
wgWBClientSettings
[
'
foreignRepositories
'
]
=
array
(
'
wiki2
'
=>
array
(
'
supportedEntityTypes
'
=>
array
(
'
item
'
,
'
property
'
),
'
repoDatabase
'
=>
'
wiki2
'
,
'
baseUri
'
=>
'
http
:
//localhost/wiki2/'
)
);
The
values
are
mostly
guessed
–
I
assume
that
entity
types
are
`
item
`
(
type
)
and
not
`
Item
`
(
namespace
);
that
a
“
symbolic
database
name
”
is
just
a
database
name
;
that
the
base
URI
should
point
to
the
remote
repository
URL
;
and
that
the
`
prefixMapping
`
is
optional
and
defaults
to
empty
.
(
Later
,
it
turns
out
that
this
last
part
produces
warnings
,
so
I
explicitly
specify
an
empty
array
.)
-
Upon
loading
an
item
in
the
local
wiki
,
I
get
a
rather
ugly
error
.
The
error
message
is
“
(
Cannot
access
the
database
)
”
,
so
presumably
I
need
to
grant
the
wiki1
MySQL
user
access
to
the
wiki2
database
(
I
configured
the
wikis
to
each
create
a
user
for
themselves
).
GRANT
ALL
ON
wiki2
.*
TO
wiki1
;
(
Presumably
,
read
-
only
access
would
suffice
,
but
I
’
m
lazy
and
also
don
’
t
know
SQL
permissions
.)
-
I
try
to
add
remote
statements
.
At
first
,
I
’
m
confused
that
there
are
no
suggestions
for
“
remote
”
(
I
called
the
sample
data
on
wiki2
“
remote
property
”
and
“
remote
item
”
),
but
entering
`
wiki2
:
P3
`
and
`
wiki2
:
Q2
`
appears
to
work
and
shows
their
labels
.
However
,
I
can
’
t
save
the
statement
:
Internal
Server
Error
.
Dev
Tools
reveals
the
error
message
:
>
Using
same
entity
types
on
multiple
repositories
is
not
supported
yet
.
"item"
has
already
be
defined
for
repository
""
I
guess
Commons
won
’
t
define
items
of
its
own
,
so
that
’
s
why
this
restrictions
makes
sense
there
?
-
Will
it
work
if
I
just
rename
the
item
type
?
Let
’
s
try
with
a
new
wiki
.
-
I
set
up
`
wiki3
`
just
like
`
wiki2
`
above
.
-
I
add
this
to
the
local
settings
(
based
on
`
repo
/
config
/
Wikibase
.
example
.
php
`
):
$
wgWBRepoSettings
[
'
entityNamespaces
'
][
'
item3
'
]
=
WB_NS_ITEM
;
$
wgWBRepoSettings
[
'
entityNamespaces
'
][
'
property3
'
]
=
WB_NS_PROPERTY
;
-
I
run
the
installation
scripts
as
described
in
the
mw
:
Wikibase
/
Installation
.
(
It
’
s
probably
a
good
thing
that
I
forgot
to
do
this
two
steps
ago
and
only
did
it
after
adjusting
`
LocalSettings
.
php
`…
)
-
I
add
a
property
and
an
item
on
wiki3
.
-
I
add
the
wiki3
interwiki
to
wiki1
as
above
(
`
INSERT
INTO
interwiki
`…
).
-
I
add
wiki3
to
wiki1
’
s
`
foreignRepositories
`
,
with
the
`
supportedEntityTypes
`
`
item3
`
and
`
property3
`
instead
of
`
item
`
and
`
property
`
.
-
I
grant
wiki1
access
to
the
wiki3
database
,
as
above
(
`
GRANT
`…
).
-
I
try
to
open
a
page
in
wiki1
and
get
this
error
(
blank
page
,
error
message
from
Apache
`
error
.
log
`
):
>
PHP
Fatal
error
:
Uncaught
Error
:
Call
to
a
member
function
getCode
()
on
null
in
/
var
/
www
/
html
/
wiki1
/
includes
/
user
/
User
.
php
:
1566
>
Stack
trace
:
>
#
0
/
var
/
www
/
html
/
wiki1
/
includes
/
user
/
User
.
php
(
5231
):
User
::
getDefaultOptions
()
>
#
1
/
var
/
www
/
html
/
wiki1
/
includes
/
user
/
User
.
php
(
502
):
User
->
loadOptions
()
>
#
2
/
var
/
www
/
html
/
wiki1
/
includes
/
libs
/
objectcache
/
WANObjectCache
.
php
(
889
):
User
->{
closure
}(
false
,
3600
,
Array
,
NULL
)
>
#
3
/
var
/
www
/
html
/
wiki1
/
includes
/
libs
/
objectcache
/
WANObjectCache
.
php
(
1009
):
WANObjectCache
->{
closure
}(
false
,
3600
,
Array
,
NULL
)
>
#
4
/
var
/
www
/
html
/
wiki1
/
includes
/
libs
/
objectcache
/
WANObjectCache
.
php
(
892
):
WANObjectCache
->
doGetWithSetCallback
(
global
:
user
:
id
:...,
3600
,
Object
(
Closure
),
Array
,
NULL
)
>
#
5
/
var
/
www
/
html
/
wiki1
/
includes
/
user
/
User
.
php
(
514
):
WANObjectCache
->
getWithSetCallback
(
global
:
user
:
id
:...,
3600
,
Object
(
Closure
),
Array
)
>
#
6
/
var
/
www
/
html
/
wiki1
/
includes
/
user
/
User
.
php
(
445
):
User
->
loadFromCache
()
>
#
7
/
var
/
www
/
html
/
wiki1
/
includes
/
user
/
User
.
php
(
409
):
User
->
loadFromId
(
0
)
>
#
8
/
var
/
www
/
html
/
wiki1
/
includes
/
session
/
UserInfo
.
php
in
/
var
/
www
/
html
/
wiki1
/
includes
/
user
/
User
.
php
on
line
1566
Apparently
the
global
value
`
$
wgContLang
`
is
somehow
`
null
`
.
WTF
?
-
However
,
if
I
comment
out
the
`
wiki2
`
entry
in
`
foreignRepositories
`
,
it
works
again
.
I
don
’
t
understand
why
,
but
I
don
’
t
need
that
part
anyways
,
so
whatever
.
-
I
try
to
add
remote
statements
and
get
a
different
error
than
before
:
>
Could
not
save
due
to
an
error
.
>
⧼
wikibase
-
validator
-
unsupported
-
entity
-
type
⧽
I
guess
wiki1
’
s
Wikibase
is
confused
by
the
`
item3
`
type
.
But
if
I
add
it
to
`
wiki1
`’
s
`
entityNamespaces
`
,
I
get
the
same
“
using
the
same
entity
types
on
multiple
repositories
”
error
as
before
with
`
wiki2
`
.
Not
sure
what
to
do
now
…
-
Apparently
entity
types
aren
’
t
as
free
-
form
as
I
thought
.
The
`
ForeignEntityValidator
`
checks
the
`
$
id
->
getEntityType
()
`
against
the
supported
entity
types
,
and
an
`
ItemId
`’
s
entity
type
is
hard
-
coded
to
be
`'
item
'`
.
-
Let
’
s
try
a
new
version
.
The
local
repository
has
no
entities
of
its
own
at
all
,
only
federated
ones
.
-
I
set
up
`
wiki4
`
(
local
)
and
`
wiki5
`
(
remote
)
as
before
:
Copy
the
folder
in
`
/
var
/
www
/
html
`
,
remove
`
LocalSettings
.
php
`
,
run
setup
,
copy
over
bits
of
`
LocalSettings
.
php
`
.
-
I
configure
the
local
wiki
:
$
wgWBRepoSettings
[
'
entityNamespaces
'
]
=
[];
$
wgWBClientSettings
[
'
foreignRepositories
'
]
=
array
(
'
wiki5
'
=>
array
(
'
supportedEntityTypes
'
=>
array
(
'
item
'
,
'
property
'
),
'
repoDatabase
'
=>
'
wiki5
'
,
'
baseUri
'
=>
'
http
:
//localhost/wiki5/',
'
prefixMapping
'
=>
array
()
)
);
-
I
configure
the
database
for
wiki4
/
wiki5
:
INSERT
INTO
wiki4
.
interwiki
(
iw_prefix
,
iw_url
,
iw_api
,
iw_wikiid
,
iw_local
,
iw_trans
)
VALUES
(
'
wiki5
'
,
'
http
:
//localhost/wiki5/$1', '', '', 1, 0);
GRANT
ALL
ON
wiki5
.*
TO
wiki4
;
-
I
try
to
run
the
installation
scripts
for
wiki4
and
wiki5
,
but
the
very
first
script
for
wiki4
already
complains
that
`
entityNamespaces
`
is
invalid
.
I
change
it
to
:
$
wgWBRepoSettings
[
'
entityNamespaces
'
]
=
[
'
dummy
'
=>
0
];
The
scripts
print
warnings
for
the
“
dummy
”
entry
,
but
seem
to
succeed
.
-
I
create
the
sample
property
and
item
in
wiki5
.
-
I
realize
that
I
have
a
problem
–
where
am
I
going
to
add
statements
in
wiki4
that
refer
to
wiki5
entities
?
wiki4
has
no
entities
…
-
I
try
to
create
an
item
on
wiki4
,
but
get
an
error
that
>
"Wikibase item"
content
is
not
allowed
on
page
Q2
-
I
decide
to
allow
local
items
after
all
,
and
only
use
remote
properties
.
This
doesn
’
t
make
any
sense
with
regards
to
the
Commons
usecase
,
but
I
just
want
to
save
a
federated
statement
and
see
that
work
.
-
I
change
the
wiki4
config
again
to
re
-
allow
items
:
$
wgWBRepoSettings
[
'
entityNamespaces
'
]
=
[
'
item
'
=>
WB_NS_ITEM
];
$
wgWBClientSettings
[
'
foreignRepositories
'
]
=
array
(
'
wiki5
'
=>
array
(
'
supportedEntityTypes
'
=>
array
(
'
property
'
),
'
repoDatabase
'
=>
'
wiki5
'
,
'
baseUri
'
=>
'
http
:
//localhost/wiki5/',
'
prefixMapping
'
=>
array
()
)
);
-
I
create
a
local
item
on
wiki4
.
-
I
add
a
statement
with
the
remote
property
and
the
local
item
.
IT
WORKS
!
🎆
-
Lydia
explains
to
me
how
it
works
on
Commons
:
The
WikibaseMediaInfo
extension
adds
a
new
entity
type
,
MediaInfo
.
Commons
will
have
local
MediaInfo
entities
and
remote
property
and
item
entities
.
Let
’
s
try
that
out
as
well
,
we
don
’
t
have
enough
wikis
yet
.
-
I
set
up
wiki6
(
local
)
as
before
(
we
’
ll
reuse
wiki5
as
the
remote
wiki
).
Copy
,
remove
settings
,
setup
,
copy
settings
.
I
skip
the
entity
namespaces
and
foreign
repositories
settings
for
now
.
-
I
clone
<
gerrit
:
mediawiki
/
extensions
/
WikibaseMediaInfo
.
git
>
into
the
extensions
/
folder
and
run
`
composer
install
`
in
it
.
-
I
add
the
following
configuration
:
wfLoadExtension
(
'
WikibaseMediaInfo
'
);
$
baseNs
=
124
;
define
(
'
WB_NS_MEDIA
'
,
$
baseNs
+
0
);
define
(
'
WB_NS_MEDIA_TALK
'
,
$
baseNs
+
1
);
$
wgExtraNamespaces
[
WB_NS_MEDIA
]
=
'
Media
'
;
$
wgExtraNamespaces
[
WB_NS_MEDIA_TALK
]
=
'
Media_talk
'
;
$
wgWBRepoSettings
[
'
entityNamespaces
'
]
=
[
'
mediainfo
'
=>
WB_NS_MEDIA
];
$
wgWBClientSettings
[
'
foreignRepositories
'
]
=
array
(
'
wiki5
'
=>
array
(
'
supportedEntityTypes
'
=>
array
(
'
item
'
,
'
property
'
),
'
repoDatabase
'
=>
'
wiki5
'
,
'
baseUri
'
=>
'
http
:
//localhost/wiki5/',
'
prefixMapping
'
=>
array
()
)
);
-
I
configure
the
database
:
INSERT
INTO
wiki6
.
interwiki
(
iw_prefix
,
iw_url
,
iw_api
,
iw_wikiid
,
iw_local
,
iw_trans
)
VALUES
(
'
wiki5
'
,
'
http
:
//localhost/wiki5/$1', '', '', 1, 0);
GRANT
ALL
ON
wiki5
.*
TO
wiki6
;
-
I
run
the
installation
scripts
.
-
I
enable
uploads
in
wiki6
and
make
its
`
images
/
`
folder
writable
to
the
`
www
-
data
`
group
.
-
I
upload
a
file
and
follow
the
MediaInfo
link
.
-
I
add
a
statement
with
the
remote
property
and
the
remote
item
.
IT
WORKS
!
🎆
-
The
sitelinks
don
’
t
work
,
by
the
way
–
they
’
re
missing
the
index
.
php
bit
(
I
don
’
t
have
Apache
set
up
to
rewrite
that
automatically
).
To
fix
this
,
I
update
the
interwiki
table
:
UPDATE
wiki6
.
interwiki
SET
iw_url
=
'
http
:
//localhost/wiki5/index.php/$1' WHERE iw_prefix = 'wiki5';
And
then
I
run
the
update
scripts
.
(
I
’
m
not
sure
which
ones
are
necessary
–
apparently
both
update
.
php
and
populateInterwiki
.
php
?)
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4567744
Default Alt Text
federation.md (10 KB)
Attached To
Mode
T159240: Document how to set up federated Wikibase instances
Attached
Detach File
Event Timeline
Log In to Comment