display app update error messages - fixes #14611

This commit is contained in:
Thomas Müller 2015-03-11 09:59:56 +01:00
parent cfaee93552
commit ffe06ac5c7
2 changed files with 12 additions and 7 deletions

View File

@ -202,20 +202,21 @@ class OC_Installer{
/** /**
* update an app by it's id * update an app by it's id
* @param integer $ocsid *
* @param integer $ocsId
* @return bool * @return bool
* @throws Exception * @throws Exception
*/ */
public static function updateAppByOCSId($ocsid) { public static function updateAppByOCSId($ocsId) {
$appdata = OCSClient::getApplication($ocsid); $appData = OCSClient::getApplication($ocsId);
$download = OCSClient::getApplicationDownload($ocsid, 1); $download = OCSClient::getApplicationDownload($ocsId, 1);
if (isset($download['downloadlink']) && trim($download['downloadlink']) !== '') { if (isset($download['downloadlink']) && trim($download['downloadlink']) !== '') {
$download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']); $download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']);
$info = array( $info = array(
'source' => 'http', 'source' => 'http',
'href' => $download['downloadlink'], 'href' => $download['downloadlink'],
'appdata' => $appdata 'appdata' => $appData
); );
} else { } else {
throw new \Exception('Could not fetch app info!'); throw new \Exception('Could not fetch app info!');
@ -285,7 +286,7 @@ class OC_Installer{
* @return array * @return array
* @throws \Exception * @throws \Exception
*/ */
public static function checkAppsIntegrity($data = array(), $extractDir, $path, $isShipped=false) { public static function checkAppsIntegrity($data, $extractDir, $path, $isShipped=false) {
$l = \OC::$server->getL10N('lib'); $l = \OC::$server->getL10N('lib');
//load the info.xml file of the app //load the info.xml file of the app
if(!is_file($extractDir.'/appinfo/info.xml')) { if(!is_file($extractDir.'/appinfo/info.xml')) {

View File

@ -235,7 +235,11 @@ OC.Settings.Apps = OC.Settings.Apps || {
OC.Settings.Apps.hideErrorMessage(appId); OC.Settings.Apps.hideErrorMessage(appId);
$.post(OC.filePath('settings','ajax','updateapp.php'),{appid:appId},function(result) { $.post(OC.filePath('settings','ajax','updateapp.php'),{appid:appId},function(result) {
if(!result || result.status !== 'success') { if(!result || result.status !== 'success') {
if (result.data && result.data.message) {
OC.Settings.Apps.showErrorMessage(appId, result.data.message);
} else {
OC.Settings.Apps.showErrorMessage(appId, t('settings','Error while updating app')); OC.Settings.Apps.showErrorMessage(appId, t('settings','Error while updating app'));
}
element.val(oldButtonText); element.val(oldButtonText);
} }
else { else {