Exemple #1
0
 public function testUpdateApp()
 {
     $pathOfOldTestApp = __DIR__;
     $pathOfOldTestApp .= '/../data/';
     $pathOfOldTestApp .= 'testapp.zip';
     $oldTmp = \OC::$server->getTempManager()->getTemporaryFile('.zip');
     OC_Helper::copyr($pathOfOldTestApp, $oldTmp);
     $oldData = array('path' => $oldTmp, 'source' => 'path', 'appdata' => ['id' => 'Bar', 'level' => 100]);
     $pathOfNewTestApp = __DIR__;
     $pathOfNewTestApp .= '/../data/';
     $pathOfNewTestApp .= 'testapp2.zip';
     $newTmp = \OC::$server->getTempManager()->getTemporaryFile('.zip');
     OC_Helper::copyr($pathOfNewTestApp, $newTmp);
     $newData = array('path' => $newTmp, 'source' => 'path', 'appdata' => ['id' => 'Bar', 'level' => 100]);
     OC_Installer::installApp($oldData);
     $oldVersionNumber = OC_App::getAppVersion(self::$appid);
     OC_Installer::updateApp($newData);
     $newVersionNumber = OC_App::getAppVersion(self::$appid);
     $this->assertNotEquals($oldVersionNumber, $newVersionNumber);
 }
Exemple #2
0
 public function testUpdateApp()
 {
     $pathOfOldTestApp = __DIR__;
     $pathOfOldTestApp .= '/../data/';
     $pathOfOldTestApp .= 'testapp.zip';
     $oldTmp = OC_Helper::tmpFile('.zip');
     OC_Helper::copyr($pathOfOldTestApp, $oldTmp);
     $oldData = array('path' => $oldTmp, 'source' => 'path');
     $pathOfNewTestApp = __DIR__;
     $pathOfNewTestApp .= '/../data/';
     $pathOfNewTestApp .= 'testapp2.zip';
     $newTmp = OC_Helper::tmpFile('.zip');
     OC_Helper::copyr($pathOfNewTestApp, $newTmp);
     $newData = array('path' => $newTmp, 'source' => 'path');
     OC_Installer::installApp($oldData);
     $oldVersionNumber = OC_App::getAppVersion(self::$appid);
     OC_Installer::updateApp($newData);
     $newVersionNumber = OC_App::getAppVersion(self::$appid);
     $this->assertNotEquals($oldVersionNumber, $newVersionNumber);
 }
Exemple #3
0
<?php

OC_JSON::checkAdminUser();
OCP\JSON::callCheck();
$appid = $_POST['appid'];
$appid = OC_App::cleanAppId($appid);
$result = OC_Installer::updateApp($appid);
if ($result !== false) {
    OC_JSON::success(array('data' => array('appid' => $appid)));
} else {
    $l = OC_L10N::get('settings');
    OC_JSON::error(array("data" => array("message" => $l->t("Couldn't update app."))));
}