* Unmaintained Oracle support files have been removed.
This commit is contained in:
parent
6f93347ccd
commit
ccf91e827a
8 changed files with 2 additions and 1223 deletions
|
|
@ -62,6 +62,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
|
|||
* Add 'purge' privilege to replace the hardcoded check for login state in
|
||||
determining whether action=purge can be done via GET. Switching the
|
||||
permission on for anons can be helpful for benchmarking.
|
||||
* Unmaintained Oracle support files have been removed.
|
||||
|
||||
|
||||
== Languages updated ==
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ function __autoload($className) {
|
|||
'Database' => 'includes/Database.php',
|
||||
'DatabaseMysql' => 'includes/Database.php',
|
||||
'ResultWrapper' => 'includes/Database.php',
|
||||
'OracleBlob' => 'includes/DatabaseOracle.php',
|
||||
'DatabaseOracle' => 'includes/DatabaseOracle.php',
|
||||
'DatabasePostgres' => 'includes/DatabasePostgres.php',
|
||||
'DateFormatter' => 'includes/DateFormatter.php',
|
||||
'DifferenceEngine' => 'includes/DifferenceEngine.php',
|
||||
|
|
|
|||
|
|
@ -1,691 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Oracle.
|
||||
*
|
||||
* @package MediaWiki
|
||||
*/
|
||||
|
||||
class OracleBlob extends DBObject {
|
||||
function isLOB() {
|
||||
return true;
|
||||
}
|
||||
function data() {
|
||||
return $this->mData;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @package MediaWiki
|
||||
*/
|
||||
class DatabaseOracle extends Database {
|
||||
var $mInsertId = NULL;
|
||||
var $mLastResult = NULL;
|
||||
var $mFetchCache = array();
|
||||
var $mFetchID = array();
|
||||
var $mNcols = array();
|
||||
var $mFieldNames = array(), $mFieldTypes = array();
|
||||
var $mAffectedRows = array();
|
||||
var $mErr;
|
||||
|
||||
function DatabaseOracle($server = false, $user = false, $password = false, $dbName = false,
|
||||
$failFunction = false, $flags = 0, $tablePrefix = 'get from global' )
|
||||
{
|
||||
Database::Database( $server, $user, $password, $dbName, $failFunction, $flags, $tablePrefix );
|
||||
}
|
||||
|
||||
/* static */ function newFromParams( $server = false, $user = false, $password = false, $dbName = false,
|
||||
$failFunction = false, $flags = 0, $tablePrefix = 'get from global' )
|
||||
{
|
||||
return new DatabaseOracle( $server, $user, $password, $dbName, $failFunction, $flags, $tablePrefix );
|
||||
}
|
||||
|
||||
/**
|
||||
* Usually aborts on failure
|
||||
* If the failFunction is set to a non-zero integer, returns success
|
||||
*/
|
||||
function open( $server, $user, $password, $dbName ) {
|
||||
if ( !function_exists( 'oci_connect' ) ) {
|
||||
throw new DBConnectionError( $this, "Oracle functions missing, have you compiled PHP with the --with-oci8 option?\n" );
|
||||
}
|
||||
$this->close();
|
||||
$this->mServer = $server;
|
||||
$this->mUser = $user;
|
||||
$this->mPassword = $password;
|
||||
$this->mDBname = $dbName;
|
||||
|
||||
$this->mConn = oci_new_connect($user, $password, $dbName, "AL32UTF8");
|
||||
if ( $this->mConn === false ) {
|
||||
wfDebug( "DB connection error\n" );
|
||||
wfDebug( "Server: $server, Database: $dbName, User: $user, Password: "
|
||||
. substr( $password, 0, 3 ) . "...\n" );
|
||||
wfDebug( $this->lastError()."\n" );
|
||||
} else {
|
||||
$this->mOpened = true;
|
||||
}
|
||||
return $this->mConn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes a database connection, if it is open
|
||||
* Returns success, true if already closed
|
||||
*/
|
||||
function close() {
|
||||
$this->mOpened = false;
|
||||
if ($this->mConn) {
|
||||
return oci_close($this->mConn);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function parseStatement($sql) {
|
||||
$this->mErr = $this->mLastResult = false;
|
||||
if (($stmt = oci_parse($this->mConn, $sql)) === false) {
|
||||
$this->lastError();
|
||||
return $this->mLastResult = false;
|
||||
}
|
||||
$this->mAffectedRows[$stmt] = 0;
|
||||
return $this->mLastResult = $stmt;
|
||||
}
|
||||
|
||||
function doQuery($sql) {
|
||||
if (($stmt = $this->parseStatement($sql)) === false)
|
||||
return false;
|
||||
return $this->executeStatement($stmt);
|
||||
}
|
||||
|
||||
function executeStatement($stmt) {
|
||||
if (!oci_execute($stmt, OCI_DEFAULT)) {
|
||||
$this->lastError();
|
||||
oci_free_statement($stmt);
|
||||
return false;
|
||||
}
|
||||
$this->mAffectedRows[$stmt] = oci_num_rows($stmt);
|
||||
$this->mFetchCache[$stmt] = array();
|
||||
$this->mFetchID[$stmt] = 0;
|
||||
$this->mNcols[$stmt] = oci_num_fields($stmt);
|
||||
if ($this->mNcols[$stmt] == 0)
|
||||
return $this->mLastResult;
|
||||
for ($i = 1; $i <= $this->mNcols[$stmt]; $i++) {
|
||||
$this->mFieldNames[$stmt][$i] = oci_field_name($stmt, $i);
|
||||
$this->mFieldTypes[$stmt][$i] = oci_field_type($stmt, $i);
|
||||
}
|
||||
while (($o = oci_fetch_array($stmt)) !== false) {
|
||||
foreach ($o as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$o[$key] = $value->load();
|
||||
}
|
||||
}
|
||||
$this->mFetchCache[$stmt][] = $o;
|
||||
}
|
||||
return $this->mLastResult;
|
||||
}
|
||||
|
||||
function queryIgnore( $sql, $fname = '' ) {
|
||||
return $this->query( $sql, $fname, true );
|
||||
}
|
||||
|
||||
function freeResult( $res ) {
|
||||
if (!oci_free_statement($res)) {
|
||||
throw new DBUnexpectedError( $this, "Unable to free Oracle result\n" );
|
||||
}
|
||||
unset($this->mFetchID[$res]);
|
||||
unset($this->mFetchCache[$res]);
|
||||
unset($this->mNcols[$res]);
|
||||
unset($this->mFieldNames[$res]);
|
||||
unset($this->mFieldTypes[$res]);
|
||||
}
|
||||
|
||||
function fetchAssoc($res) {
|
||||
if ($this->mFetchID[$res] >= count($this->mFetchCache[$res]))
|
||||
return false;
|
||||
|
||||
for ($i = 1; $i <= $this->mNcols[$res]; $i++) {
|
||||
$name = $this->mFieldNames[$res][$i];
|
||||
if (isset($this->mFetchCache[$res][$this->mFetchID[$res]][$name]))
|
||||
$value = $this->mFetchCache[$res][$this->mFetchID[$res]][$name];
|
||||
else $value = NULL;
|
||||
$key = strtolower($name);
|
||||
wfdebug("'$key' => '$value'\n");
|
||||
$ret[$key] = $value;
|
||||
}
|
||||
$this->mFetchID[$res]++;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function fetchRow($res) {
|
||||
$r = $this->fetchAssoc($res);
|
||||
if (!$r)
|
||||
return false;
|
||||
$i = 0;
|
||||
$ret = array();
|
||||
foreach ($r as $value) {
|
||||
wfdebug("ret[$i]=[$value]\n");
|
||||
$ret[$i++] = $value;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function fetchObject($res) {
|
||||
$row = $this->fetchAssoc($res);
|
||||
if (!$row)
|
||||
return false;
|
||||
$ret = new stdClass;
|
||||
foreach ($row as $key => $value)
|
||||
$ret->$key = $value;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function numRows($res) {
|
||||
return count($this->mFetchCache[$res]);
|
||||
}
|
||||
function numFields( $res ) { return pg_num_fields( $res ); }
|
||||
function fieldName( $res, $n ) { return pg_field_name( $res, $n ); }
|
||||
|
||||
/**
|
||||
* This must be called after nextSequenceVal
|
||||
*/
|
||||
function insertId() {
|
||||
return $this->mInsertId;
|
||||
}
|
||||
|
||||
function dataSeek($res, $row) {
|
||||
$this->mFetchID[$res] = $row;
|
||||
}
|
||||
|
||||
function lastError() {
|
||||
if ($this->mErr === false) {
|
||||
if ($this->mLastResult !== false) {
|
||||
$what = $this->mLastResult;
|
||||
} else if ($this->mConn !== false) {
|
||||
$what = $this->mConn;
|
||||
} else {
|
||||
$what = false;
|
||||
}
|
||||
$err = ($what !== false) ? oci_error($what) : oci_error();
|
||||
if ($err === false) {
|
||||
$this->mErr = 'no error';
|
||||
} else {
|
||||
$this->mErr = $err['message'];
|
||||
}
|
||||
}
|
||||
return str_replace("\n", '<br />', $this->mErr);
|
||||
}
|
||||
function lastErrno() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function affectedRows() {
|
||||
return $this->mAffectedRows[$this->mLastResult];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information about an index
|
||||
* If errors are explicitly ignored, returns NULL on failure
|
||||
*/
|
||||
function indexInfo ($table, $index, $fname = 'Database::indexInfo' ) {
|
||||
$table = $this->tableName($table, true);
|
||||
if ($index == 'PRIMARY')
|
||||
$index = "${table}_pk";
|
||||
$sql = "SELECT uniqueness FROM all_indexes WHERE table_name='" .
|
||||
$table . "' AND index_name='" .
|
||||
$this->strencode(strtoupper($index)) . "'";
|
||||
$res = $this->query($sql, $fname);
|
||||
if (!$res)
|
||||
return NULL;
|
||||
if (($row = $this->fetchObject($res)) == NULL)
|
||||
return false;
|
||||
$this->freeResult($res);
|
||||
$row->Non_unique = !$row->uniqueness;
|
||||
return $row;
|
||||
|
||||
// BUG: !!!! This code needs to be synced up with database.php
|
||||
|
||||
}
|
||||
|
||||
function indexUnique ($table, $index, $fname = 'indexUnique') {
|
||||
if (!($i = $this->indexInfo($table, $index, $fname)))
|
||||
return $i;
|
||||
return $i->uniqueness == 'UNIQUE';
|
||||
}
|
||||
|
||||
function fieldInfo( $table, $field ) {
|
||||
$o = new stdClass;
|
||||
$o->multiple_key = true; /* XXX */
|
||||
return $o;
|
||||
}
|
||||
|
||||
function getColumnInformation($table, $field) {
|
||||
$table = $this->tableName($table, true);
|
||||
$field = strtoupper($field);
|
||||
|
||||
$res = $this->doQuery("SELECT * FROM all_tab_columns " .
|
||||
"WHERE table_name='".$table."' " .
|
||||
"AND column_name='".$field."'");
|
||||
if (!$res)
|
||||
return false;
|
||||
$o = $this->fetchObject($res);
|
||||
$this->freeResult($res);
|
||||
return $o;
|
||||
}
|
||||
|
||||
function fieldExists( $table, $field, $fname = 'Database::fieldExists' ) {
|
||||
$column = $this->getColumnInformation($table, $field);
|
||||
if (!$column)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function tableName($name, $forddl = false) {
|
||||
# First run any transformations from the parent object
|
||||
$name = parent::tableName( $name );
|
||||
|
||||
# Replace backticks into empty
|
||||
# Note: "foo" and foo are not the same in Oracle!
|
||||
$name = str_replace('`', '', $name);
|
||||
|
||||
# Now quote Oracle reserved keywords
|
||||
switch( $name ) {
|
||||
case 'user':
|
||||
case 'group':
|
||||
case 'validate':
|
||||
if ($forddl)
|
||||
return $name;
|
||||
else
|
||||
return '"' . $name . '"';
|
||||
|
||||
default:
|
||||
return strtoupper($name);
|
||||
}
|
||||
}
|
||||
|
||||
function strencode( $s ) {
|
||||
return str_replace("'", "''", $s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the next in a sequence, save the value for retrieval via insertId()
|
||||
*/
|
||||
function nextSequenceValue( $seqName ) {
|
||||
$r = $this->doQuery("SELECT $seqName.nextval AS val FROM dual");
|
||||
$o = $this->fetchObject($r);
|
||||
$this->freeResult($r);
|
||||
return $this->mInsertId = (int)$o->val;
|
||||
}
|
||||
|
||||
/**
|
||||
* USE INDEX clause
|
||||
* PostgreSQL doesn't have them and returns ""
|
||||
*/
|
||||
function useIndexClause( $index ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
# REPLACE query wrapper
|
||||
# PostgreSQL simulates this with a DELETE followed by INSERT
|
||||
# $row is the row to insert, an associative array
|
||||
# $uniqueIndexes is an array of indexes. Each element may be either a
|
||||
# field name or an array of field names
|
||||
#
|
||||
# It may be more efficient to leave off unique indexes which are unlikely to collide.
|
||||
# However if you do this, you run the risk of encountering errors which wouldn't have
|
||||
# occurred in MySQL
|
||||
function replace( $table, $uniqueIndexes, $rows, $fname = 'Database::replace' ) {
|
||||
$table = $this->tableName( $table );
|
||||
|
||||
if (count($rows)==0) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Single row case
|
||||
if ( !is_array( reset( $rows ) ) ) {
|
||||
$rows = array( $rows );
|
||||
}
|
||||
|
||||
foreach( $rows as $row ) {
|
||||
# Delete rows which collide
|
||||
if ( $uniqueIndexes ) {
|
||||
$sql = "DELETE FROM $table WHERE ";
|
||||
$first = true;
|
||||
foreach ( $uniqueIndexes as $index ) {
|
||||
if ( $first ) {
|
||||
$first = false;
|
||||
$sql .= "(";
|
||||
} else {
|
||||
$sql .= ') OR (';
|
||||
}
|
||||
if ( is_array( $index ) ) {
|
||||
$first2 = true;
|
||||
foreach ( $index as $col ) {
|
||||
if ( $first2 ) {
|
||||
$first2 = false;
|
||||
} else {
|
||||
$sql .= ' AND ';
|
||||
}
|
||||
$sql .= $col.'=' . $this->addQuotes( $row[$col] );
|
||||
}
|
||||
} else {
|
||||
$sql .= $index.'=' . $this->addQuotes( $row[$index] );
|
||||
}
|
||||
}
|
||||
$sql .= ')';
|
||||
$this->query( $sql, $fname );
|
||||
}
|
||||
|
||||
# Now insert the row
|
||||
$sql = "INSERT INTO $table (" . $this->makeList( array_keys( $row ), LIST_NAMES ) .') VALUES (' .
|
||||
$this->makeList( $row, LIST_COMMA ) . ')';
|
||||
$this->query( $sql, $fname );
|
||||
}
|
||||
}
|
||||
|
||||
# DELETE where the condition is a join
|
||||
function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = "Database::deleteJoin" ) {
|
||||
if ( !$conds ) {
|
||||
throw new DBUnexpectedError( $this, 'Database::deleteJoin() called with empty $conds' );
|
||||
}
|
||||
|
||||
$delTable = $this->tableName( $delTable );
|
||||
$joinTable = $this->tableName( $joinTable );
|
||||
$sql = "DELETE FROM $delTable WHERE $delVar IN (SELECT $joinVar FROM $joinTable ";
|
||||
if ( $conds != '*' ) {
|
||||
$sql .= 'WHERE ' . $this->makeList( $conds, LIST_AND );
|
||||
}
|
||||
$sql .= ')';
|
||||
|
||||
$this->query( $sql, $fname );
|
||||
}
|
||||
|
||||
# Returns the size of a text field, or -1 for "unlimited"
|
||||
function textFieldSize( $table, $field ) {
|
||||
$table = $this->tableName( $table );
|
||||
$sql = "SELECT t.typname as ftype,a.atttypmod as size
|
||||
FROM pg_class c, pg_attribute a, pg_type t
|
||||
WHERE relname='$table' AND a.attrelid=c.oid AND
|
||||
a.atttypid=t.oid and a.attname='$field'";
|
||||
$res =$this->query($sql);
|
||||
$row=$this->fetchObject($res);
|
||||
if ($row->ftype=="varchar") {
|
||||
$size=$row->size-4;
|
||||
} else {
|
||||
$size=$row->size;
|
||||
}
|
||||
$this->freeResult( $res );
|
||||
return $size;
|
||||
}
|
||||
|
||||
function lowPriorityOption() {
|
||||
return '';
|
||||
}
|
||||
|
||||
function limitResult($sql, $limit, $offset) {
|
||||
$ret = "SELECT * FROM ($sql) WHERE ROWNUM < " . ((int)$limit + (int)($offset+1));
|
||||
if (is_numeric($offset))
|
||||
$ret .= " AND ROWNUM >= " . (int)$offset;
|
||||
return $ret;
|
||||
}
|
||||
function limitResultForUpdate($sql, $limit) {
|
||||
return $sql;
|
||||
}
|
||||
/**
|
||||
* Returns an SQL expression for a simple conditional.
|
||||
* Uses CASE on PostgreSQL.
|
||||
*
|
||||
* @param string $cond SQL expression which will result in a boolean value
|
||||
* @param string $trueVal SQL expression to return if true
|
||||
* @param string $falseVal SQL expression to return if false
|
||||
* @return string SQL fragment
|
||||
*/
|
||||
function conditional( $cond, $trueVal, $falseVal ) {
|
||||
return " (CASE WHEN $cond THEN $trueVal ELSE $falseVal END) ";
|
||||
}
|
||||
|
||||
# FIXME: actually detecting deadlocks might be nice
|
||||
function wasDeadlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
# Return DB-style timestamp used for MySQL schema
|
||||
function timestamp($ts = 0) {
|
||||
return $this->strencode(wfTimestamp(TS_ORACLE, $ts));
|
||||
# return "TO_TIMESTAMP('" . $this->strencode(wfTimestamp(TS_DB, $ts)) . "', 'RRRR-MM-DD HH24:MI:SS')";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return aggregated value function call
|
||||
*/
|
||||
function aggregateValue ($valuedata,$valuename='value') {
|
||||
return $valuedata;
|
||||
}
|
||||
|
||||
|
||||
function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
|
||||
$message = "A database error has occurred\n" .
|
||||
"Query: $sql\n" .
|
||||
"Function: $fname\n" .
|
||||
"Error: $errno $error\n";
|
||||
throw new DBUnexpectedError($this, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string wikitext of a link to the server software's web site
|
||||
*/
|
||||
function getSoftwareLink() {
|
||||
return "[http://www.oracle.com/ Oracle]";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string Version information from the database
|
||||
*/
|
||||
function getServerVersion() {
|
||||
return oci_server_version($this->mConn);
|
||||
}
|
||||
|
||||
function setSchema($schema=false) {
|
||||
$schemas=$this->mSchemas;
|
||||
if ($schema) { array_unshift($schemas,$schema); }
|
||||
$searchpath=$this->makeList($schemas,LIST_NAMES);
|
||||
$this->query("SET search_path = $searchpath");
|
||||
}
|
||||
|
||||
function begin() {
|
||||
}
|
||||
|
||||
function immediateCommit( $fname = 'Database::immediateCommit' ) {
|
||||
oci_commit($this->mConn);
|
||||
$this->mTrxLevel = 0;
|
||||
}
|
||||
function rollback( $fname = 'Database::rollback' ) {
|
||||
oci_rollback($this->mConn);
|
||||
$this->mTrxLevel = 0;
|
||||
}
|
||||
function getLag() {
|
||||
return false;
|
||||
}
|
||||
function getStatus($which=null) {
|
||||
$result = array('Threads_running' => 0, 'Threads_connected' => 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an optional USE INDEX clause to go after the table, and a
|
||||
* string to go at the end of the query
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @param array $options an associative array of options to be turned into
|
||||
* an SQL query, valid keys are listed in the function.
|
||||
* @return array
|
||||
*/
|
||||
function makeSelectOptions($options) {
|
||||
$tailOpts = '';
|
||||
|
||||
if (isset( $options['ORDER BY'])) {
|
||||
$tailOpts .= " ORDER BY {$options['ORDER BY']}";
|
||||
}
|
||||
|
||||
return array('', $tailOpts);
|
||||
}
|
||||
|
||||
function maxListLen() {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether a given table exists
|
||||
*/
|
||||
function tableExists( $table ) {
|
||||
$table = $this->tableName($table, true);
|
||||
$res = $this->query( "SELECT COUNT(*) as NUM FROM user_tables WHERE table_name='"
|
||||
. $table . "'" );
|
||||
if (!$res)
|
||||
return false;
|
||||
$row = $this->fetchObject($res);
|
||||
$this->freeResult($res);
|
||||
return $row->num >= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* UPDATE wrapper, takes a condition array and a SET array
|
||||
*/
|
||||
function update( $table, $values, $conds, $fname = 'Database::update' ) {
|
||||
$table = $this->tableName( $table );
|
||||
|
||||
$sql = "UPDATE $table SET ";
|
||||
$first = true;
|
||||
foreach ($values as $field => $v) {
|
||||
if ($first)
|
||||
$first = false;
|
||||
else
|
||||
$sql .= ", ";
|
||||
$sql .= "$field = :n$field ";
|
||||
}
|
||||
if ( $conds != '*' ) {
|
||||
$sql .= " WHERE " . $this->makeList( $conds, LIST_AND );
|
||||
}
|
||||
$stmt = $this->parseStatement($sql);
|
||||
if ($stmt === false) {
|
||||
$this->reportQueryError( $this->lastError(), $this->lastErrno(), $stmt );
|
||||
return false;
|
||||
}
|
||||
if ($this->debug())
|
||||
wfDebug("SQL: $sql\n");
|
||||
$s = '';
|
||||
foreach ($values as $field => $v) {
|
||||
oci_bind_by_name($stmt, ":n$field", $values[$field]);
|
||||
if ($this->debug())
|
||||
$s .= " [$field] = [$v]\n";
|
||||
}
|
||||
if ($this->debug())
|
||||
wfdebug(" PH: $s\n");
|
||||
$ret = $this->executeStatement($stmt);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* INSERT wrapper, inserts an array into a table
|
||||
*
|
||||
* $a may be a single associative array, or an array of these with numeric keys, for
|
||||
* multi-row insert.
|
||||
*
|
||||
* Usually aborts on failure
|
||||
* If errors are explicitly ignored, returns success
|
||||
*/
|
||||
function insert( $table, $a, $fname = 'Database::insert', $options = array() ) {
|
||||
# No rows to insert, easy just return now
|
||||
if ( !count( $a ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$table = $this->tableName( $table );
|
||||
if (!is_array($options))
|
||||
$options = array($options);
|
||||
|
||||
$oldIgnore = false;
|
||||
if (in_array('IGNORE', $options))
|
||||
$oldIgnore = $this->ignoreErrors( true );
|
||||
|
||||
if ( isset( $a[0] ) && is_array( $a[0] ) ) {
|
||||
$multi = true;
|
||||
$keys = array_keys( $a[0] );
|
||||
} else {
|
||||
$multi = false;
|
||||
$keys = array_keys( $a );
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO $table (" . implode( ',', $keys ) . ') VALUES (';
|
||||
$return = '';
|
||||
$first = true;
|
||||
foreach ($a as $key => $value) {
|
||||
if ($first)
|
||||
$first = false;
|
||||
else
|
||||
$sql .= ", ";
|
||||
if (is_object($value) && $value->isLOB()) {
|
||||
$sql .= "EMPTY_BLOB()";
|
||||
$return = "RETURNING $key INTO :bobj";
|
||||
} else
|
||||
$sql .= ":$key";
|
||||
}
|
||||
$sql .= ") $return";
|
||||
|
||||
if ($this->debug()) {
|
||||
wfDebug("SQL: $sql\n");
|
||||
}
|
||||
|
||||
if (($stmt = $this->parseStatement($sql)) === false) {
|
||||
$this->reportQueryError($this->lastError(), $this->lastErrno(), $sql, $fname);
|
||||
$this->ignoreErrors($oldIgnore);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're inserting multiple rows, parse the statement once and
|
||||
* execute it for each set of values. Otherwise, convert it into an
|
||||
* array and pretend.
|
||||
*/
|
||||
if (!$multi)
|
||||
$a = array($a);
|
||||
|
||||
foreach ($a as $key => $row) {
|
||||
$blob = false;
|
||||
$bdata = false;
|
||||
$s = '';
|
||||
foreach ($row as $k => $value) {
|
||||
if (is_object($value) && $value->isLOB()) {
|
||||
$blob = oci_new_descriptor($this->mConn, OCI_D_LOB);
|
||||
$bdata = $value->data();
|
||||
oci_bind_by_name($stmt, ":bobj", $blob, -1, OCI_B_BLOB);
|
||||
} else
|
||||
oci_bind_by_name($stmt, ":$k", $a[$key][$k], -1);
|
||||
if ($this->debug())
|
||||
$s .= " [$k] = {$row[$k]}";
|
||||
}
|
||||
if ($this->debug())
|
||||
wfDebug(" PH: $s\n");
|
||||
if (($s = $this->executeStatement($stmt)) === false) {
|
||||
$this->reportQueryError($this->lastError(), $this->lastErrno(), $sql, $fname);
|
||||
$this->ignoreErrors($oldIgnore);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($blob) {
|
||||
$blob->save($bdata);
|
||||
}
|
||||
}
|
||||
$this->ignoreErrors($oldIgnore);
|
||||
return $this->mLastResult = $s;
|
||||
}
|
||||
|
||||
function ping() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function encodeBlob($b) {
|
||||
return new OracleBlob($b);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
CREATE SEQUENCE trackbacks_id_seq;
|
||||
CREATE TABLE trackbacks (
|
||||
tb_id NUMBER PRIMARY KEY,
|
||||
tb_page NUMBER(8) REFERENCES page(page_id) ON DELETE CASCADE,
|
||||
tb_title VARCHAR(255) NOT NULL,
|
||||
tb_url VARCHAR(255) NOT NULL,
|
||||
tb_ex CLOB,
|
||||
tb_name VARCHAR(255)
|
||||
);
|
||||
CREATE INDEX tb_name_page_idx ON trackbacks(tb_page);
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
CREATE TABLE transcache (
|
||||
tc_url VARCHAR2(255) NOT NULL UNIQUE,
|
||||
tc_contents CLOB,
|
||||
tc_time TIMESTAMP NOT NULL
|
||||
);
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
-- Based more or less on the public interwiki map from MeatballWiki
|
||||
-- Default interwiki prefixes...
|
||||
|
||||
CALL add_interwiki('abbenormal','http://www.ourpla.net/cgi-bin/pikie.cgi?$1',0);
|
||||
CALL add_interwiki('acadwiki','http://xarch.tu-graz.ac.at/autocad/wiki/$1',0);
|
||||
CALL add_interwiki('acronym','http://www.acronymfinder.com/af-query.asp?String=exact&Acronym=$1',0);
|
||||
CALL add_interwiki('advogato','http://www.advogato.org/$1',0);
|
||||
CALL add_interwiki('aiwiki','http://www.ifi.unizh.ch/ailab/aiwiki/aiw.cgi?$1',0);
|
||||
CALL add_interwiki('alife','http://news.alife.org/wiki/index.php?$1',0);
|
||||
CALL add_interwiki('annotation','http://bayle.stanford.edu/crit/nph-med.cgi/$1',0);
|
||||
CALL add_interwiki('annotationwiki','http://www.seedwiki.com/page.cfm?wikiid=368&doc=$1',0);
|
||||
CALL add_interwiki('arxiv','http://www.arxiv.org/abs/$1',0);
|
||||
CALL add_interwiki('aspienetwiki','http://aspie.mela.de/Wiki/index.php?title=$1',0);
|
||||
CALL add_interwiki('bemi','http://bemi.free.fr/vikio/index.php?$1',0);
|
||||
CALL add_interwiki('benefitswiki','http://www.benefitslink.com/cgi-bin/wiki.cgi?$1',0);
|
||||
CALL add_interwiki('brasilwiki','http://rio.ifi.unizh.ch/brasilienwiki/index.php/$1',0);
|
||||
CALL add_interwiki('bridgeswiki','http://c2.com/w2/bridges/$1',0);
|
||||
CALL add_interwiki('c2find','http://c2.com/cgi/wiki?FindPage&value=$1',0);
|
||||
CALL add_interwiki('cache','http://www.google.com/search?q=cache:$1',0);
|
||||
CALL add_interwiki('ciscavate','http://ciscavate.org/index.php/$1',0);
|
||||
CALL add_interwiki('cliki','http://ww.telent.net/cliki/$1',0);
|
||||
CALL add_interwiki('cmwiki','http://www.ourpla.net/cgi-bin/wiki.pl?$1',0);
|
||||
CALL add_interwiki('codersbase','http://www.codersbase.com/$1',0);
|
||||
CALL add_interwiki('commons','http://commons.wikimedia.org/wiki/$1',0);
|
||||
CALL add_interwiki('consciousness','http://teadvus.inspiral.org/',0);
|
||||
CALL add_interwiki('corpknowpedia','http://corpknowpedia.org/wiki/index.php/$1',0);
|
||||
CALL add_interwiki('creationmatters','http://www.ourpla.net/cgi-bin/wiki.pl?$1',0);
|
||||
CALL add_interwiki('dejanews','http://www.deja.com/=dnc/getdoc.xp?AN=$1',0);
|
||||
CALL add_interwiki('demokraatia','http://wiki.demokraatia.ee/',0);
|
||||
CALL add_interwiki('dictionary','http://www.dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query=$1',0);
|
||||
CALL add_interwiki('disinfopedia','http://www.disinfopedia.org/wiki.phtml?title=$1',0);
|
||||
CALL add_interwiki('diveintoosx','http://diveintoosx.org/$1',0);
|
||||
CALL add_interwiki('docbook','http://docbook.org/wiki/moin.cgi/$1',0);
|
||||
CALL add_interwiki('dolphinwiki','http://www.object-arts.com/wiki/html/Dolphin/$1',0);
|
||||
CALL add_interwiki('drumcorpswiki','http://www.drumcorpswiki.com/index.php/$1',0);
|
||||
CALL add_interwiki('dwjwiki','http://www.suberic.net/cgi-bin/dwj/wiki.cgi?$1',0);
|
||||
CALL add_interwiki('eĉei','http://www.ikso.net/cgi-bin/wiki.pl?$1',0);
|
||||
CALL add_interwiki('echei','http://www.ikso.net/cgi-bin/wiki.pl?$1',0);
|
||||
CALL add_interwiki('ecxei','http://www.ikso.net/cgi-bin/wiki.pl?$1',0);
|
||||
CALL add_interwiki('efnetceewiki','http://purl.net/wiki/c/$1',0);
|
||||
CALL add_interwiki('efnetcppwiki','http://purl.net/wiki/cpp/$1',0);
|
||||
CALL add_interwiki('efnetpythonwiki','http://purl.net/wiki/python/$1',0);
|
||||
CALL add_interwiki('efnetxmlwiki','http://purl.net/wiki/xml/$1',0);
|
||||
CALL add_interwiki('eljwiki','http://elj.sourceforge.net/phpwiki/index.php/$1',0);
|
||||
CALL add_interwiki('emacswiki','http://www.emacswiki.org/cgi-bin/wiki.pl?$1',0);
|
||||
CALL add_interwiki('elibre','http://enciclopedia.us.es/index.php/$1',0);
|
||||
CALL add_interwiki('eokulturcentro','http://esperanto.toulouse.free.fr/wakka.php?wiki=$1',0);
|
||||
CALL add_interwiki('evowiki','http://www.evowiki.org/index.php/$1',0);
|
||||
CALL add_interwiki('finalempire','http://final-empire.sourceforge.net/cgi-bin/wiki.pl?$1',0);
|
||||
CALL add_interwiki('firstwiki','http://firstwiki.org/index.php/$1',0);
|
||||
CALL add_interwiki('foldoc','http://www.foldoc.org/foldoc/foldoc.cgi?$1',0);
|
||||
CALL add_interwiki('foxwiki','http://fox.wikis.com/wc.dll?Wiki~$1',0);
|
||||
CALL add_interwiki('fr.be','http://fr.wikinations.be/$1',0);
|
||||
CALL add_interwiki('fr.ca','http://fr.ca.wikinations.org/$1',0);
|
||||
CALL add_interwiki('fr.fr','http://fr.fr.wikinations.org/$1',0);
|
||||
CALL add_interwiki('fr.org','http://fr.wikinations.org/$1',0);
|
||||
CALL add_interwiki('freebsdman','http://www.FreeBSD.org/cgi/man.cgi?apropos=1&query=$1',0);
|
||||
CALL add_interwiki('gamewiki','http://gamewiki.org/wiki/index.php/$1',0);
|
||||
CALL add_interwiki('gej','http://www.esperanto.de/cgi-bin/aktivikio/wiki.pl?$1',0);
|
||||
CALL add_interwiki('gentoo-wiki','http://gentoo-wiki.com/$1',0);
|
||||
CALL add_interwiki('globalvoices','http://cyber.law.harvard.edu/dyn/globalvoices/wiki/$1',0);
|
||||
CALL add_interwiki('gmailwiki','http://www.gmailwiki.com/index.php/$1',0);
|
||||
CALL add_interwiki('google','http://www.google.com/search?q=$1',0);
|
||||
CALL add_interwiki('googlegroups','http://groups.google.com/groups?q=$1',0);
|
||||
CALL add_interwiki('gotamac','http://www.got-a-mac.org/$1',0);
|
||||
CALL add_interwiki('greencheese','http://www.greencheese.org/$1',0);
|
||||
CALL add_interwiki('hammondwiki','http://www.dairiki.org/HammondWiki/index.php3?$1',0);
|
||||
CALL add_interwiki('haribeau','http://wiki.haribeau.de/cgi-bin/wiki.pl?$1',0);
|
||||
CALL add_interwiki('hewikisource','http://he.wikisource.org/wiki/$1',1);
|
||||
CALL add_interwiki('herzkinderwiki','http://www.herzkinderinfo.de/Mediawiki/index.php/$1',0);
|
||||
CALL add_interwiki('hrwiki','http://www.hrwiki.org/index.php/$1',0);
|
||||
CALL add_interwiki('iawiki','http://www.IAwiki.net/$1',0);
|
||||
CALL add_interwiki('imdb','http://us.imdb.com/Title?$1',0);
|
||||
CALL add_interwiki('infosecpedia','http://www.infosecpedia.org/pedia/index.php/$1',0);
|
||||
CALL add_interwiki('jargonfile','http://sunir.org/apps/meta.pl?wiki=JargonFile&redirect=$1',0);
|
||||
CALL add_interwiki('jefo','http://www.esperanto-jeunes.org/vikio/index.php?$1',0);
|
||||
CALL add_interwiki('jiniwiki','http://www.cdegroot.com/cgi-bin/jini?$1',0);
|
||||
CALL add_interwiki('jspwiki','http://www.ecyrd.com/JSPWiki/Wiki.jsp?page=$1',0);
|
||||
CALL add_interwiki('kerimwiki','http://wiki.oxus.net/$1',0);
|
||||
CALL add_interwiki('kmwiki','http://www.voght.com/cgi-bin/pywiki?$1',0);
|
||||
CALL add_interwiki('knowhow','http://www2.iro.umontreal.ca/~paquetse/cgi-bin/wiki.cgi?$1',0);
|
||||
CALL add_interwiki('lanifexwiki','http://opt.lanifex.com/cgi-bin/wiki.pl?$1',0);
|
||||
CALL add_interwiki('lasvegaswiki','http://wiki.gmnow.com/index.php/$1',0);
|
||||
CALL add_interwiki('linuxwiki','http://www.linuxwiki.de/$1',0);
|
||||
CALL add_interwiki('lojban','http://www.lojban.org/tiki/tiki-index.php?page=$1',0);
|
||||
CALL add_interwiki('lqwiki','http://wiki.linuxquestions.org/wiki/$1',0);
|
||||
CALL add_interwiki('lugkr','http://lug-kr.sourceforge.net/cgi-bin/lugwiki.pl?$1',0);
|
||||
CALL add_interwiki('lutherwiki','http://www.lutheranarchives.com/mw/index.php/$1',0);
|
||||
CALL add_interwiki('mathsongswiki','http://SeedWiki.com/page.cfm?wikiid=237&doc=$1',0);
|
||||
CALL add_interwiki('mbtest','http://www.usemod.com/cgi-bin/mbtest.pl?$1',0);
|
||||
CALL add_interwiki('meatball','http://www.usemod.com/cgi-bin/mb.pl?$1',0);
|
||||
CALL add_interwiki('mediazilla','http://bugzilla.wikipedia.org/$1',1);
|
||||
CALL add_interwiki('memoryalpha','http://www.memory-alpha.org/en/index.php/$1',0);
|
||||
CALL add_interwiki('metaweb','http://www.metaweb.com/wiki/wiki.phtml?title=$1',0);
|
||||
CALL add_interwiki('metawiki','http://sunir.org/apps/meta.pl?$1',0);
|
||||
CALL add_interwiki('metawikipedia','http://meta.wikimedia.org/wiki/$1',0);
|
||||
CALL add_interwiki('moinmoin','http://purl.net/wiki/moin/$1',0);
|
||||
CALL add_interwiki('mozillawiki','http://wiki.mozilla.org/index.php/$1',0);
|
||||
CALL add_interwiki('muweb','http://www.dunstable.com/scripts/MuWebWeb?$1',0);
|
||||
CALL add_interwiki('netvillage','http://www.netbros.com/?$1',0);
|
||||
CALL add_interwiki('oeis','http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?Anum=$1',0);
|
||||
CALL add_interwiki('openfacts','http://openfacts.berlios.de/index.phtml?title=$1',0);
|
||||
CALL add_interwiki('openwiki','http://openwiki.com/?$1',0);
|
||||
CALL add_interwiki('opera7wiki','http://nontroppo.org/wiki/$1',0);
|
||||
CALL add_interwiki('orgpatterns','http://www.bell-labs.com/cgi-user/OrgPatterns/OrgPatterns?$1',0);
|
||||
CALL add_interwiki('osi reference model','http://wiki.tigma.ee/',0);
|
||||
CALL add_interwiki('pangalacticorg','http://www.pangalactic.org/Wiki/$1',0);
|
||||
CALL add_interwiki('personaltelco','http://www.personaltelco.net/index.cgi/$1',0);
|
||||
CALL add_interwiki('patwiki','http://gauss.ffii.org/$1',0);
|
||||
CALL add_interwiki('phpwiki','http://phpwiki.sourceforge.net/phpwiki/index.php?$1',0);
|
||||
CALL add_interwiki('pikie','http://pikie.darktech.org/cgi/pikie?$1',0);
|
||||
CALL add_interwiki('pmeg','http://www.bertilow.com/pmeg/$1.php',0);
|
||||
CALL add_interwiki('ppr','http://c2.com/cgi/wiki?$1',0);
|
||||
CALL add_interwiki('purlnet','http://purl.oclc.org/NET/$1',0);
|
||||
CALL add_interwiki('pythoninfo','http://www.python.org/cgi-bin/moinmoin/$1',0);
|
||||
CALL add_interwiki('pythonwiki','http://www.pythonwiki.de/$1',0);
|
||||
CALL add_interwiki('pywiki','http://www.voght.com/cgi-bin/pywiki?$1',0);
|
||||
CALL add_interwiki('raec','http://www.raec.clacso.edu.ar:8080/raec/Members/raecpedia/$1',0);
|
||||
CALL add_interwiki('revo','http://purl.org/NET/voko/revo/art/$1.html',0);
|
||||
CALL add_interwiki('rfc','http://www.rfc-editor.org/rfc/rfc$1.txt',0);
|
||||
CALL add_interwiki('s23wiki','http://is-root.de/wiki/index.php/$1',0);
|
||||
CALL add_interwiki('scoutpedia','http://www.scoutpedia.info/index.php/$1',0);
|
||||
CALL add_interwiki('seapig','http://www.seapig.org/$1',0);
|
||||
CALL add_interwiki('seattlewiki','http://seattlewiki.org/wiki/$1',0);
|
||||
CALL add_interwiki('seattlewireless','http://seattlewireless.net/?$1',0);
|
||||
CALL add_interwiki('seeds','http://www.IslandSeeds.org/wiki/$1',0);
|
||||
CALL add_interwiki('senseislibrary','http://senseis.xmp.net/?$1',0);
|
||||
CALL add_interwiki('shakti','http://cgi.algonet.se/htbin/cgiwrap/pgd/ShaktiWiki/$1',0);
|
||||
CALL add_interwiki('slashdot','http://slashdot.org/article.pl?sid=$1',0);
|
||||
CALL add_interwiki('smikipedia','http://www.smikipedia.org/$1',0);
|
||||
CALL add_interwiki('sockwiki','http://wiki.socklabs.com/$1',0);
|
||||
CALL add_interwiki('sourceforge','http://sourceforge.net/$1',0);
|
||||
CALL add_interwiki('squeak','http://minnow.cc.gatech.edu/squeak/$1',0);
|
||||
CALL add_interwiki('strikiwiki','http://ch.twi.tudelft.nl/~mostert/striki/teststriki.pl?$1',0);
|
||||
CALL add_interwiki('susning','http://www.susning.nu/$1',0);
|
||||
CALL add_interwiki('svgwiki','http://www.protocol7.com/svg-wiki/default.asp?$1',0);
|
||||
CALL add_interwiki('tavi','http://tavi.sourceforge.net/$1',0);
|
||||
CALL add_interwiki('tejo','http://www.tejo.org/vikio/$1',0);
|
||||
CALL add_interwiki('terrorwiki','http://www.liberalsagainstterrorism.com/wiki/index.php/$1',0);
|
||||
CALL add_interwiki('tmbw','http://www.tmbw.net/wiki/index.php/$1',0);
|
||||
CALL add_interwiki('tmnet','http://www.technomanifestos.net/?$1',0);
|
||||
CALL add_interwiki('tmwiki','http://www.EasyTopicMaps.com/?page=$1',0);
|
||||
CALL add_interwiki('turismo','http://www.tejo.org/turismo/$1',0);
|
||||
CALL add_interwiki('theopedia','http://www.theopedia.com/$1',0);
|
||||
CALL add_interwiki('twiki','http://twiki.org/cgi-bin/view/$1',0);
|
||||
CALL add_interwiki('twistedwiki','http://purl.net/wiki/twisted/$1',0);
|
||||
CALL add_interwiki('uea','http://www.tejo.org/uea/$1',0);
|
||||
CALL add_interwiki('unreal','http://wiki.beyondunreal.com/wiki/$1',0);
|
||||
CALL add_interwiki('ursine','http://ursine.ca/$1',0);
|
||||
CALL add_interwiki('usej','http://www.tejo.org/usej/$1',0);
|
||||
CALL add_interwiki('usemod','http://www.usemod.com/cgi-bin/wiki.pl?$1',0);
|
||||
CALL add_interwiki('visualworks','http://wiki.cs.uiuc.edu/VisualWorks/$1',0);
|
||||
CALL add_interwiki('warpedview','http://www.warpedview.com/index.php/$1',0);
|
||||
CALL add_interwiki('webdevwikinl','http://www.promo-it.nl/WebDevWiki/index.php?page=$1',0);
|
||||
CALL add_interwiki('webisodes','http://www.webisodes.org/$1',0);
|
||||
CALL add_interwiki('webseitzwiki','http://webseitz.fluxent.com/wiki/$1',0);
|
||||
CALL add_interwiki('why','http://clublet.com/c/c/why?$1',0);
|
||||
CALL add_interwiki('wiki','http://c2.com/cgi/wiki?$1',0);
|
||||
CALL add_interwiki('wikia','http://www.wikia.com/wiki/index.php/$1',0);
|
||||
CALL add_interwiki('wikibooks','http://en.wikibooks.org/wiki/$1',1);
|
||||
CALL add_interwiki('wikicities','http://www.wikicities.com/index.php/$1',0);
|
||||
CALL add_interwiki('wikif1','http://www.wikif1.org/$1',0);
|
||||
CALL add_interwiki('wikinfo','http://www.wikinfo.org/wiki.php?title=$1',0);
|
||||
CALL add_interwiki('wikimedia','http://wikimediafoundation.org/wiki/$1',0);
|
||||
CALL add_interwiki('wikiquote','http://en.wikiquote.org/wiki/$1',1);
|
||||
CALL add_interwiki('wikinews','http://en.wikinews.org/wiki/$1',0);
|
||||
CALL add_interwiki('wikisource','http://sources.wikipedia.org/wiki/$1',1);
|
||||
CALL add_interwiki('wikispecies','http://species.wikipedia.org/wiki/$1',1);
|
||||
CALL add_interwiki('wikitravel','http://wikitravel.org/en/$1',0);
|
||||
CALL add_interwiki('wikiworld','http://WikiWorld.com/wiki/index.php/$1',0);
|
||||
CALL add_interwiki('wiktionary','http://en.wiktionary.org/wiki/$1',1);
|
||||
CALL add_interwiki('wlug','http://www.wlug.org.nz/$1',0);
|
||||
CALL add_interwiki('wlwiki','http://winslowslair.supremepixels.net/wiki/index.php/$1',0);
|
||||
CALL add_interwiki('ypsieyeball','http://sknkwrks.dyndns.org:1957/writewiki/wiki.pl?$1',0);
|
||||
CALL add_interwiki('zwiki','http://www.zwiki.org/$1',0);
|
||||
CALL add_interwiki('zzz wiki','http://wiki.zzz.ee/',0);
|
||||
CALL add_interwiki('wikt','http://en.wiktionary.org/wiki/$1',1);
|
||||
|
||||
|
|
@ -1,335 +0,0 @@
|
|||
-- SQL to create the initial tables for the MediaWiki database.
|
||||
-- This is read and executed by the install script; you should
|
||||
-- not have to run it by itself unless doing a manual install.
|
||||
|
||||
CREATE SEQUENCE user_user_id_seq;
|
||||
|
||||
CREATE TABLE "user" (
|
||||
user_id NUMBER(5) NOT NULL PRIMARY KEY,
|
||||
user_name VARCHAR2(255) DEFAULT '' NOT NULL,
|
||||
user_real_name VARCHAR2(255) DEFAULT '',
|
||||
user_password VARCHAR2(128) DEFAULT '',
|
||||
user_newpassword VARCHAR2(128) default '',
|
||||
user_email VARCHAR2(255) default '',
|
||||
user_options CLOB default '',
|
||||
user_touched TIMESTAMP WITH TIME ZONE,
|
||||
user_token CHAR(32) default '',
|
||||
user_email_authenticated TIMESTAMP WITH TIME ZONE DEFAULT NULL,
|
||||
user_email_token CHAR(32),
|
||||
user_email_token_expires TIMESTAMP WITH TIME ZONE DEFAULT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX user_name_idx ON "user" (user_name);
|
||||
CREATE INDEX user_email_token_idx ON "user" (user_email_token);
|
||||
|
||||
CREATE TABLE user_groups (
|
||||
ug_user NUMBER(5) DEFAULT '0' NOT NULL
|
||||
REFERENCES "user" (user_id)
|
||||
ON DELETE CASCADE,
|
||||
ug_group VARCHAR2(16) NOT NULL,
|
||||
CONSTRAINT user_groups_pk PRIMARY KEY (ug_user, ug_group)
|
||||
);
|
||||
CREATE INDEX user_groups_group_idx ON user_groups(ug_group);
|
||||
|
||||
CREATE TABLE user_newtalk (
|
||||
user_id NUMBER(5) DEFAULT 0 NOT NULL,
|
||||
user_ip VARCHAR2(40) DEFAULT '' NOT NULL
|
||||
);
|
||||
CREATE INDEX user_newtalk_id_idx ON user_newtalk(user_id);
|
||||
CREATE INDEX user_newtalk_ip_idx ON user_newtalk(user_ip);
|
||||
|
||||
CREATE SEQUENCE page_page_id_seq;
|
||||
CREATE TABLE page (
|
||||
page_id NUMBER(8) NOT NULL PRIMARY KEY,
|
||||
page_namespace NUMBER(5) NOT NULL,
|
||||
page_title VARCHAR(255) NOT NULL,
|
||||
page_restrictions CLOB DEFAULT '',
|
||||
page_counter NUMBER(20) DEFAULT 0 NOT NULL,
|
||||
page_is_redirect NUMBER(1) DEFAULT 0 NOT NULL,
|
||||
page_is_new NUMBER(1) DEFAULT 0 NOT NULL,
|
||||
page_random NUMBER(25, 24) NOT NULL,
|
||||
page_touched TIMESTAMP WITH TIME ZONE,
|
||||
page_latest NUMBER(8) NOT NULL,
|
||||
page_len NUMBER(8) DEFAULT 0
|
||||
);
|
||||
CREATE UNIQUE INDEX page_id_namespace_title_idx ON page(page_namespace, page_title);
|
||||
CREATE INDEX page_random_idx ON page(page_random);
|
||||
CREATE INDEX page_len_idx ON page(page_len);
|
||||
|
||||
CREATE SEQUENCE rev_rev_id_val;
|
||||
CREATE TABLE revision (
|
||||
rev_id NUMBER(8) NOT NULL,
|
||||
rev_page NUMBER(8) NOT NULL
|
||||
REFERENCES page (page_id)
|
||||
ON DELETE CASCADE,
|
||||
rev_text_id NUMBER(8) NOT NULL,
|
||||
rev_comment CLOB,
|
||||
rev_user NUMBER(8) DEFAULT 0 NOT NULL,
|
||||
rev_user_text VARCHAR2(255) DEFAULT '' NOT NULL,
|
||||
rev_timestamp TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
rev_minor_edit NUMBER(1) DEFAULT 0 NOT NULL,
|
||||
rev_deleted NUMBER(1) DEFAULT 0 NOT NULL,
|
||||
CONSTRAINT revision_pk PRIMARY KEY (rev_page, rev_id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX rev_id_idx ON revision(rev_id);
|
||||
CREATE INDEX rev_timestamp_idx ON revision(rev_timestamp);
|
||||
CREATE INDEX rev_page_timestamp_idx ON revision(rev_page, rev_timestamp);
|
||||
CREATE INDEX rev_user_timestamp_idx ON revision(rev_user, rev_timestamp);
|
||||
CREATE INDEX rev_usertext_timestamp_idx ON revision(rev_user_text, rev_timestamp);
|
||||
|
||||
CREATE SEQUENCE text_old_id_val;
|
||||
|
||||
CREATE TABLE text (
|
||||
old_id NUMBER(8) NOT NULL,
|
||||
old_text CLOB,
|
||||
old_flags CLOB,
|
||||
CONSTRAINT text_pk PRIMARY KEY (old_id)
|
||||
);
|
||||
|
||||
CREATE TABLE archive (
|
||||
ar_namespace NUMBER(5) NOT NULL,
|
||||
ar_title VARCHAR2(255) NOT NULL,
|
||||
ar_text CLOB,
|
||||
ar_comment CLOB,
|
||||
ar_user NUMBER(8),
|
||||
ar_user_text VARCHAR2(255) NOT NULL,
|
||||
ar_timestamp TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
ar_minor_edit NUMBER(1) DEFAULT 0 NOT NULL,
|
||||
ar_flags CLOB,
|
||||
ar_rev_id NUMBER(8),
|
||||
ar_text_id NUMBER(8)
|
||||
);
|
||||
CREATE INDEX archive_name_title_timestamp ON archive(ar_namespace,ar_title,ar_timestamp);
|
||||
|
||||
CREATE TABLE pagelinks (
|
||||
pl_from NUMBER(8) NOT NULL
|
||||
REFERENCES page(page_id)
|
||||
ON DELETE CASCADE,
|
||||
pl_namespace NUMBER(4) DEFAULT 0 NOT NULL,
|
||||
pl_title VARCHAR2(255) NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX pl_from ON pagelinks(pl_from, pl_namespace, pl_title);
|
||||
CREATE INDEX pl_namespace ON pagelinks(pl_namespace, pl_title, pl_from);
|
||||
|
||||
CREATE TABLE imagelinks (
|
||||
il_from NUMBER(8) NOT NULL REFERENCES page(page_id) ON DELETE CASCADE,
|
||||
il_to VARCHAR2(255) NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX il_from ON imagelinks(il_from, il_to);
|
||||
CREATE INDEX il_to ON imagelinks(il_to, il_from);
|
||||
|
||||
CREATE TABLE categorylinks (
|
||||
cl_from NUMBER(8) NOT NULL REFERENCES page(page_id) ON DELETE CASCADE,
|
||||
cl_to VARCHAR2(255) NOT NULL,
|
||||
cl_sortkey VARCHAR2(86) default '',
|
||||
cl_timestamp TIMESTAMP WITH TIME ZONE NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX cl_from ON categorylinks(cl_from, cl_to);
|
||||
CREATE INDEX cl_sortkey ON categorylinks(cl_to, cl_sortkey);
|
||||
CREATE INDEX cl_timestamp ON categorylinks(cl_to, cl_timestamp);
|
||||
|
||||
--
|
||||
-- Contains a single row with some aggregate info
|
||||
-- on the state of the site.
|
||||
--
|
||||
CREATE TABLE site_stats (
|
||||
ss_row_id NUMBER(8) NOT NULL,
|
||||
ss_total_views NUMBER(20) default 0,
|
||||
ss_total_edits NUMBER(20) default 0,
|
||||
ss_good_articles NUMBER(20) default 0,
|
||||
ss_total_pages NUMBER(20) default -1,
|
||||
ss_users NUMBER(20) default -1,
|
||||
ss_admins NUMBER(10) default -1
|
||||
);
|
||||
CREATE UNIQUE INDEX ss_row_id ON site_stats(ss_row_id);
|
||||
|
||||
--
|
||||
-- Stores an ID for every time any article is visited;
|
||||
-- depending on $wgHitcounterUpdateFreq, it is
|
||||
-- periodically cleared and the page_counter column
|
||||
-- in the page table updated for the all articles
|
||||
-- that have been visited.)
|
||||
--
|
||||
CREATE TABLE hitcounter (
|
||||
hc_id NUMBER NOT NULL
|
||||
);
|
||||
|
||||
--
|
||||
-- The internet is full of jerks, alas. Sometimes it's handy
|
||||
-- to block a vandal or troll account.
|
||||
--
|
||||
CREATE SEQUENCE ipblocks_ipb_id_val;
|
||||
CREATE TABLE ipblocks (
|
||||
ipb_id NUMBER(8) NOT NULL,
|
||||
ipb_address VARCHAR2(40),
|
||||
ipb_user NUMBER(8),
|
||||
ipb_by NUMBER(8) NOT NULL
|
||||
REFERENCES "user" (user_id)
|
||||
ON DELETE CASCADE,
|
||||
ipb_reason CLOB,
|
||||
ipb_timestamp TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
ipb_auto NUMBER(1) DEFAULT 0 NOT NULL,
|
||||
ipb_expiry TIMESTAMP WITH TIME ZONE,
|
||||
CONSTRAINT ipblocks_pk PRIMARY KEY (ipb_id)
|
||||
);
|
||||
CREATE INDEX ipb_address ON ipblocks(ipb_address);
|
||||
CREATE INDEX ipb_user ON ipblocks(ipb_user);
|
||||
|
||||
CREATE TABLE image (
|
||||
img_name VARCHAR2(255) NOT NULL,
|
||||
img_size NUMBER(8) NOT NULL,
|
||||
img_width NUMBER(5) NOT NULL,
|
||||
img_height NUMBER(5) NOT NULL,
|
||||
img_metadata CLOB,
|
||||
img_bits NUMBER(3),
|
||||
img_media_type VARCHAR2(10),
|
||||
img_major_mime VARCHAR2(12) DEFAULT 'unknown',
|
||||
img_minor_mime VARCHAR2(32) DEFAULT 'unknown',
|
||||
img_description CLOB NOT NULL,
|
||||
img_user NUMBER(8) NOT NULL REFERENCES "user"(user_id) ON DELETE CASCADE,
|
||||
img_user_text VARCHAR2(255) NOT NULL,
|
||||
img_timestamp TIMESTAMP WITH TIME ZONE,
|
||||
CONSTRAINT image_pk PRIMARY KEY (img_name)
|
||||
);
|
||||
CREATE INDEX img_size_idx ON image(img_size);
|
||||
CREATE INDEX img_timestamp_idx ON image(img_timestamp);
|
||||
|
||||
CREATE TABLE oldimage (
|
||||
oi_name VARCHAR2(255) NOT NULL,
|
||||
oi_archive_name VARCHAR2(255) NOT NULL,
|
||||
oi_size NUMBER(8) NOT NULL,
|
||||
oi_width NUMBER(5) NOT NULL,
|
||||
oi_height NUMBER(5) NOT NULL,
|
||||
oi_bits NUMBER(3) NOT NULL,
|
||||
oi_description CLOB,
|
||||
oi_user NUMBER(8) NOT NULL REFERENCES "user"(user_id),
|
||||
oi_user_text VARCHAR2(255) NOT NULL,
|
||||
oi_timestamp TIMESTAMP WITH TIME ZONE NOT NULL
|
||||
);
|
||||
CREATE INDEX oi_name ON oldimage (oi_name);
|
||||
|
||||
CREATE SEQUENCE rc_rc_id_seq;
|
||||
CREATE TABLE recentchanges (
|
||||
rc_id NUMBER(8) NOT NULL,
|
||||
rc_timestamp TIMESTAMP WITH TIME ZONE,
|
||||
rc_cur_time TIMESTAMP WITH TIME ZONE,
|
||||
rc_user NUMBER(8) DEFAULT 0 NOT NULL,
|
||||
rc_user_text VARCHAR2(255),
|
||||
rc_namespace NUMBER(4) DEFAULT 0 NOT NULL,
|
||||
rc_title VARCHAR2(255) NOT NULL,
|
||||
rc_comment VARCHAR2(255),
|
||||
rc_minor NUMBER(3) DEFAULT 0 NOT NULL,
|
||||
rc_bot NUMBER(3) DEFAULT 0 NOT NULL,
|
||||
rc_new NUMBER(3) DEFAULT 0 NOT NULL,
|
||||
rc_cur_id NUMBER(8),
|
||||
rc_this_oldid NUMBER(8) NOT NULL,
|
||||
rc_last_oldid NUMBER(8) NOT NULL,
|
||||
rc_type NUMBER(3) DEFAULT 0 NOT NULL,
|
||||
rc_moved_to_ns NUMBER(3),
|
||||
rc_moved_to_title VARCHAR2(255),
|
||||
rc_patrolled NUMBER(3) DEFAULT 0 NOT NULL,
|
||||
rc_ip VARCHAR2(40),
|
||||
rc_old_len NUMBER(10) DEFAULT 0,
|
||||
rc_new_len NUMBER(10) DEFAULT 0,
|
||||
CONSTRAINT rc_pk PRIMARY KEY (rc_id)
|
||||
);
|
||||
CREATE INDEX rc_timestamp ON recentchanges (rc_timestamp);
|
||||
CREATE INDEX rc_namespace_title ON recentchanges(rc_namespace, rc_title);
|
||||
CREATE INDEX rc_cur_id ON recentchanges(rc_cur_id);
|
||||
CREATE INDEX new_name_timestamp ON recentchanges(rc_new, rc_namespace, rc_timestamp);
|
||||
CREATE INDEX rc_ip ON recentchanges(rc_ip);
|
||||
|
||||
CREATE TABLE watchlist (
|
||||
wl_user NUMBER(8) NOT NULL
|
||||
REFERENCES "user"(user_id)
|
||||
ON DELETE CASCADE,
|
||||
wl_namespace NUMBER(8) DEFAULT 0 NOT NULL,
|
||||
wl_title VARCHAR2(255) NOT NULL,
|
||||
wl_notificationtimestamp TIMESTAMP WITH TIME ZONE DEFAULT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX wl_user_namespace_title ON watchlist
|
||||
(wl_user, wl_namespace, wl_title);
|
||||
CREATE INDEX wl_namespace_title ON watchlist(wl_namespace, wl_title);
|
||||
|
||||
--
|
||||
-- Used by texvc math-rendering extension to keep track
|
||||
-- of previously-rendered items.
|
||||
--
|
||||
CREATE TABLE math (
|
||||
math_inputhash VARCHAR2(16) NOT NULL UNIQUE,
|
||||
math_outputhash VARCHAR2(16) NOT NULL,
|
||||
math_html_conservativeness NUMBER(1) NOT NULL,
|
||||
math_html CLOB,
|
||||
math_mathml CLOB
|
||||
);
|
||||
|
||||
--
|
||||
-- Recognized interwiki link prefixes
|
||||
--
|
||||
CREATE TABLE interwiki (
|
||||
iw_prefix VARCHAR2(32) NOT NULL UNIQUE,
|
||||
iw_url VARCHAR2(127) NOT NULL,
|
||||
iw_local NUMBER(1) NOT NULL,
|
||||
iw_trans NUMBER(1) DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE querycache (
|
||||
qc_type VARCHAR2(32) NOT NULL,
|
||||
qc_value NUMBER(5) DEFAULT 0 NOT NULL,
|
||||
qc_namespace NUMBER(4) DEFAULT 0 NOT NULL,
|
||||
qc_title VARCHAR2(255)
|
||||
);
|
||||
CREATE INDEX querycache_type_value ON querycache(qc_type, qc_value);
|
||||
|
||||
--
|
||||
-- For a few generic cache operations if not using Memcached
|
||||
--
|
||||
CREATE TABLE objectcache (
|
||||
keyname CHAR(255) DEFAULT '',
|
||||
value CLOB,
|
||||
exptime TIMESTAMP WITH TIME ZONE
|
||||
);
|
||||
CREATE UNIQUE INDEX oc_keyname_idx ON objectcache(keyname);
|
||||
CREATE INDEX oc_exptime_idx ON objectcache(exptime);
|
||||
|
||||
CREATE TABLE logging (
|
||||
log_type VARCHAR2(10) NOT NULL,
|
||||
log_action VARCHAR2(10) NOT NULL,
|
||||
log_timestamp TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
log_user NUMBER(8) REFERENCES "user"(user_id),
|
||||
log_namespace NUMBER(4),
|
||||
log_title VARCHAR2(255) NOT NULL,
|
||||
log_comment VARCHAR2(255),
|
||||
log_params CLOB
|
||||
);
|
||||
CREATE INDEX logging_type_name ON logging(log_type, log_timestamp);
|
||||
CREATE INDEX logging_user_time ON logging(log_user, log_timestamp);
|
||||
CREATE INDEX logging_page_time ON logging(log_namespace, log_title, log_timestamp);
|
||||
|
||||
-- Hold group name and description
|
||||
--CREATE TABLE /*$wgDBprefix*/groups (
|
||||
-- gr_id int(5) unsigned NOT NULL auto_increment,
|
||||
-- gr_name varchar(50) NOT NULL default '',
|
||||
-- gr_description varchar(255) NOT NULL default '',
|
||||
-- gr_rights tinyblob,
|
||||
-- PRIMARY KEY (gr_id)
|
||||
--
|
||||
--) TYPE=InnoDB;
|
||||
|
||||
CREATE OR REPLACE PROCEDURE add_user_right (name VARCHAR2, new_right VARCHAR2) AS
|
||||
user_id "user".user_id%TYPE;;
|
||||
user_is_missing EXCEPTION;;
|
||||
BEGIN
|
||||
SELECT user_id INTO user_id FROM "user" WHERE user_name = name;;
|
||||
INSERT INTO user_groups (ug_user, ug_group) VALUES(user_id, new_right);;
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND THEN
|
||||
DBMS_OUTPUT.PUT_LINE('The specified user does not exist.');;
|
||||
END add_user_right;;
|
||||
;
|
||||
|
||||
CREATE OR REPLACE PROCEDURE add_interwiki (prefix VARCHAR2, url VARCHAR2, is_local NUMBER) AS
|
||||
BEGIN
|
||||
INSERT INTO interwiki (iw_prefix, iw_url, iw_local) VALUES(prefix, url, is_local);;
|
||||
END add_interwiki;;
|
||||
;
|
||||
|
|
@ -937,8 +937,7 @@ function do_all_updates( $shared = false, $purge = true ) {
|
|||
function archive($name) {
|
||||
global $wgDBtype, $IP;
|
||||
switch ($wgDBtype) {
|
||||
case "oracle":
|
||||
return "$IP/maintenance/oracle/archives/$name";
|
||||
// @fixme: add mysql5 and postgres items or....?
|
||||
default:
|
||||
return "$IP/maintenance/archives/$name";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue