[MediaWiki-commits] [Gerrit] Clear previously left-over PQresult before calling pg_get_re... - change (mediawiki/core)

2015-09-26 Thread Yoonghm (Code Review)
Yoonghm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/241497

Change subject: Clear previously left-over PQresult before calling 
pg_get_result()
..

Clear previously left-over PQresult before calling pg_get_result()

Change-Id: Iaa1a479b5eefcae0fc8f82b1d20e9575d609c0e9
---
M includes/db/DatabasePostgres.php
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/97/241497/1

diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php
index aaa1c6e..804f251 100644
--- a/includes/db/DatabasePostgres.php
+++ b/includes/db/DatabasePostgres.php
@@ -487,6 +487,9 @@
$sql = mb_convert_encoding( $sql, 'UTF-8' );
}
$this->mTransactionState->check();
+   // Clear previously left over PQresult
+   while ( $res = pg_get_result( $this->mConn ) )
+   pg_free_result( $res );
if ( pg_send_query( $this->mConn, $sql ) === false ) {
throw new DBUnexpectedError( $this, "Unable to post new 
query to PostgreSQL\n" );
}

-- 
To view, visit https://gerrit.wikimedia.org/r/241497
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa1a479b5eefcae0fc8f82b1d20e9575d609c0e9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Yoonghm 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] For PostgreSQL database: a) Temp tables are automatically de... - change (mediawiki/core)

2015-09-26 Thread Yoonghm (Code Review)
Yoonghm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/241496

Change subject: For PostgreSQL database: a) Temp tables are automatically 
deleted upon end of session b) Same Temp table name hides existing table for 
current session
..

For PostgreSQL database:
a) Temp tables are automatically deleted upon end of session
b) Same Temp table name hides existing table for current session

Change-Id: I0740f6720dc081948e6460a33246aa7061df3d9f
---
M includes/db/CloneDatabase.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/96/241496/1

diff --git a/includes/db/CloneDatabase.php b/includes/db/CloneDatabase.php
index bc703f3..3244055 100644
--- a/includes/db/CloneDatabase.php
+++ b/includes/db/CloneDatabase.php
@@ -88,8 +88,10 @@
self::changePrefix( $this->newTablePrefix );
$newTableName = $this->db->tableName( $tbl, 'raw' );
 
+   // Postgres: Temp tables are automatically deleted upon 
end of session
+   //   Same Temp table name hides existing table 
for current session
if ( $this->dropCurrentTables
-   && !in_array( $this->db->getType(), array( 
'postgres', 'oracle' ) )
+   && !in_array( $this->db->getType(), array( 
'oracle' ) )
) {
if ( $oldTableName === $newTableName ) {
// Last ditch check to avoid data loss

-- 
To view, visit https://gerrit.wikimedia.org/r/241496
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0740f6720dc081948e6460a33246aa7061df3d9f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Yoonghm 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] In PostgresSQL a) Temp tables are automatically deleted upon... - change (mediawiki/core)

2015-09-26 Thread Yoonghm (Code Review)
Yoonghm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/241489

Change subject: In PostgresSQL a) Temp tables are automatically deleted upon 
end of session b) Same temp table name hides existing table for current session
..

In PostgresSQL
a) Temp tables are automatically deleted upon end of session
b) Same temp table name hides existing table for current session

It is not necessary to consider 'postgres' during dropping of table.
I guess similar logic for Oracle but I could not verify.
It seems that no one use Oracle for Wikipedia.

Change-Id: I37b5483a6e9abe5cda0d4dfc103c287641f277a7
---
M includes/db/CloneDatabase.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/89/241489/1

diff --git a/includes/db/CloneDatabase.php b/includes/db/CloneDatabase.php
index bc703f3..3244055 100644
--- a/includes/db/CloneDatabase.php
+++ b/includes/db/CloneDatabase.php
@@ -88,8 +88,10 @@
self::changePrefix( $this->newTablePrefix );
$newTableName = $this->db->tableName( $tbl, 'raw' );
 
