Fix PHP namespace errors.

This commit is contained in:
Daniel Kraus
2016-11-09 22:45:44 +01:00
parent feda14e833
commit c67a428dde
2 changed files with 11 additions and 13 deletions

View File

@ -101,11 +101,11 @@ class Cli extends \Maintenance {
if ($this->hasOption('log')) if ($this->hasOption('log'))
{ {
LinkTitles::$ltConsoleOutput = true; Extension::$ltConsoleOutput = true;
} }
if ($this->hasOption('debug')) if ($this->hasOption('debug'))
{ {
LinkTitles::$ltConsoleOutputDebug = true; Extension::$ltConsoleOutputDebug = true;
} }
$pagename = strval($this->getOption('page')); $pagename = strval($this->getOption('page'));

View File

@ -181,9 +181,7 @@ class Extension {
// Iterate through the page titles // Iterate through the page titles
foreach( $res as $row ) { foreach( $res as $row ) {
self::newTarget( $row->page_title ); self::newTarget( $row->page_namespace, $row->page_title );
LinkTitles::newTarget( $row->page_namespace, $row->page_title );
// split the page content by [[...]] groups // split the page content by [[...]] groups
// credits to inhan @ StackOverflow for suggesting preg_split // credits to inhan @ StackOverflow for suggesting preg_split
@ -195,8 +193,8 @@ class Extension {
self::$targetTitleText = self::$targetTitle->getText(); self::$targetTitleText = self::$targetTitle->getText();
$quotedTitle = preg_quote(self::$targetTitleText, '/'); $quotedTitle = preg_quote(self::$targetTitleText, '/');
LinkTitles::ltDebugLog('TargetTitle='. LinkTitles::$targetTitleText,"private"); self::ltDebugLog('TargetTitle='. self::$targetTitleText,"private");
LinkTitles::ltDebugLog('TargetTitleQuoted='. $quotedTitle,"private"); self::ltDebugLog('TargetTitleQuoted='. $quotedTitle,"private");
// Depending on the global configuration setting $wgCapitalLinks, // Depending on the global configuration setting $wgCapitalLinks,
// the title has to be searched for either in a strictly case-sensitive // the title has to be searched for either in a strictly case-sensitive
@ -253,7 +251,7 @@ class Extension {
/// @returns undefined /// @returns undefined
public static function processPage( $title, \RequestContext $context ) { public static function processPage( $title, \RequestContext $context ) {
$titleObj = \Title::makeTitle(0, $title); $titleObj = \Title::makeTitle(0, $title);
LinkTitles::ltLog('Processing '. $titleObj->getPrefixedText()); self::ltLog('Processing '. $titleObj->getPrefixedText());
$page = \WikiPage::factory($titleObj); $page = \WikiPage::factory($titleObj);
$content = $page->getContent(); $content = $page->getContent();
$text = $content->getContentHandler()->serializeContent($content); $text = $content->getContentHandler()->serializeContent($content);
@ -307,7 +305,7 @@ class Extension {
// we need to ignore the first letter of the page titles, as // we need to ignore the first letter of the page titles, as
// it does not matter for linking. // it does not matter for linking.
if ( self::checkTargetPage() ) { if ( self::checkTargetPage() ) {
LinkTitles::ltLog( "Linking (smart) '$matches[0]' to '" . LinkTitles::$targetTitle . "'" ); self::ltLog( "Linking (smart) '$matches[0]' to '" . self::$targetTitle . "'" );
if ( strcmp(substr(self::$targetTitleText, 1), substr($matches[0], 1)) == 0 ) { if ( strcmp(substr(self::$targetTitleText, 1), substr($matches[0], 1)) == 0 ) {
// Case-sensitive match: no need to bulid piped link. // Case-sensitive match: no need to bulid piped link.
return '[[' . $matches[0] . ']]'; return '[[' . $matches[0] . ']]';
@ -324,7 +322,7 @@ class Extension {
// If $wgCapitalLinks is false, we can use the simple variant // If $wgCapitalLinks is false, we can use the simple variant
// of the callback function. // of the callback function.
if ( self::checkTargetPage() ) { if ( self::checkTargetPage() ) {
LinkTitles::ltLog( "Linking (smart) '$matches[0]' to '" . LinkTitles::$targetTitle . "'" ); self::ltLog( "Linking (smart) '$matches[0]' to '" . self::$targetTitle . "'" );
if ( strcmp(self::$targetTitleText, $matches[0]) == 0 ) { if ( strcmp(self::$targetTitleText, $matches[0]) == 0 ) {
// Case-sensitive match: no need to bulid piped link. // Case-sensitive match: no need to bulid piped link.
return '[[' . $matches[0] . ']]'; return '[[' . $matches[0] . ']]';
@ -455,7 +453,7 @@ private static function BuildDelimiters() {
/// Local Debugging output function which can send output to console as well /// Local Debugging output function which can send output to console as well
public static function ltDebugLog($text) { public static function ltDebugLog($text) {
if (LinkTitles::$ltConsoleOutputDebug) if (self::$ltConsoleOutputDebug)
{ {
print $text . "\n"; print $text . "\n";
} }
@ -464,7 +462,7 @@ private static function BuildDelimiters() {
/// Local Logging output function which can send output to console as well /// Local Logging output function which can send output to console as well
public static function ltLog($text) { public static function ltLog($text) {
if (LinkTitles::$ltConsoleOutput) if (self::$ltConsoleOutput)
{ {
print $text . "\n"; print $text . "\n";
} }