User:Leucosticte/Junkyard

function fetch_all( $resulttype = MYSQLI_NUM ) { if ( method_exists( 'mysqli_result', 'fetch_all' ) ) { # Compatibility layer with PHP < 5.3 $res = parent::fetch_all( $resulttype ); } else { for ( $res = array; $tmp = $this->fetch_array( $resulttype ); ) { $res[] = $tmp; }     return $res; }

$ret = $wiki->query ( '?action=createaccount&format=php'     . '&rcid=' . $row['mbrcq_rc_id']      . '&logid=' . $row['mbrcq_rc_logid']      . '&pageid=' . $row['mbrcq_rc_cur_id']      . '&pagenamespace=' . $row['mbrcq_rc_namespace']      . '&pagetitle=' . $row['mbrcq_rc_title']      . '&type=' . $row['mbrcq_rc_logtype']      . '&logaction=' . $row['mbrcq_rc_log_action']      . '&user=' . $row['mbrcq_rc_user_text']      . '&userid=' . $row['mbrcq_rc_user']      . '&timestamp=' . $row['mbrcq_rc_timestamp']      . '&comment=' . $row['mbrcq_rc_comment']      . '&tags=' . $row['mbrcq_tags']      . '&token=' . $token     , true ); // Post

$wgAutoloadClasses['MirrorEditPage'] = $dir. 'MirrorTools.classes.php';

$r['username'] = $params['user'];

public function getResultProperties { return array(			'createaccount' => array( 'result' => array(					ApiBase::PROP_TYPE => array( 'success', 'warning', 'needtoken' )				),				'username' => array(					ApiBase::PROP_TYPE => 'string',					ApiBase::PROP_NULLABLE => true				), 'userid' => array(					ApiBase::PROP_TYPE => 'int',					ApiBase::PROP_NULLABLE => true				), 'token' => array(					ApiBase::PROP_TYPE => 'string',					ApiBase::PROP_NULLABLE => true				), )		);	} die ( "Allowable options: rc, rev, us\n" );

$pageTitlesFile = 'PageTitlesFile.txt'; if ( !file_exists ( $pageTitlesFile) ) { $pageTitles = fopen ( $pageTitlesFile, 'w' ); } else { if ( $overwrite ) { echo "$pageTitlesFile exists; overwriting.\n"; } else { die ( "$pageTitlesFile exists; aborting.\n" ); } } $pageTitles = fopen ( $pageTitlesFile, 'w' );

// If it's in the interwiki table but not on the new list, or on the // blacklist, maybe time to remove it from the interwiki table? if ( !isset ( $apiPulls[$row->iw_prefix] )                               || isset ( $blacklist[$row->iw_prefix] ) ) { // But if it's on the whitelist, don't remove if ( !isset ( $whitelist[$row->iw_prefix] ) ) { $remove[] = $row->iw_prefix; }                       // If it's on the new list but not in the interwiki table, and not in the // blacklist, maybe time to add it to the interwiki table? } elseif // See if this whitelist entry has a specific url; if so, leave it                       // alone if ( !$whitelist[$row->iw_prefix] ) { // No specific url on the whitelist, so see if the url // needs to be modified if ( $apiPulls[$row->iw_prefix] != $row->iw_url ) { $modify = }                       }                        } -- WikiIndex page title, used because it's sure to be unique iwm_iw_wikiindex_page_title varchar(255) binary,

if ( $rowFields ) { $firstOne = true; $queryFields = '(';       $queryValues = '('; foreach ( $rowFields as $field => $value ) { if ( !$firstOne ) { $queryFields .= ', '; $queryValues .= ', '; }           $firstOne = false; $queryFields .= $field; $queryValues .= $value; }       $queryFields .= ')';        $queryValues .= ')'; $query = "INSERT INTO parsed_mirrored_wikiindex $queryFields VALUES $queryValues";

It's been suggested at https://meta.wikimedia.org/wiki/Forum#Interwiki_list that the 93-item interwiki.list be updated to include the 700+ items in meta's interwiki map ( https://meta.wikimedia.org/wiki/Interwiki_map ), or to be more exact, the siprop=interwikimap list that results from a script periodically pushing that map into the database: https://meta.wikimedia.org/w/api.php?action=query&meta=siteinfo&siprop=interwikimap. This seems like a good idea, since the choice of some of those 93 appears a bit arbitrary.