+   // Postgres: Temp tables are automatically deleted upon 
end of session
+   //   Same Temp table name hides existing table 
for current session
if ( $this->dropCurrentTables
-   && !in_array( $this->db->getType(), array( 
'postgres', 'oracle' ) )
+   && !in_array( $this->db->getType(), array( 
'oracle' ) )
) {
if ( $oldTableName === $newTableName ) {
// Last ditch check to avoid data loss

-- 
To view, visit https://gerrit.wikimedia.org/r/241489
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I37b5483a6e9abe5cda0d4dfc103c287641f277a7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Yoonghm 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Modify code due to code quality check - change (mediawiki/core)

2015-09-26 Thread Yoonghm (Code Review)
Yoonghm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/241488

Change subject: Modify code due to code quality check
..

Modify code due to code quality check

Change-Id: Iccacedc19f322d627f782617729bd58133fde2a0
---
M includes/db/DatabasePostgres.php
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/88/241488/1

diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php
index 56a5b2c..67ebed5 100644
--- a/includes/db/DatabasePostgres.php
+++ b/includes/db/DatabasePostgres.php
@@ -487,6 +487,8 @@
$sql = mb_convert_encoding( $sql, 'UTF-8' );
}
$this->mTransactionState->check();
+   while ( $res = pg_get_result( $this->mConn ) )
+   pg_free_result( $res );
if ( pg_send_query( $this->mConn, $sql ) === false ) {
throw new DBUnexpectedError( $this, "Unable to post new 
query to PostgreSQL\n" );
}

-- 
To view, visit https://gerrit.wikimedia.org/r/241488
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iccacedc19f322d627f782617729bd58133fde2a0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Yoonghm 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update as per code quality - change (mediawiki/core)

2015-09-26 Thread Yoonghm (Code Review)
Yoonghm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/241458

Change subject: Update as per code quality
..

Update as per code quality

Change-Id: I57341e5ff476bc69876042d85e84698db62f7338
---
M includes/db/DatabasePostgres.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/58/241458/1

diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php
index 05c027c..67ebed5 100644
--- a/includes/db/DatabasePostgres.php
+++ b/includes/db/DatabasePostgres.php
@@ -487,8 +487,8 @@
$sql = mb_convert_encoding( $sql, 'UTF-8' );
}
$this->mTransactionState->check();
-   while ($res = pg_get_result( $this->mConn ) )
-   pg_free_result($res);
+   while ( $res = pg_get_result( $this->mConn ) )
+   pg_free_result( $res );
if ( pg_send_query( $this->mConn, $sql ) === false ) {
throw new DBUnexpectedError( $this, "Unable to post new 
query to PostgreSQL\n" );
}

-- 
To view, visit https://gerrit.wikimedia.org/r/241458
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I57341e5ff476bc69876042d85e84698db62f7338
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Yoonghm 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] It fixes the error "pg_send_query(): There are results on th... - change (mediawiki/core)

2015-09-26 Thread Yoonghm (Code Review)
Yoonghm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/241357

Change subject: It fixes the error "pg_send_query(): There are results on this 
connection. Call pg_get_result() until it returns FALSE."
..

It fixes the error
"pg_send_query(): There are results on this connection.
Call pg_get_result() until it returns FALSE."

The reason is that even if pg_send_query() returns false,
we still need to read off any incoming PQresult by this query.
Otherwise, the next pg_send_query() may report the above error.

Change-Id: I0bae67355ac6152f42f33b4f590ad4d93ac3fb11
---
M includes/db/DatabasePostgres.php
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/57/241357/1

diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php
index 56a5b2c..05c027c 100644
--- a/includes/db/DatabasePostgres.php
+++ b/includes/db/DatabasePostgres.php
@@ -487,6 +487,8 @@
$sql = mb_convert_encoding( $sql, 'UTF-8' );
}
$this->mTransactionState->check();
+   while ($res = pg_get_result( $this->mConn ) )
+   pg_free_result($res);
if ( pg_send_query( $this->mConn, $sql ) === false ) {
throw new DBUnexpectedError( $this, "Unable to post new 
query to PostgreSQL\n" );
}

-- 
To view, visit https://gerrit.wikimedia.org/r/241357
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0bae67355ac6152f42f33b4f590ad4d93ac3fb11
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Yoonghm 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Changes to be committed: modified: InviteSignupHooks.php... - change (mediawiki...InviteSignup)

2015-09-14 Thread Yoonghm (Code Review)
Yoonghm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/238146

Change subject: Changes to be committed:modified:   
InviteSignupHooks.php   new file:   sql/invitesignup.pg.sql
..

Changes to be committed:
modified:   InviteSignupHooks.php
new file:   sql/invitesignup.pg.sql

This feature add support for PostgreSQL database

Change-Id: Ie50341f88e0c0d674d4ef9f16d627c5f2d138ec8
---
M InviteSignupHooks.php
A sql/invitesignup.pg.sql
2 files changed, 22 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/InviteSignup 
refs/changes/46/238146/1

diff --git a/InviteSignupHooks.php b/InviteSignupHooks.php
index db7ede1..1377226 100644
--- a/InviteSignupHooks.php
+++ b/InviteSignupHooks.php
@@ -63,6 +63,15 @@
 
public static function onLoadExtensionSchemaUpdates( DatabaseUpdater 
$updater ) {
$dir = __DIR__ . '/sql';
-   $updater->addExtensionTable( 'invitesignup', 
"$dir/invitesignup.sql" );
+   switch ( $updater->getDB()->getType() ) {
+   case "mysql":
+   $updater->addExtensionTable( 'invitesignup', 
"$dir/invitesignup.sql" );
+   break;
+   case "postgres":
+   $updater->addExtensionTable( 'invitesignup', 
"$dir/invitesignup.pg.sql" );
+   break;
+   default:
+   throw new MWException("InviteSignup does not support 
{$updater->getDB()->getType()} yet.");
+   }
}
 }
diff --git a/sql/invitesignup.pg.sql b/sql/invitesignup.pg.sql
new file mode 100644
index 000..7691c26
--- /dev/null
+++ b/sql/invitesignup.pg.sql
@@ -0,0 +1,12 @@
+-- Invite signup signups
+CREATE TABLE /*$wgDBprefix*/invitesignup (
+  is_inviter INTEGER  NOT NULL,
+  is_invitee INTEGER,
+  is_email   BYTEANOT NULL,
+  is_whenBYTEANOT NULL,
+  is_usedBYTEA,
+  is_hashBYTEANOT NULL,
+  is_groups  BYTEA,
+
+  PRIMARY KEY (is_hash)
+) /*$wgDBTableOptions*/;

-- 
To view, visit https://gerrit.wikimedia.org/r/238146
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie50341f88e0c0d674d4ef9f16d627c5f2d138ec8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/InviteSignup
Gerrit-Branch: master
Gerrit-Owner: Yoonghm 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits