Index: trunk/extensions/BadImage/BadImage.class.php |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | global $wgMemc; |
40 | 40 | wfProfileIn( __METHOD__ ); |
41 | 41 | $dbw =& wfGetDB( DB_MASTER ); |
42 | | - $dbw->insert( 'bad_images', array( 'bil_name' => $name, 'bil_user' => $user, 'bil_timestamp' => wfTimestampNow(), 'bil_reason' => $reason ), __METHOD__, 'IGNORE' ); |
| 42 | + $dbw->insert( 'bad_images', array( 'bil_name' => $name, 'bil_user' => $user, 'bil_timestamp' => $dbw->timestamp(), 'bil_reason' => $reason ), __METHOD__, 'IGNORE' ); |
43 | 43 | $wgMemc->delete( BadImageList::key( $name ) ); |
44 | 44 | wfProfileOut( __METHOD__ ); |
45 | 45 | } |
Index: trunk/extensions/BadImage/badimage.pg.sql |
— | — | @@ -0,0 +1,10 @@ |
| 2 | +-- Postgres version |
| 3 | +CREATE TABLE bad_images ( |
| 4 | + bil_name TEXT NOT NULL, |
| 5 | + bil_timestamp TIMESTAMPTZ NOT NULL, |
| 6 | + bil_user INTEGER NOT NULL, |
| 7 | + bil_reason TEXT NOT NULL |
| 8 | +); |
| 9 | + |
| 10 | +CREATE UNIQUE INDEX bil_name_unique ON bad_images (bil_name); |
| 11 | + |
Property changes on: trunk/extensions/BadImage/badimage.pg.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 12 | + native |
Index: trunk/extensions/BadImage/install.php |
— | — | @@ -51,12 +51,14 @@ |
52 | 52 | } |
53 | 53 | |
54 | 54 | # Do nothing if the table exists |
55 | | -if( !$dba->tableExists( 'bad_images' ) ) { |
| 55 | +if( $dba->tableExists( 'bad_images' ) ) { |
| 56 | + echo( "The table already exists. No action was taken.\n" ); |
| 57 | +} else { |
| 58 | + if ($wgDBtype == 'postgres') |
| 59 | + $sql = dirname( __FILE__ ) . '/badimage.pg.sql'; |
56 | 60 | if( $dba->sourceFile( $sql ) ) { |
57 | 61 | echo( "The table has been set up correctly.\n" ); |
58 | 62 | } |
59 | | -} else { |
60 | | - echo( "The table already exists. No action was taken.\n" ); |
61 | 63 | } |
62 | 64 | |
63 | 65 | # Close the connection |