Implement update functionality
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
5128f7ea30
commit
1a034ce699
|
@ -323,6 +323,7 @@ class AppManager implements IAppManager {
|
|||
public function clearAppsCache() {
|
||||
$settingsMemCache = $this->memCacheFactory->createDistributed('settings');
|
||||
$settingsMemCache->clear('listApps');
|
||||
$this->appInfos = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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']);
|
||||
|
||||
|
|
|
@ -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}`))
|
||||
|
|
Loading…
Reference in New Issue