User:Leucosticte/Code graveyard

public static function wikipediaLink( $dummy, $target, &$html, &$customAttribs, &$query,		&$options, &$ret ) { global $wgLocalStyle, $wgRemoteStyle, $wgPureWikiDeletionInEffect , $wgTitle, $wgRequest, $wgInterwikiExistenceBrokenLinkStyle, $wgInterwikiExistenceExcludeNamespaced; $options[] = 'broken'; $customAttribs['class'] = 'new'; #$ret = Html::rawElement ( 'a', array ( 'href' => $target->getFullURL, 'class' => 'new' ),		#	$target->getPrefixedDBKey ); return true; if ( $wgTitle->getNamespace == -1 ) { return true; }

if ( isset( $query['action'] ) && $query['action'] == 'history' ) { return true; }

if ( $wgRequest->getText( 'action' ) == 'history' ) { return true; }

$itIsBlank = false;

// If it's an external link, see if it leads to Wikipedia, and // if so, whether that page exists on Wikipedia if ( $target->isExternal ) { $interwikiURL = wfMsgExt( 'rped-wikipedia-url','parsemag'); $dbr = wfGetDB( DB_SLAVE ); $title = $target->getDBkey ;

if ( strpos ( $title, ':' ) && $wgInterwikiExistenceExcludeNamespaced ) { return true; }

$interwikiPrefix = $target->getInterwiki ; $result = $dbr->selectRow(				'interwiki',				'iw_prefix',				array( "iw_url" => $interwikiURL , "iw_prefix" => $interwikiPrefix )			);

if ( !$result ) { return true; }

$result = $dbr->selectRow(				'iwe_page',				'iwe_page_id',				array( "iwe_page_title" => $title )			); if ( !$result ) { $query['action'] = "edit"; $customAttribs['style'] = $wgInterwikiExistenceBrokenLinkStyle; }			return true; }		// Return immediately if we know it's existent on the local wiki if ( in_array( 'known', $options ) ) { if ( !isset( $query['action'] ) && !isset( $query['curid'] ) ) { $customAttribs['style'] = $wgLocalStyle; }

if ( !isset( $wgPureWikiDeletionInEffect ) || $wgPureWikiDeletionInEffect != true ) { return true; }

$dbr = wfGetDB( DB_SLAVE );

/*$myRevision=Revision::loadFromTitle($dbr,$target); if ($myRevision->getRawText!=''){*/ $id = $target->getArticleID; $result = $dbr->selectRow(				'blanked_page',				'blank_page_id',				array( "blank_page_id" => $id )			); if ( !$result ) { return true; }

$itIsBlank = true; }

// If it doesn't exist on the local wiki, then see if it exists on the // remote wiki (Wikipedia) if ( in_array( 'broken', $options ) || $itIsBlank == true ) { $title = $target->getPrefixedText ; $fragment = htmlentities($target->getFragmentForURL);

for ( $thiscount = 0; $thiscount < strlen( $title ); $thiscount++ ) { if ( substr( $title, $thiscount, 1 ) == ' ' ) { $title = substr_replace( $title, '_', $thiscount, 1 ); }			}			$dbr = wfGetDB( DB_SLAVE ); $result = $dbr->selectRow(				'iwe_page',				'iwe_page_id',				array( "iwe_page_title" => $title )			); if ( !$result ) { return true; } else { $newTitle = $target->getPrefixedURL ; #$title = urlencode ( $title ); $url = wfMsgExt( 'rped-wikipedia-url','parsemag', $newTitle );

// The page that we'll link to $text = ''. $text. '';

if ( $wgRemoteStyle != '' ) { $customAttribs['style'] = $wgRemoteStyle; }			}		}		return true; }

// Get the deleted and restored articles $deleteUrl = $url. $wgInterwikiExistenceApiDeleteArgs; $deleteUrl = str_replace ( '$1', $result->up_value, $newUrl ); $deleteTitles = InterwikiExistence::InterwikiExistenceApiPull ( $url ); if ( $deleteTitles == INTERWIKIEXISTENCE_NORETRIEVE || $deleteTitles ==			INTERWIKIEXISTENCE_NODECODE ) { return true; }		$apiPull = $apiPull['query']['logevents'];

$result = $dbr->selectrow( 'iwe_page', array ( 'iwe_page_title', $field ), $cond ); $resultArray = array;

foreach ( $apiPull['query'][$submodule] as $apiPullElement ) { if ( !$firstElement ) { $cond .= " AND "; }			$cond .= "iwe_page_title='". $apiPullElement['title']. "'";		}

foreach ( $apiPull['query'][$submodule] as $apiPullElement ) {

$upsert[] = array (				'iwe_page_title' => $apiPullElement['title'],				$iwepField => $apiPullElement['timestamp']			); }		// Update iwe_page table $dbw->upsert ( 'iwe_page', $upsert, array ( 'iwe_page_title' ), $upsert );