Page MenuHomeWickedGov Phorge

TimestampType.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

TimestampType.php

<?php
namespace Wikimedia\Rdbms;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Types\Type;
/**
* Handling timestamp edge cases in mediawiki.
* https://www.mediawiki.org/wiki/Manual:Timestamp
*/
class TimestampType extends Type {
public const TIMESTAMP = 'mwtimestamp';
public function getSQLDeclaration( array $fieldDeclaration, AbstractPlatform $platform ): string {
if ( $platform instanceof MySQLPlatform ) {
// "infinite" (in expiry values has to be VARBINARY)
if ( isset( $fieldDeclaration['allowInfinite'] ) && $fieldDeclaration['allowInfinite'] ) {
return 'VARBINARY(14)';
}
return 'BINARY(14)';
}
if ( $platform instanceof SQLitePlatform ) {
return 'BLOB';
}
if ( $platform instanceof PostgreSQLPlatform ) {
return 'TIMESTAMPTZ';
}
return $platform->getDateTimeTzTypeDeclarationSQL( $fieldDeclaration );
}
public function getName(): string {
return self::TIMESTAMP;
}
}

File Metadata

Mime Type
text/x-php
Expires
Oct 4 2026, 08:20 (8 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
fc/f7/fdf311ca184f8c8f41932b08c393
Default Alt Text
TimestampType.php (1 KB)

Event Timeline