Implement update functionality

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2018-05-30 16:06:18 +02:00
parent 5128f7ea30
commit 1a034ce699
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
3 changed files with 27 additions and 0 deletions

View File

@ -323,6 +323,7 @@ class AppManager implements IAppManager {
public function clearAppsCache() {
$settingsMemCache = $this->memCacheFactory->createDistributed('settings');
$settingsMemCache->clear('listApps');
$this->appInfos = [];
}
/**

View File

@ -887,6 +887,7 @@ class OC_App {
}
self::registerAutoloading($appId, $appPath);
\OC::$server->getAppManager()->clearAppsCache();
$appData = self::getAppInfo($appId);
self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']);

View File

@ -99,6 +99,15 @@ const mutations = {
state.apps.find(app => app.id === appId).canInstall = true;
},
updateApp(state, appId) {
let app = state.apps.find(app => app.id === appId);
let version = app.update;
app.update = null;
app.version = version;
state.updateCount--;
},
resetApps(state) {
state.apps = [];
},
@ -246,6 +255,22 @@ const actions = {
}).catch((error) => context.commit('API_FAILURE', { appId, error }));
},
updateApp(context, { appId }) {
return api.requireAdmin().then((response) => {
context.commit('startLoading', appId);
return api.get(OC.generateUrl(`settings/apps/update/${appId}`))
.then((response) => {
context.commit('stopLoading', appId);
context.commit('updateApp', appId);
return true;
})
.catch((error) => {
context.commit('stopLoading', appId);
context.commit('APPS_API_FAILURE', { appId, error })
})
}).catch((error) => context.commit('API_FAILURE', { appId, error }));
},
getApps(context, { category }) {
context.commit('startLoading', 'list');
return api.get(OC.generateUrl(`settings/apps/list?category=${category}`))