[Pkg-owncloud-commits] [owncloud] 06/223: various fixes as requested by pr reviewers

David Prévot taffit at moszumanska.debian.org
Sun Jun 22 01:53:58 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit eea501b847f2a4b6a8b29d4d2ded7ef86a841f42
Author: Georg Ehrke <developer at georgehrke.com>
Date:   Mon Jun 2 21:37:39 2014 +0200

    various fixes as requested by pr reviewers
---
 lib/private/app.php            | 36 ++++++++++++++++--------------------
 lib/private/installer.php      |  4 ++--
 settings/ajax/disableapp.php   |  4 ++--
 settings/ajax/installapp.php   |  3 +--
 settings/ajax/uninstallapp.php |  3 +--
 5 files changed, 22 insertions(+), 28 deletions(-)

diff --git a/lib/private/app.php b/lib/private/app.php
index 0e2c023..5e32717 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -462,11 +462,10 @@ class OC_App{
 			}
 		}
 
-		if (count($possibleApps) === 0) {
+		if (empty($possibleApps)) {
 			return false;
 		} elseif(count($possibleApps) === 1) {
-			reset($possibleApps);
-			$dir = current($possibleApps);
+			$dir = array_shift($possibleApps);
 			$app_dir[$appId] = $dir;
 			return $dir;
 		} else {
@@ -486,7 +485,6 @@ class OC_App{
 		}
 	}
 
-
 	/**
 	 * Get the directory for the given app.
 	 * If the app is defined in multiple directories, the first one is taken. (false if not found)
@@ -511,7 +509,6 @@ class OC_App{
 		return is_writable($path);
 	}
 
-
 	/**
 	 * Get the path for the given app on the access
 	 * If the app is defined in multiple directories, the first one is taken. (false if not found)
@@ -535,7 +532,6 @@ class OC_App{
 		return self::getAppVersionByPath($file);
 	}
 
-
 	/**
 	 * get app's version based on it's path
 	 * @param string $path
@@ -544,8 +540,8 @@ class OC_App{
 	public static function getAppVersionByPath($path) {
 		$versionFile = $path . '/appinfo/version';
 		$infoFile = $path . '/appinfo/info.xml';
-		if(is_file($versionFile) && $version = trim(file_get_contents($versionFile))) {
-			return $version;
+		if(is_file($versionFile)) {
+			return trim(file_get_contents($versionFile));
 		}else{
 			$appData=self::getAppInfo($infoFile, true);
 			return isset($appData['version'])? $appData['version'] : '';
@@ -884,27 +880,27 @@ class OC_App{
 
 
 				// rating img
-				if ($app['score'] >= 0 && $app['score'] < 5) {
+				if ($app['score'] < 5) {
 					$img = OC_Helper::imagePath( "core", "rating/s1.png" );
-				} elseif ($app['score'] >= 5 && $app['score'] < 15) {
+				} elseif ($app['score'] < 15) {
 					$img = OC_Helper::imagePath( "core", "rating/s2.png" );
-				} elseif($app['score'] >= 15 && $app['score'] < 25) {
+				} elseif($app['score'] < 25) {
 					$img = OC_Helper::imagePath( "core", "rating/s3.png" );
-				} elseif($app['score'] >= 25 && $app['score'] < 35) {
+				} elseif($app['score'] < 35) {
 					$img = OC_Helper::imagePath( "core", "rating/s4.png" );
-				} elseif($app['score'] >= 35 && $app['score'] < 45) {
+				} elseif($app['score'] < 45) {
 					$img = OC_Helper::imagePath( "core", "rating/s5.png" );
-				} elseif($app['score'] >= 45 && $app['score'] < 55) {
+				} elseif($app['score'] < 55) {
 					$img = OC_Helper::imagePath( "core", "rating/s6.png" );
-				} elseif($app['score'] >= 55 && $app['score'] < 65) {
+				} elseif($app['score'] < 65) {
 					$img = OC_Helper::imagePath( "core", "rating/s7.png" );
-				} elseif($app['score'] >= 65 && $app['score'] < 75) {
+				} elseif($app['score'] < 75) {
 					$img = OC_Helper::imagePath( "core", "rating/s8.png" );
-				} elseif($app['score'] >= 75 && $app['score'] < 85) {
+				} elseif($app['score'] < 85) {
 					$img = OC_Helper::imagePath( "core", "rating/s9.png" );
-				} elseif($app['score'] >= 85 && $app['score'] < 95) {
+				} elseif($app['score'] < 95) {
 					$img = OC_Helper::imagePath( "core", "rating/s10.png" );
-				} elseif($app['score'] >= 95 && $app['score'] < 100) {
+				} elseif($app['score'] < 100) {
 					$img = OC_Helper::imagePath( "core", "rating/s11.png" );
 				}
 
@@ -1102,7 +1098,7 @@ class OC_App{
 			$version=OC_Util::getVersion();
 			if(!self::isAppCompatible($version, $info)) {
 				throw new \Exception(
-					$l->t("App \"%s\" can't be installed because it is not compatible with this version of ownCloud.",
+					$l->t('App \"%s\" can\'t be installed because it is not compatible with this version of ownCloud.',
 						array($info['name'])
 					)
 				);
diff --git a/lib/private/installer.php b/lib/private/installer.php
index e2b8aec..df8c015 100644
--- a/lib/private/installer.php
+++ b/lib/private/installer.php
@@ -77,7 +77,7 @@ class OC_Installer{
 			throw new \Exception($l->t("App directory already exists"));
 		}
 
-		if(isset($data['pretent']) and $data['pretent']==true) {
+		if(!empty($data['pretent'])) {
 			return false;
 		}
 
@@ -176,7 +176,7 @@ class OC_Installer{
 				'appdata' => $appdata
 			);
 		} else {
-			throw new \Exception('Could fetch app info!');
+			throw new \Exception('Could not fetch app info!');
 		}
 
 		list($extractDir, $path) = self::downloadApp($info);
diff --git a/settings/ajax/disableapp.php b/settings/ajax/disableapp.php
index 263e2c2..c1e5bc8 100644
--- a/settings/ajax/disableapp.php
+++ b/settings/ajax/disableapp.php
@@ -1,5 +1,5 @@
 <?php
-OC_JSON::checkAdminUser();
+OCP\JSON::checkAdminUser();
 OCP\JSON::callCheck();
 
 if (!array_key_exists('appid', $_POST)) {
@@ -11,4 +11,4 @@ $appId = $_POST['appid'];
 $appId = OC_App::cleanAppId($appId);
 
 OC_App::disable($appId);
-OC_JSON::success();
\ No newline at end of file
+OC_JSON::success();
diff --git a/settings/ajax/installapp.php b/settings/ajax/installapp.php
index 960080d..47f40f2 100644
--- a/settings/ajax/installapp.php
+++ b/settings/ajax/installapp.php
@@ -1,6 +1,5 @@
 <?php
-
-OC_JSON::checkAdminUser();
+OCP\JSON::checkAdminUser();
 OCP\JSON::callCheck();
 
 if (!array_key_exists('appid', $_POST)) {
diff --git a/settings/ajax/uninstallapp.php b/settings/ajax/uninstallapp.php
index 1124157..5c6371d 100644
--- a/settings/ajax/uninstallapp.php
+++ b/settings/ajax/uninstallapp.php
@@ -1,6 +1,5 @@
 <?php
-
-OC_JSON::checkAdminUser();
+OCP\JSON::checkAdminUser();
 OCP\JSON::callCheck();
 
 if (!array_key_exists('appid', $_POST)) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list