blob: 3a3670d8e19c7e85db32af8ea1717ff038d7eb4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
<?php
namespace SMW\MediaWiki\Hooks;
use SMW\DIProperty;
use Title;
/**
* @see https://www.mediawiki.org/wiki/Manual:Hooks/TitleIsMovable
*
* @license GNU GPL v2+
* @since 2.1
*
* @author mwjames
*/
class TitleIsMovable extends HookHandler {
/**
* @var Title
*/
private $title;
/**
* @since 2.1
*
* @param Title $title
*/
public function __construct( Title $title ) {
$this->title = $title;
}
/**
* @since 2.1
*
* @param boolean &$isMovable
*
* @return boolean
*/
public function process( &$isMovable ) {
// We don't allow rule pages to be moved as we cannot track JSON content
// as redirects and therefore invalidate any rule assignment without a
// possibility to automatically reassign IDs
if ( $this->title->getNamespace() === SMW_NS_SCHEMA ) {
$isMovable = false;
}
if ( $this->title->getNamespace() !== SMW_NS_PROPERTY ) {
return true;
}
// Predefined properties cannot be moved!
if ( !DIProperty::newFromUserLabel( $this->title->getText() )->isUserDefined() ) {
$isMovable = false;
}
return true;
}
}
|