aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-28 21:02:27 -0700
committerredmatrix <git@macgirvin.com>2016-04-28 21:02:27 -0700
commitbb96f44861c66e9eb334e18e4b4b659685433008 (patch)
tree1f1d7b789829502c61a8a3defbecf37bc4a5dba9 /Zotlabs
parent30a6ae3daa42da8d1d9560fcc4c706b3e41c4d80 (diff)
downloadvolse-hubzilla-bb96f44861c66e9eb334e18e4b4b659685433008.tar.gz
volse-hubzilla-bb96f44861c66e9eb334e18e4b4b659685433008.tar.bz2
volse-hubzilla-bb96f44861c66e9eb334e18e4b4b659685433008.zip
allow engineering units (e.g. 400M, 1G) as service class limits
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Extend/Hook.php4
-rw-r--r--Zotlabs/Module/Item.php4
-rw-r--r--Zotlabs/Module/Photos.php2
-rw-r--r--Zotlabs/Storage/Browser.php2
-rw-r--r--Zotlabs/Storage/Directory.php6
-rw-r--r--Zotlabs/Storage/File.php4
6 files changed, 11 insertions, 11 deletions
diff --git a/Zotlabs/Extend/Hook.php b/Zotlabs/Extend/Hook.php
index d95defc43..713165faf 100644
--- a/Zotlabs/Extend/Hook.php
+++ b/Zotlabs/Extend/Hook.php
@@ -26,7 +26,7 @@ class Hook {
$r = q("DELETE FROM `hook` where `hook` = '%s' and `file` = '%s' and `function` = '%s'",
dbesc($hook),
dbesc($file),
- dbesc($function),
+ dbesc($function)
);
$r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )",
@@ -61,7 +61,7 @@ class Hook {
static public function unregister_by_file($file) {
$r = q("DELETE FROM hook WHERE `file` = '%s' ",
- dbesc($file),
+ dbesc($file)
);
return $r;
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 74fbeed67..93570fdec 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -1243,14 +1243,14 @@ class Item extends \Zotlabs\Web\Controller {
}
if (!$iswebpage) {
- $max = service_class_fetch($channel_id,'total_items');
+ $max = engr_units_to_bytes(service_class_fetch($channel_id,'total_items'));
if(! service_class_allows($channel_id,'total_items',$r[0]['total'])) {
$result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f top level posts.'),$max);
return $result;
}
}
else {
- $max = service_class_fetch($channel_id,'total_pages');
+ $max = engr_units_to_bytes(service_class_fetch($channel_id,'total_pages'));
if(! service_class_allows($channel_id,'total_pages',$r[0]['total'])) {
$result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f webpages.'),$max);
return $result;
diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php
index ce350666f..15a1f4d9c 100644
--- a/Zotlabs/Module/Photos.php
+++ b/Zotlabs/Module/Photos.php
@@ -615,7 +615,7 @@ class Photos extends \Zotlabs\Web\Controller {
);
- $limit = service_class_fetch(\App::$data['channel']['channel_id'],'photo_upload_limit');
+ $limit = engr_units_to_bytes(service_class_fetch(\App::$data['channel']['channel_id'],'photo_upload_limit'));
if($limit !== false) {
$usage_message = sprintf( t("%1$.2f MB of %2$.2f MB photo storage used."), $r[0]['total'] / 1024000, $limit / 1024000 );
}
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index 720940953..c75ebe41f 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -273,7 +273,7 @@ class Browser extends DAV\Browser\Plugin {
return;
// Storage and quota for the account (all channels of the owner of this directory)!
- $limit = service_class_fetch($owner, 'attach_upload_limit');
+ $limit = engr_units_to_bytes(service_class_fetch($owner, 'attach_upload_limit'));
$r = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d",
intval($this->auth->channel_account_id)
);
diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php
index edbef5a95..3c0cff6ef 100644
--- a/Zotlabs/Storage/Directory.php
+++ b/Zotlabs/Storage/Directory.php
@@ -315,13 +315,13 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
}
// check against service class quota
- $limit = service_class_fetch($c[0]['channel_id'], 'attach_upload_limit');
+ $limit = engr_units_to_bytes(service_class_fetch($c[0]['channel_id'], 'attach_upload_limit'));
if ($limit !== false) {
$x = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d ",
intval($c[0]['channel_account_id'])
);
if (($x) && ($x[0]['total'] + $size > $limit)) {
- logger('service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . $limit);
+ logger('service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . userReadableSize($limit));
attach_delete($c[0]['channel_id'], $hash);
return;
}
@@ -549,7 +549,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
intval($this->auth->owner_id)
);
- $ulimit = service_class_fetch($c[0]['channel_id'], 'attach_upload_limit');
+ $ulimit = engr_units_to_bytes(service_class_fetch($c[0]['channel_id'], 'attach_upload_limit'));
$limit = (($ulimit) ? $ulimit : $limit);
$x = q("select sum(filesize) as total from attach where aid = %d",
diff --git a/Zotlabs/Storage/File.php b/Zotlabs/Storage/File.php
index 897f24edd..d40fee0ea 100644
--- a/Zotlabs/Storage/File.php
+++ b/Zotlabs/Storage/File.php
@@ -208,13 +208,13 @@ class File extends DAV\Node implements DAV\IFile {
return;
}
- $limit = service_class_fetch($c[0]['channel_id'], 'attach_upload_limit');
+ $limit = engr_units_to_bytes(service_class_fetch($c[0]['channel_id'], 'attach_upload_limit'));
if ($limit !== false) {
$x = q("select sum(filesize) as total from attach where aid = %d ",
intval($c[0]['channel_account_id'])
);
if (($x) && ($x[0]['total'] + $size > $limit)) {
- logger('service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . $limit);
+ logger('service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . userReadableSize($limit));
attach_delete($c[0]['channel_id'], $this->data['hash']);
return;
}