blob: d304b85720b9a25ef4634b0ab19a4974082088e7 (
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
|
<?php
/**
* Contains class with job for updating translation memory.
*
* @file
* @author Niklas Laxström
* @copyright Copyright © 2012-2013, Niklas Laxström
* @license GPL-2.0+
*/
/**
* Job for updating translation memory.
*
* @ingroup JobQueue
*/
class TTMServerMessageUpdateJob extends Job {
/**
* @param MessageHandle $handle
* @return TTMServerMessageUpdateJob
*/
public static function newJob( MessageHandle $handle ) {
$job = new self( $handle->getTitle() );
return $job;
}
function __construct( $title, $params = array(), $id = 0 ) {
parent::__construct( __CLASS__, $title, $params, $id );
}
/**
* Fetch all the translations and update them.
*/
function run() {
$handle = new MessageHandle( $this->title );
$translations = ApiQueryMessageTranslations::getTranslations( $handle );
foreach ( $translations as $page => $data ) {
$tTitle = Title::makeTitle( $this->title->getNamespace(), $page );
$tHandle = new MessageHandle( $tTitle );
TTMServer::onChange( $tHandle, $data[0], $tHandle->isFuzzy() );
}
return true;
}
}
|