* @param string $pageText
* @param bool $watch
* @param User $user
- *
+ * @param string[] $tags Change tags to add to the log entry and page revision.
* @return Status Indicating the whether the upload succeeded.
*/
- public function performUpload( $comment, $pageText, $watch, $user ) {
+ public function performUpload( $comment, $pageText, $watch, $user, $tags = array() ) {
$this->getLocalFile()->load( File::READ_LATEST );
$status = $this->getLocalFile()->upload(
File::DELETE_SOURCE,
$this->mFileProps,
false,
- $user
+ $user,
+ $tags
);
if ( $status->isGood() ) {
}
/**
+ * Get the MediaWiki maximum uploaded file size for given type of upload, based on
+ * $wgMaxUploadSize.
+ *
* @param null|string $forType
* @return int
*/
}
}
+ /**
+ * Get the PHP maximum uploaded file size, based on ini settings. If there is no limit or the
+ * limit can't be guessed, returns a very large number (PHP_INT_MAX).
+ *
+ * @since 1.27
+ * @return int
+ */
+ public static function getMaxPhpUploadSize() {
+ $phpMaxFileSize = wfShorthandToInteger(
+ ini_get( 'upload_max_filesize' ) ?: ini_get( 'hhvm.server.upload.upload_max_file_size' ),
+ PHP_INT_MAX
+ );
+ $phpMaxPostSize = wfShorthandToInteger(
+ ini_get( 'post_max_size' ) ?: ini_get( 'hhvm.server.max_post_size' ),
+ PHP_INT_MAX
+ ) ?: PHP_INT_MAX;
+ return min( $phpMaxFileSize, $phpMaxPostSize );
+ }
+
/**
* Get the current status of a chunked upload (used for polling)
*
if ( $value === false ) {
$cache->delete( $key );
} else {
- $cache->set( $key, $value, 86400 );
+ $cache->set( $key, $value, $cache::TTL_DAY );
}
}
}