Blame view
sources/settings/ajax/updateapp.php
1.03 KB
|
03e52840d
|
1 |
<?php |
|
6d9380f96
|
2 3 4 5 6 7 8 |
/** * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ OCP\JSON::checkAdminUser(); |
|
03e52840d
|
9 |
OCP\JSON::callCheck(); |
|
6d9380f96
|
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
if (!array_key_exists('appid', $_POST)) {
OCP\JSON::error(array(
'message' => 'No AppId given!'
));
exit;
}
$appId = $_POST['appid'];
if (!is_numeric($appId)) {
$appId = OC_Appconfig::getValue($appId, 'ocsid', null);
$isShipped = OC_App::isShipped($appId);
if ($appId === null) {
OCP\JSON::error(array(
'message' => 'No OCS-ID found for app!'
));
exit;
}
} else {
$isShipped = false;
}
$appId = OC_App::cleanAppId($appId);
|
|
03e52840d
|
34 |
|
|
f7d878ff1
|
35 |
\OC_Config::setValue('maintenance', true);
|
|
6d9380f96
|
36 |
$result = OC_Installer::updateAppByOCSId($appId, $isShipped); |
|
f7d878ff1
|
37 |
\OC_Config::setValue('maintenance', false);
|
|
03e52840d
|
38 |
if($result !== false) {
|
|
6d9380f96
|
39 |
OC_JSON::success(array('data' => array('appid' => $appId)));
|
|
03e52840d
|
40 |
} else {
|
|
6d9380f96
|
41 |
$l = OC_L10N::get('settings');
|
|
03e52840d
|
42 |
OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't update app.") )));
|
|
31b7f2792
|
43 |
} |