Manual:Uploadstash table

Manual:Contents MediaWiki database layout uploadstash table
MediaWiki version:
1.18

The uploadstash table stores information about newly uploaded files before they're moved into the actual filestore, see also Manual:UploadStash . It contains information on incomplete uploads; these can e.g. happen when the user left the upload page before the upload completed. The cleanupUploadStash.php maintenance script can be used to remove orphaned entries from this table.

Fields

us_id

Primary key.

us_user

The user who uploaded the file.

us_key

File key. This is how applications actually search for the file. This might go away, or become the primary key.

us_orig_path

The original path.

us_path

The temporary path at which the file is actually stored.

us_source_type

Which type of upload the file came from (sometimes). E.g. "url"

us_timestamp

The date/time on which the file was added

us_status

E.g. "finished"

us_chunk_inx

MediaWiki version:
1.19

Chunk counter starts at 0, current offset is stored in us_size

us_props

MediaWiki version:
1.21

Serialized file properties from File::getPropsFromPath

us_size

File properties from File::getPropsFromPath. These may prove unnecessary.

us_sha1

This hash comes from File::sha1Base36(), and is 31 characters

us_mime

Combination of img_major_mime and img_minor_mime . E.g., image/png

us_media_type

Media type as defined by the MEDIATYPE_xxx constants, should duplicate definition in the image table.

us_image_width

Image-specific property.

us_image_height

Image-specific property.

us_image_bits

Image-specific properties.

Schema summary

MediaWiki version:
1.41

DESCRIBE uploadstash;

+-----------------+-------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| Field           | Type                                                                                                        | Null | Key | Default | Extra          |
+-----------------+-------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| us_id           | int(10) unsigned                                                                                            | NO   | PRI | NULL    | auto_increment |
| us_user         | int(10) unsigned                                                                                            | NO   | MUL | NULL    |                |
| us_key          | varbinary(255)                                                                                              | NO   | UNI | NULL    |                |
| us_orig_path    | varbinary(255)                                                                                              | NO   |     | NULL    |                |
| us_path         | varbinary(255)                                                                                              | NO   |     | NULL    |                |
| us_source_type  | varbinary(50)                                                                                               | YES  |     | NULL    |                |
| us_timestamp    | binary(14)                                                                                                  | NO   | MUL | NULL    |                |
| us_status       | varbinary(50)                                                                                               | NO   |     | NULL    |                |
| us_chunk_inx    | int(10) unsigned                                                                                            | YES  |     | NULL    |                |
| us_props        | blob                                                                                                        | YES  |     | NULL    |                |
| us_size         | bigint(20) unsigned                                                                                         | NO   |     | NULL    |                |
| us_sha1         | varbinary(31)                                                                                               | NO   |     | NULL    |                |
| us_mime         | varbinary(255)                                                                                              | YES  |     | NULL    |                |
| us_media_type   | enum('UNKNOWN','BITMAP','DRAWING','AUDIO','VIDEO','MULTIMEDIA','OFFICE','TEXT','EXECUTABLE','ARCHIVE','3D') | YES  |     | NULL    |                |
| us_image_width  | int(10) unsigned                                                                                            | YES  |     | NULL    |                |
| us_image_height | int(10) unsigned                                                                                            | YES  |     | NULL    |                |
| us_image_bits   | smallint(5) unsigned                                                                                        | YES  |     | NULL    |                |
+-----------------+-------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
MediaWiki versions:
1.36 – 1.40

DESCRIBE uploadstash;

+-----------------+-------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| Field           | Type                                                                                                        | Null | Key | Default | Extra          |
+-----------------+-------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| us_id           | int(10) unsigned                                                                                            | NO   | PRI | NULL    | auto_increment |
| us_user         | int(10) unsigned                                                                                            | NO   | MUL | NULL    |                |
| us_key          | varbinary(255)                                                                                              | NO   | UNI | NULL    |                |
| us_orig_path    | varbinary(255)                                                                                              | NO   |     | NULL    |                |
| us_path         | varbinary(255)                                                                                              | NO   |     | NULL    |                |
| us_source_type  | varbinary(50)                                                                                               | YES  |     | NULL    |                |
| us_timestamp    | binary(14)                                                                                                  | NO   | MUL | NULL    |                |
| us_status       | varbinary(50)                                                                                               | NO   |     | NULL    |                |
| us_chunk_inx    | int(10) unsigned                                                                                            | YES  |     | NULL    |                |
| us_props        | blob                                                                                                        | YES  |     | NULL    |                |
| us_size         | int(10) unsigned                                                                                            | NO   |     | NULL    |                |
| us_sha1         | varbinary(31)                                                                                               | NO   |     | NULL    |                |
| us_mime         | varbinary(255)                                                                                              | YES  |     | NULL    |                |
| us_media_type   | enum('UNKNOWN','BITMAP','DRAWING','AUDIO','VIDEO','MULTIMEDIA','OFFICE','TEXT','EXECUTABLE','ARCHIVE','3D') | YES  |     | NULL    |                |
| us_image_width  | int(10) unsigned                                                                                            | YES  |     | NULL    |                |
| us_image_height | int(10) unsigned                                                                                            | YES  |     | NULL    |                |
| us_image_bits   | smallint(5) unsigned                                                                                        | YES  |     | NULL    |                |
+-----------------+-------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
MediaWiki versions:
1.30 – 1.35

