]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge branch 'master' into fixing-998-master
authorThomas Mueller <thomas.mueller@tmit.eu>
Sun, 6 Jan 2013 11:18:21 +0000 (12:18 +0100)
committerThomas Mueller <thomas.mueller@tmit.eu>
Sun, 6 Jan 2013 11:18:21 +0000 (12:18 +0100)
Conflicts:
lib/helper.php

1  2 
lib/helper.php

diff --cc lib/helper.php
index c870536eb524ddffc761de39b14ef79544fd94b7,1aba2a3810025a857b5827aea6a52ff03c0454f4..4607b1b64362e158f856ef13c038955b3ace68ce
@@@ -759,22 -764,23 +764,42 @@@ class OC_Helper 
                return $str;
        }
  
+       /**
+        * Checks if a function is available
+        * @param string $function_name
+        * @return bool
+        */
+       public static function is_function_enabled($function_name) {
+               if (!function_exists($function_name)) {
+                       return false;
+               }
+               $disabled = explode(', ', ini_get('disable_functions'));
+               if (in_array($function_name, $disabled)) {
+                       return false;
+               }
+               $disabled = explode(', ', ini_get('suhosin.executor.func.blacklist'));
+               if (in_array($function_name, $disabled)) {
+                       return false;
+               }
+               return true;
+       }
++
 +      /**
 +       * Calculate the disc space
 +       */
 +      public static function getStorageInfo() {
 +              $rootInfo = OC_FileCache::get('');
 +              $used = $rootInfo['size'];
 +              if ($used < 0) {
 +                      $used = 0;
 +              }
 +              $free = OC_Filesystem::free_space();
 +              $total = $free + $used;
 +              if ($total == 0) {
 +                      $total = 1; // prevent division by zero
 +              }
 +              $relative = round(($used / $total) * 10000) / 100;
 +
 +              return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative);
 +      }
  }