Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use chunked file uploading for files larger than 1 MB as long as we’re on MediaWiki >= 1.20.
- Loading branch information
1 parent
e2bdbed
commit b5e368a
Showing
2 changed files
with
103 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
import time | ||
import io | ||
|
||
|
||
def parse_timestamp(t): | ||
if t is None or t == '0000-00-00T00:00:00Z': | ||
return (0, 0, 0, 0, 0, 0, 0, 0, 0) | ||
return time.strptime(t, '%Y-%m-%dT%H:%M:%SZ') | ||
|
||
|
||
def read_in_chunks(stream, chunk_size): | ||
while True: | ||
data = stream.read(chunk_size) | ||
if not data: | ||
break | ||
yield io.BytesIO(data) |