DESCRIBE uploadstash;

+-----------------+-------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| Field           | Type                                                                                                        | Null | Key | Default | Extra          |
+-----------------+-------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| us_id           | int(10) unsigned                                                                                            | NO   | PRI | NULL    | auto_increment |
| us_user         | int(10) unsigned                                                                                            | NO   | MUL | NULL    |                |
| us_key          | varbinary(255)                                                                                              | NO   | UNI | NULL    |                |
| us_orig_path    | varbinary(255)                                                                                              | NO   |     | NULL    |                |
| us_path         | varbinary(255)                                                                                              | NO   |     | NULL    |                |
| us_source_type  | varbinary(50)                                                                                               | YES  |     | NULL    |                |
| us_timestamp    | varbinary(14)                                                                                               | NO   | MUL | NULL    |                |
| us_status       | varbinary(50)                                                                                               | NO   |     | NULL    |                |
| us_chunk_inx    | int(10) unsigned                                                                                            | YES  |     | NULL    |                |
| us_props        | blob                                                                                                        | YES  |     | NULL    |                |
| us_size         | int(10) unsigned                                                                                            | NO   |     | NULL    |                |
| us_sha1         | varbinary(31)                                                                                               | NO   |     | NULL    |                |
| us_mime         | varbinary(255)                                                                                              | YES  |     | NULL    |                |
| us_media_type   | enum('UNKNOWN','BITMAP','DRAWING','AUDIO','VIDEO','MULTIMEDIA','OFFICE','TEXT','EXECUTABLE','ARCHIVE','3D') | YES  |     | NULL    |                |
| us_image_width  | int(10) unsigned                                                                                            | YES  |     | NULL    |                |
| us_image_height | int(10) unsigned                                                                                            | YES  |     | NULL    |                |
| us_image_bits   | smallint(5) unsigned                                                                                        | YES  |     | NULL    |                |
+-----------------+-------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
MediaWiki versions:
1.21 – 1.29

DESCRIBE uploadstash;

+-----------------+--------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| Field           | Type                                                                                                   | Null | Key | Default | Extra          |
+-----------------+--------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| us_id           | int(10) unsigned                                                                                       | NO   | PRI | NULL    | auto_increment |
| us_user         | int(10) unsigned                                                                                       | NO   | MUL | NULL    |                |
| us_key          | varbinary(255)                                                                                         | NO   | UNI | NULL    |                |
| us_orig_path    | varbinary(255)                                                                                         | NO   |     | NULL    |                |
| us_path         | varbinary(255)                                                                                         | NO   |     | NULL    |                |
| us_source_type  | varbinary(50)                                                                                          | YES  |     | NULL    |                |
| us_timestamp    | varbinary(14)                                                                                          | NO   | MUL | NULL    |                |
| us_status       | varbinary(50)                                                                                          | NO   |     | NULL    |                |
| us_chunk_inx    | int(10) unsigned                                                                                       | YES  |     | NULL    |                |
| us_props        | blob                                                                                                   | YES  |     | NULL    |                |
| us_size         | int(10) unsigned                                                                                       | NO   |     | NULL    |                |
| us_sha1         | varbinary(31)                                                                                          | NO   |     | NULL    |                |
| us_mime         | varbinary(255)                                                                                         | YES  |     | NULL    |                |
| us_media_type   | enum('UNKNOWN','BITMAP','DRAWING','AUDIO','VIDEO','MULTIMEDIA','OFFICE','TEXT','EXECUTABLE','ARCHIVE') | YES  |     | NULL    |                |
| us_image_width  | int(10) unsigned                                                                                       | YES  |     | NULL    |                |
| us_image_height | int(10) unsigned                                                                                       | YES  |     | NULL    |                |
| us_image_bits   | smallint(5) unsigned                                                                                   | YES  |     | NULL    |                |
+-----------------+--------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
MediaWiki versions:
1.19 – 1.20

