'wcf.attachment.upload.error.reachedLimit': '{lang}wcf.attachment.upload.error.reachedLimit{/lang}',
'wcf.attachment.upload.error.reachedRemainingLimit': '{lang}wcf.attachment.upload.error.reachedRemainingLimit{/lang}',
'wcf.attachment.upload.error.uploadFailed': '{lang}wcf.attachment.upload.error.uploadFailed{/lang}',
+ 'wcf.attachment.upload.error.uploadPhpLimit': '{lang}wcf.attachment.upload.error.uploadPhpLimit{/lang}',
'wcf.attachment.insert': '{lang}wcf.attachment.insert{/lang}',
'wcf.attachment.insertAll': '{lang}wcf.attachment.insertAll{/lang}',
'wcf.attachment.insertFull': '{lang}wcf.attachment.insertFull{/lang}',
// error handling
if (data.returnValues && data.returnValues.errors[$internalFileID]) {
- $errorMessage = data.returnValues.errors[$internalFileID]['errorType'];
+ var errorData = data.returnValues.errors[$internalFileID];
+ $errorMessage = errorData.errorType;
+
+ if ($errorMessage === 'uploadFailed' && errorData.additionalData.phpLimitExceeded) {
+ $errorMessage = 'uploadPhpLimit';
+ }
}
else {
// unknown error
namespace wcf\acp\form;
use wcf\data\package\installation\queue\PackageInstallationQueue;
use wcf\data\package\installation\queue\PackageInstallationQueueEditor;
+use wcf\data\package\Package;
use wcf\form\AbstractForm;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\exception\UserInputException;
+use wcf\system\package\PackageArchive;
use wcf\system\package\validation\PackageValidationException;
use wcf\system\package\validation\PackageValidationManager;
use wcf\system\package\PackageInstallationDispatcher;
/**
* updated package object
- * @var \wcf\data\package\Package
+ * @var Package
*/
- public $package = null;
+ public $package;
/**
* data of the uploaded package
/**
* archive of the installation/update package
- * @var \wcf\system\package\PackageArchive
+ * @var PackageArchive
*/
- public $archive = null;
+ public $archive;
/**
* package installation/update queue
* @var PackageInstallationQueue
*/
- public $queue = null;
+ public $queue;
/**
* location of the package uploaded via style import
if (empty($filename)) {
if (empty($this->uploadPackage['tmp_name'])) {
+ if (isset($_FILES['uploadPackage']) && $_FILES['uploadPackage']['error'] === UPLOAD_ERR_INI_SIZE) {
+ throw new UserInputException('uploadPackage', 'exceedsPhpLimit');
+ }
+
throw new UserInputException('uploadPackage', 'uploadFailed');
}
$result['errors'][$file->getInternalFileID()] = [
'filename' => $file->getFilename(),
'filesize' => $file->getFilesize(),
- 'errorType' => $file->getValidationErrorType()
+ 'errorType' => $file->getValidationErrorType(),
+ 'additionalData' => $file->getValidationErrorAdditionalData()
];
}
}
*/
public function validate(UploadFile $uploadFile) {
if ($uploadFile->getErrorCode() != 0) {
- $uploadFile->setValidationErrorType('uploadFailed');
+ $additionalData = [];
+ if ($uploadFile->getErrorCode() === UPLOAD_ERR_INI_SIZE) $additionalData['phpLimitExceeded'] = true;
+
+ $uploadFile->setValidationErrorType('uploadFailed', $additionalData);
return false;
}
*/
protected $validationErrorType = '';
+ /**
+ * additional data for validation errors
+ * @var array
+ */
+ protected $validationErrorAdditionalData = [];
+
/**
* Creates a new UploadFile object.
*
* Sets the validation error type.
*
* @param string $validationErrorType
+ * @param array $additionalData
*/
- public function setValidationErrorType($validationErrorType) {
+ public function setValidationErrorType($validationErrorType, array $additionalData = []) {
$this->validationErrorType = $validationErrorType;
+ $this->validationErrorAdditionalData = $additionalData;
}
/**
return $this->validationErrorType;
}
+ /**
+ * Returns the validation error additional data array.
+ *
+ * @return array
+ */
+ public function getValidationErrorAdditionalData() {
+ return $this->validationErrorAdditionalData;
+ }
+
/**
* Returns the image data of the file or `null` if the file is no image.
*
<item name="wcf.acp.package.dependencies.title"><![CDATA[Abhängigkeiten]]></item>
<item name="wcf.acp.package.description"><![CDATA[Beschreibung]]></item>
<item name="wcf.acp.package.error.cli.installIsApplication"><![CDATA[Apps können per CLI nicht installiert werden.]]></item>
+ <item name="wcf.acp.package.error.exceedsPhpLimit"><![CDATA[Die Datei ist größer als das PHP-Limit „max_upload_filesize“ und/oder „post_max_size“.]]></item>
<item name="wcf.acp.package.error.noUniqueAbbrevation"><![CDATA[Es ist bereits eine App installiert, die die gleiche Abkürzung besitzt.]]></item>
<item name="wcf.acp.package.error.noValidPackage"><![CDATA[Das angegebene Archiv ist kein gültiges Paket.]]></item>
<item name="wcf.acp.package.error.sql.createTable"><![CDATA[Existierende Tabellen überschreiben]]></item>
<item name="wcf.attachment.upload.error.reachedLimit"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} die maximale Anzahl an Dateianhängen erreicht.]]></item>
<item name="wcf.attachment.upload.error.reachedRemainingLimit"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} zu viele Dateianhänge ausgewählt, maximal verbleibend: #remaining#.]]></item>
<item name="wcf.attachment.upload.error.uploadFailed"><![CDATA[Beim Hochladen der Datei ist ein unbekannter Fehler aufgetreten.]]></item>
+ <item name="wcf.attachment.upload.error.uploadPhpLimit"><![CDATA[Die Datei ist größer als das PHP-Limit „max_upload_filesize“ und/oder „post_max_size“.]]></item>
<item name="wcf.attachment.upload.limits"><![CDATA[Maximale Anzahl an Dateianhängen: {#$attachmentHandler->getMaxCount()}<br>
Maximale Dateigröße: {@$attachmentHandler->getMaxSize()|filesize}<br>
Erlaubte Dateiendungen: {', '|implode:$attachmentHandler->getFormattedAllowedExtensions()}]]></item>
<item name="wcf.acp.package.dependencies.title"><![CDATA[Dependencies]]></item>
<item name="wcf.acp.package.description"><![CDATA[Description]]></item>
<item name="wcf.acp.package.error.cli.installIsApplication"><![CDATA[Apps cannot be installed via CLI.]]></item>
+ <item name="wcf.acp.package.error.exceedsPhpLimit"><![CDATA[The file exceeds the PHP limit “max_upload_filesize” and/or “post_max_size”.]]></item>
<item name="wcf.acp.package.error.noUniqueAbbrevation"><![CDATA[There is already an app installed which has the same abbreviation.]]></item>
<item name="wcf.acp.package.error.noValidPackage"><![CDATA[The uploaded archive is invalid.]]></item>
<item name="wcf.acp.package.error.sql.createTable"><![CDATA[Overwrite Existing Tables]]></item>
<item name="wcf.attachment.upload.error.reachedRemainingLimit"><![CDATA[You have selected too many attachments, remaining: #remaining#.]]></item>
<item name="wcf.attachment.upload.error.uploadFailed"><![CDATA[An unknown error occurred during the upload.]]></item>
+ <item name="wcf.attachment.upload.error.uploadPhpLimit"><![CDATA[The file exceeds the PHP limit “max_upload_filesize” and/or “post_max_size”.]]></item>
<item name="wcf.attachment.upload.limits"><![CDATA[The maximum number of attachments: {#$attachmentHandler->getMaxCount()}<br>
Allowed extensions: {', '|implode:$attachmentHandler->getFormattedAllowedExtensions()}]]></item>
<item name="wcf.attachment.insert"><![CDATA[Insert into message]]></item>