[16:47:36] Dear comrades, I use some deprecated plugin for MediaWiki, and I would like to patch it to make more modern and secure. [16:48:03] This extension has two lines I have to fix: [16:48:07] 1) $ns_num = $wgTitle->getNamespace(); [16:48:12] 2) $title = $wgTitle->getDBkey(); [16:48:33] They are based on the outdated $wgTitle. How have I to change them to avoid $wgTitle? [16:48:41] Thank you very much. [16:49:45] PMZ: can you provide the full code for the extension? [16:49:56] you have to get a Title object from somewhere, and the context matters [16:50:38] It is long, and the link goes into web.archive.org . What can I do here? May I show the function? [16:50:43] public function getCurrentPage( &$ns, &$title ) [16:50:48] { [16:50:49] global $wgTitle; [16:50:53] $ns_num = $wgTitle->getNamespace(); [16:50:55] $ns = ( $ns_num == NS_MAIN ) ? '':MWNamespace::getCanonicalName( $ns_num ); [16:50:58] $title = $wgTitle->getDBkey(); [16:51:01] return (empty( $ns )) ? $title:$ns.':'.$title ; [16:51:02] } [16:51:17] --- That's the function with deprecated parameter. --- [16:55:08] There are 180 lines in php exension, and, pity to say, it is not available on web... [16:55:19] Just in web.archive.org. [16:56:32] PMZ: RequestContext::getMain()->getTitle() is marginally better than $wgTitle [16:56:55] Thank you! Will test now, and answer shortly. [16:56:56] there isn't any great replacement today [16:57:25] some day we'll have a service for fetching the current title, I imagine [16:58:16] (also, we are in the process of replacing Title with TitleValue/LinkTarget/PageIdentity + services, but that's also not yet at a stage where most extension code could be updated) [16:59:42] Works fine. Looks good. Will test a bit more :-). Many, many thanks for you. [17:02:32] Oh comrade, now it works well and much quicker. I may tell in details, if you want.