DESCRIBE uploadstash;

+-----------------+--------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| Field           | Type                                                                                                   | Null | Key | Default | Extra          |
+-----------------+--------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| us_id           | int(10) unsigned                                                                                       | NO   | PRI | NULL    | auto_increment |
| us_user         | int(10) unsigned                                                                                       | NO   | MUL | NULL    |                |
| us_key          | varbinary(255)                                                                                         | NO   | UNI | NULL    |                |
| us_orig_path    | varbinary(255)                                                                                         | NO   |     | NULL    |                |
| us_path         | varbinary(255)                                                                                         | NO   |     | NULL    |                |
| us_source_type  | varbinary(50)                                                                                          | YES  |     | NULL    |                |
| us_timestamp    | varbinary(14)                                                                                          | NO   | MUL | NULL    |                |
| us_status       | varbinary(50)                                                                                          | NO   |     | NULL    |                |
| us_chunk_inx    | int(10) unsigned                                                                                       | YES  |     | NULL    |                |
| us_size         | int(10) unsigned                                                                                       | NO   |     | NULL    |                |
| us_sha1         | varbinary(31)                                                                                          | NO   |     | NULL    |                |
| us_mime         | varbinary(255)                                                                                         | YES  |     | NULL    |                |
| us_media_type   | enum('UNKNOWN','BITMAP','DRAWING','AUDIO','VIDEO','MULTIMEDIA','OFFICE','TEXT','EXECUTABLE','ARCHIVE') | YES  |     | NULL    |                |
| us_image_width  | int(10) unsigned                                                                                       | YES  |     | NULL    |                |
| us_image_height | int(10) unsigned                                                                                       | YES  |     | NULL    |                |
| us_image_bits   | smallint(5) unsigned                                                                                   | YES  |     | NULL    |                |
+-----------------+--------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
MediaWiki version:
1.18

DESCRIBE uploadstash;

+-----------------+--------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| Field           | Type                                                                                                   | Null | Key | Default | Extra          |
+-----------------+--------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| us_id           | int(10) unsigned                                                                                       | NO   | PRI | NULL    | auto_increment |
| us_user         | int(10) unsigned                                                                                       | NO   | MUL | NULL    |                |
| us_key          | varbinary(255)                                                                                         | NO   | UNI | NULL    |                |
| us_orig_path    | varbinary(255)                                                                                         | NO   |     | NULL    |                |
| us_path         | varbinary(255)                                                                                         | NO   |     | NULL    |                |
| us_source_type  | varbinary(50)                                                                                          | YES  |     | NULL    |                |
| us_timestamp    | varbinary(14)                                                                                          | NO   | MUL | NULL    |                |
| us_status       | varbinary(50)                                                                                          | NO   |     | NULL    |                |
| us_size         | int(10) unsigned                                                                                       | NO   |     | NULL    |                |
| us_sha1         | varbinary(31)                                                                                          | NO   |     | NULL    |                |
| us_mime         | varbinary(255)                                                                                         | YES  |     | NULL    |                |
| us_media_type   | enum('UNKNOWN','BITMAP','DRAWING','AUDIO','VIDEO','MULTIMEDIA','OFFICE','TEXT','EXECUTABLE','ARCHIVE') | YES  |     | NULL    |                |
| us_image_width  | int(10) unsigned                                                                                       | YES  |     | NULL    |                |
| us_image_height | int(10) unsigned                                                                                       | YES  |     | NULL    |                |
| us_image_bits   | smallint(5) unsigned                                                                                   | YES  |     | NULL    |                |
+-----------------+--------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+

Indexes

MediaWiki version:
1.18

SHOW INDEX IN uploadstash;

+-------------+------------+--------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table       | Non_unique | Key_name     | Seq_in_index | Column_name  | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------------+------------+--------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| uploadstash |          0 | PRIMARY      |            1 | us_id        | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| uploadstash |          0 | us_key       |            1 | us_key       | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| uploadstash |          1 | us_user      |            1 | us_user      | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| uploadstash |          1 | us_timestamp |            1 | us_timestamp | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
+-------------+------------+--------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+