Index: trunk/extensions/Translate/tag/SpecialPageTranslationDeletePage.php |
— | — | @@ -260,16 +260,16 @@ |
261 | 261 | protected function performAction() { |
262 | 262 | $jobs = array(); |
263 | 263 | $target = $this->title; |
| 264 | + $base = $this->title->getPrefixedText(); |
264 | 265 | |
265 | 266 | $translationPages = $this->getTranslationPages(); |
266 | 267 | foreach ( $translationPages as $old ) { |
267 | | - $jobs[$old->getPrefixedText()] = DeleteJob::newJob( $old, !$this->singleLanguage(), $this->user ); |
| 268 | + $jobs[$old->getPrefixedText()] = DeleteJob::newJob( $old, $base, !$this->singleLanguage(), $this->user ); |
268 | 269 | } |
269 | 270 | |
270 | 271 | $sectionPages = $this->getSectionPages(); |
271 | 272 | foreach ( $sectionPages as $old ) { |
272 | | - $to = $this->newPageTitle( $base, $old, $target ); |
273 | | - $jobs[$old->getPrefixedText()] = DeleteJob::newJob( $old, !$this->singleLanguage(), $this->user ); |
| 273 | + $jobs[$old->getPrefixedText()] = DeleteJob::newJob( $old, $base, !$this->singleLanguage(), $this->user ); |
274 | 274 | } |
275 | 275 | |
276 | 276 | if ( !$this->doSubpages ) { |
— | — | @@ -279,15 +279,14 @@ |
280 | 280 | continue; |
281 | 281 | } |
282 | 282 | |
283 | | - $to = $this->newPageTitle( $base, $old, $target ); |
284 | | - $jobs[$old->getPrefixedText()] = DeleteJob::newJob( $old, !$this->singleLanguage(), $this->user ); |
| 283 | + $jobs[$old->getPrefixedText()] = DeleteJob::newJob( $old, $base, !$this->singleLanguage(), $this->user ); |
285 | 284 | } |
286 | 285 | } |
287 | 286 | |
288 | 287 | Job::batchInsert( $jobs ); |
289 | 288 | |
290 | | - global $wgMemc; |
291 | | - $wgMemc->set( wfMemcKey( 'pt-base', $base ), array_keys( $jobs ), 60 * 60 * 6 ); |
| 289 | + $cache = wfGetCache( CACHE_DB ); |
| 290 | + $cache->set( wfMemcKey( 'pt-base', $target->getPrefixedText() ), array_keys( $jobs ), 60 * 60 * 6 ); |
292 | 291 | |
293 | 292 | |
294 | 293 | if ( !$this->singleLanguage() ) { |
— | — | @@ -296,7 +295,7 @@ |
297 | 296 | |
298 | 297 | MessageGroups::clearCache(); |
299 | 298 | // TODO: defer or make faster |
300 | | - MessageIndexRebuilder::execute(); |
| 299 | + //MessageIndexRebuilder::execute(); |
301 | 300 | |
302 | 301 | global $wgOut; |
303 | 302 | $wgOut->addWikiMsg( 'pt-deletepage-started' ); |
Index: trunk/extensions/Translate/tag/DeleteJob.php |
— | — | @@ -15,16 +15,16 @@ |
16 | 16 | * @todo Get rid of direct reference to $wgMemc. |
17 | 17 | */ |
18 | 18 | class DeleteJob extends Job { |
19 | | - public static function newJob( Title $target, $full, /*User*/ $performer ) { |
| 19 | + public static function newJob( Title $target, $base, $full, /*User*/ $performer ) { |
20 | 20 | global $wgTranslateFuzzyBotName; |
21 | 21 | |
22 | 22 | $job = new self( $target ); |
23 | 23 | $job->setUser( $wgTranslateFuzzyBotName ); |
24 | 24 | $job->setFull( $full ); |
| 25 | + $job->setBase( $base ); |
25 | 26 | $msg = $job->getFull() ? 'pt-deletepage-full-logreason' : 'pt-deletepage-lang-logreason'; |
26 | | - $job->setSummary( wfMsgForContent( 'pt-deletepage-logreason', $target->getPrefixedText() ) ); |
| 27 | + $job->setSummary( wfMsgForContent( $msg, $target->getPrefixedText() ) ); |
27 | 28 | $job->setPerformer( $performer ); |
28 | | - $job->lock(); |
29 | 29 | return $job; |
30 | 30 | } |
31 | 31 | |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | // Other stuff |
42 | 42 | $user = $this->getUser(); |
43 | 43 | $summary = $this->getSummary(); |
44 | | - $target = $this->getTarget(); |
| 44 | + $base = $this->getBase(); |
45 | 45 | |
46 | 46 | PageTranslationHooks::$allowTargetEdit = true; |
47 | 47 | $oldUser = $wgUser; |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | $logger = new LogPage( 'pagetranslation' ); |
55 | 55 | $params = array( |
56 | 56 | 'user' => $this->getPerformer(), |
57 | | - 'target' => $target->getPrefixedText(), |
| 57 | + 'target' => $title->getPrefixedText(), |
58 | 58 | 'error' => base64_encode( serialize( $ok ) ), // This is getting ridiculous |
59 | 59 | ); |
60 | 60 | $doer = User::newFromName( $this->getPerformer() ); |
— | — | @@ -63,24 +63,23 @@ |
64 | 64 | |
65 | 65 | PageTranslationHooks::$allowTargetEdit = false; |
66 | 66 | |
67 | | - global $wgMemc; |
68 | | - $pages = (array) $wgMemc->get( wfMemcKey( 'pt-base', $title->getPrefixedText() ) ); |
69 | | - $last = true; |
70 | | - |
71 | | - foreach ( $pages as $page ) { |
72 | | - if ( $wgMemc->get( wfMemcKey( 'pt-lock', $page ) ) === true ) { |
73 | | - $last = false; |
74 | | - break; |
75 | | - } |
76 | | - } |
77 | | - |
78 | | - if ( $last ) { |
79 | | - $wgMemc->delete( wfMemcKey( 'pt-base', $title->getPrefixedText() ) ); |
| 67 | + $cache = wfGetCache( CACHE_DB ); |
| 68 | + $pages = (array) $cache->get( wfMemcKey( 'pt-base', $base ) ); |
| 69 | + $lastitem = array_pop( $pages ); |
| 70 | + if ( $title->getPrefixedText() === $lastitem ) { |
| 71 | + $cache->delete( wfMemcKey( 'pt-base', $base ) ); |
80 | 72 | $logger = new LogPage( 'pagetranslation' ); |
81 | 73 | $params = array( 'user' => $this->getPerformer() ); |
82 | 74 | $doer = User::newFromName( $this->getPerformer() ); |
83 | 75 | $msg = $this->getFull() ? 'deletefok' : 'deletelok'; |
84 | | - $logger->addEntry( $msg, $title, null, array( serialize( $params ) ), $doer ); |
| 76 | + $logger->addEntry( $msg, Title::newFromText( $base ), null, array( serialize( $params ) ), $doer ); |
| 77 | + |
| 78 | + $tpage = TranslatablePage::newFromTitle( $title ); |
| 79 | + $tpage->getTranslationPercentages( true ); |
| 80 | + foreach ( $tpage->getTranslationPages() as $page ) { |
| 81 | + $page->invalidateCache(); |
| 82 | + } |
| 83 | + $title->invalidateCache(); |
85 | 84 | } |
86 | 85 | |
87 | 86 | $wgUser = $oldUser; |
— | — | @@ -124,6 +123,14 @@ |
125 | 124 | } |
126 | 125 | } |
127 | 126 | |
| 127 | + public function setBase( $base ) { |
| 128 | + $this->params['base'] = $base; |
| 129 | + } |
| 130 | + |
| 131 | + public function getBase() { |
| 132 | + return $this->params['base']; |
| 133 | + } |
| 134 | + |
128 | 135 | /** |
129 | 136 | * Get a user object for doing edits. |
130 | 137 | */ |
Index: trunk/extensions/Translate/tag/PageTranslationHooks.php |
— | — | @@ -556,9 +556,9 @@ |
557 | 557 | return wfMsgExt( 'pt-log-delete-full-nok', $opts, $title->getPrefixedText(), $user, $_['target'] ); |
558 | 558 | } elseif ( $action === 'deletelnok' ) { |
559 | 559 | return wfMsgExt( 'pt-log-delete-lang-nok', $opts, $title->getPrefixedText(), $user, $_['target'] ); |
| 560 | + } elseif ( $action === 'deletefok' ) { |
| 561 | + return wfMsgExt( 'pt-log-delete-full-ok', $opts, $title->getPrefixedText(), $user ); |
560 | 562 | } elseif ( $action === 'deletelok' ) { |
561 | | - return wfMsgExt( 'pt-log-delete-full-ok', $opts, $title->getPrefixedText(), $user ); |
562 | | - } elseif ( $action === 'deletefok' ) { |
563 | 563 | return wfMsgExt( 'pt-log-delete-lang-ok', $opts, $title->getPrefixedText(), $user ); |
564 | 564 | } |
565 | 565 | } |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -553,10 +553,16 @@ |
554 | 554 | $wgLogActionsHandlers['pagetranslation/unmark'] = 'PageTranslationHooks::formatLogEntry'; |
555 | 555 | $wgLogActionsHandlers['pagetranslation/moveok'] = 'PageTranslationHooks::formatLogEntry'; |
556 | 556 | $wgLogActionsHandlers['pagetranslation/movenok'] = 'PageTranslationHooks::formatLogEntry'; |
| 557 | + $wgLogActionsHandlers['pagetranslation/deletelok'] = 'PageTranslationHooks::formatLogEntry'; |
| 558 | + $wgLogActionsHandlers['pagetranslation/deletefok'] = 'PageTranslationHooks::formatLogEntry'; |
| 559 | + $wgLogActionsHandlers['pagetranslation/deletelnok'] = 'PageTranslationHooks::formatLogEntry'; |
| 560 | + $wgLogActionsHandlers['pagetranslation/deletefnok'] = 'PageTranslationHooks::formatLogEntry'; |
557 | 561 | |
| 562 | + |
558 | 563 | global $wgJobClasses; |
559 | 564 | $wgJobClasses['RenderJob'] = 'RenderJob'; |
560 | 565 | $wgJobClasses['MoveJob'] = 'MoveJob'; |
| 566 | + $wgJobClasses['DeleteJob'] = 'DeleteJob'; |
561 | 567 | |
562 | 568 | // Namespaces |
563 | 569 | global $wgPageTranslationNamespace, $wgExtraNamespaces; |
Index: trunk/extensions/Translate/PageTranslation.i18n.php |
— | — | @@ -105,7 +105,7 @@ |
106 | 106 | 'pt-log-movenok' => '{{GENDER:$2|encountered}} a problem while moving [[:$1]] to [[:$3]]', |
107 | 107 | 'pt-log-delete-full-ok' => '{{GENDER:$2|completed}} deletion of translatable page $1', |
108 | 108 | 'pt-log-delete-full-nok' => '{{GENDER:$2|encountered}} a problem while deleting translatable page [[:$1]]', |
109 | | - 'pt-log-delete-lang-ok' => '{{GENDER:$2|completed}} deletion of translation page $e', |
| 109 | + 'pt-log-delete-lang-ok' => '{{GENDER:$2|completed}} deletion of translation page $1', |
110 | 110 | 'pt-log-delete-lang-nok' => '{{GENDER:$2|encountered}} a problem while deleting translation page [[:$1]]', |
111 | 111 | |
112 | 112 | |