r24450 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24449‎ | r24450 | r24451 >
Date:04:28, 30 July 2007
Author:erik
Status:old
Tags:
Comment:
Hack for generating page titles
Modified paths:
  • /trunk/extensions/Wikidata/Database+scripts/Convenience/Generate+page+titles+for+set.php (added) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/Database scripts/Convenience/Generate page titles for set.php
@@ -0,0 +1,43 @@
 2+<?php
 3+// ini_set('mysql.default_socket','/var/run/mysqld/mysqld.sock');
 4+ define('MEDIAWIKI',true);
 5+ require_once('../../../../LocalSettings.php');
 6+ require_once('ProfilerStub.php');
 7+ require_once('Setup.php');
 8+ # Which dataset to generate page titles for
 9+ $dc='sp';
 10+ ob_end_flush();
 11+
 12+ global $wgCommandLineMode;
 13+ $wgCommandLineMode = true;
 14+
 15+ $dbr =& wfGetDB(DB_MASTER);
 16+ echo("Inserting page titles for expressions ...\n");
 17+ $sql = 'select spelling from '.$dc.'_expression_ns';
 18+ $res=$dbr->query($sql);
 19+ while ($row = $dbr->fetchObject($res)) {
 20+ $page=$row->spelling;
 21+ $page=trim($page);
 22+ $page=str_replace(" ","_",$page);
 23+ $isql='insert ignore into page(page_title,page_namespace) values("'.addslashes($page).'",16);';
 24+ $res2=$dbr->query($isql);
 25+
 26+ }
 27+ $dbr->freeResult($res);
 28+
 29+ echo("Inserting page titles for DefinedMeanings ...\n");
 30+ $sql = "select spelling,defined_meaning_id from {$dc}_defined_meaning, {$dc}_expression_ns where {$dc}_defined_meaning.expression_id={$dc}_expression_ns.expression_id";
 31+ $res=$dbr->query($sql);
 32+ while ($row = $dbr->fetchObject($res)) {
 33+ $page=$row->spelling;
 34+ $page=trim($page);
 35+ $page=str_replace(" ","_",$page);
 36+ $page.="_(".$row->defined_meaning_id.")";
 37+ $isql='insert ignore into page(page_title,page_namespace) values("'.addslashes($page).'",24);';
 38+ $res2=$dbr->query($isql);
 39+
 40+ }
 41+ $dbr->freeResult($res);
 42+
 43+
 44+?>
\ No newline at end of file
Property changes on: trunk/extensions/Wikidata/Database scripts/Convenience/Generate page titles for set.php
___________________________________________________________________
Added: svn:eol-style
145 + native

Status & tagging log