Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2bcfd8e
make it possible to update shipped apps via the appstore
georgehrke May 21, 2014
c8636ca
Merge branch 'master' into update_shipped_apps_from_appstore
georgehrke May 31, 2014
020255b
add button for properly uninstalling apps
georgehrke May 31, 2014
c6dc9ae
Merge branch 'master' into update_shipped_apps_from_appstore
georgehrke May 31, 2014
c8a8c7e
read ocsid from shipped apps on install
georgehrke May 31, 2014
eea501b
various fixes as requested by pr reviewers
georgehrke Jun 2, 2014
19129b3
use isset() instead of array_key_exists()
georgehrke Jun 3, 2014
56a8010
remove console.log in apps.js
georgehrke Jun 4, 2014
2c00ab1
update autoloader
georgehrke Jun 4, 2014
724d027
add unit test
georgehrke Jun 4, 2014
00b7f36
remove not needed unlink in installer test
georgehrke Jun 4, 2014
6aab50f
fix unit tests
DeepDiver1975 Jun 5, 2014
fad3bd7
reenable checkCode()
DeepDiver1975 Jun 5, 2014
0fe8f77
Merge branch 'master' into update_shipped_apps_from_appstore
georgehrke Jun 5, 2014
498aa66
add additional type check
georgehrke Jun 6, 2014
a110973
some additional type checks
georgehrke Jun 6, 2014
1ab9bdc
remove unnecessary @return
georgehrke Jun 10, 2014
5d4f3ba
fix php doc block
georgehrke Jun 10, 2014
6bf0689
always return a bool in OC_App::updateApp
georgehrke Jun 10, 2014
602404c
fix php doc block
georgehrke Jun 10, 2014
5e9fa64
don't show update button when appstore is disabled or no writable dir…
georgehrke Jun 10, 2014
0890ce4
Update preseed-config.php
georgehrke Jun 12, 2014
c378e76
skip certain tests for shipped apps
georgehrke Jun 13, 2014
65028c4
don't skip code check for skipped apps
georgehrke Jun 13, 2014
86f546f
disable code check for shipped apps
georgehrke Jun 16, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
skip certain tests for shipped apps
  • Loading branch information
georgehrke committed Jun 13, 2014
commit c378e76412fb0bfa52a4dd9e3fc500c6d492cd46
16 changes: 10 additions & 6 deletions lib/private/installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ public static function isInstalled( $app ) {

/**
* @brief Update an application
* @param array $info
* @param bool $isShipped
*
* This function installs an app. All information needed are passed in the
* associative array $data.
Expand All @@ -164,9 +166,9 @@ public static function isInstalled( $app ) {
* upgrade.php can determine the current installed version of the app using
* "OC_Appconfig::getValue($appid, 'installed_version')"
*/
public static function updateApp( $info=array() ) {
public static function updateApp( $info=array(), $isShipped=false) {
list($extractDir, $path) = self::downloadApp($info);
$info = self::checkAppsIntegrity($info, $extractDir, $path);
$info = self::checkAppsIntegrity($info, $extractDir, $path, $isShipped);

$currentDir = OC_App::getAppPath($info['id']);
$basedir = OC_App::getInstallPath();
Expand Down Expand Up @@ -195,10 +197,11 @@ public static function updateApp( $info=array() ) {
/**
* update an app by it's id
* @param integer $ocsid
* @param bool $isShipped
* @return bool
* @throws Exception
*/
public static function updateAppByOCSId($ocsid) {
public static function updateAppByOCSId($ocsid, $isShipped=false) {
$appdata = OC_OCSClient::getApplication($ocsid);
$download = OC_OCSClient::getApplicationDownload($ocsid, 1);

Expand Down Expand Up @@ -278,10 +281,11 @@ public static function downloadApp($data = array()) {
* check an app's integrity
* @param array $data
* @param string $extractDir
* @param bool $isShipped
* @return array
* @throws \Exception
*/
public static function checkAppsIntegrity($data = array(), $extractDir, $path) {
public static function checkAppsIntegrity($data = array(), $extractDir, $path, $isShipped=false) {
$l = \OC_L10N::get('lib');
//load the info.xml file of the app
if(!is_file($extractDir.'/appinfo/info.xml')) {
Expand All @@ -306,7 +310,7 @@ public static function checkAppsIntegrity($data = array(), $extractDir, $path) {
}
$info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true);
// check the code for not allowed calls
if(!OC_Installer::checkCode($info['id'], $extractDir)) {
if(!$isShipped && !OC_Installer::checkCode($info['id'], $extractDir)) {
OC_Helper::rmdirr($extractDir);
throw new \Exception($l->t("App can't be installed because of not allowed code in the App"));
}
Expand All @@ -318,7 +322,7 @@ public static function checkAppsIntegrity($data = array(), $extractDir, $path) {
}

// check if shipped tag is set which is only allowed for apps that are shipped with ownCloud
if(isset($info['shipped']) and ($info['shipped']=='true')) {
if(!$isShipped && isset($info['shipped']) && ($info['shipped']=='true')) {
OC_Helper::rmdirr($extractDir);
throw new \Exception($l->t("App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps"));
}
Expand Down
5 changes: 4 additions & 1 deletion settings/ajax/updateapp.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,21 @@

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);

$result = OC_Installer::updateAppByOCSId($appId);
$result = OC_Installer::updateAppByOCSId($appId, $isShipped);
if($result !== false) {
OC_JSON::success(array('data' => array('appid' => $appId)));
} else {
Expand Down