aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/main.bb1
-rw-r--r--doc/service_classes.bb6
-rwxr-xr-xutil/service_class66
3 files changed, 73 insertions, 0 deletions
diff --git a/doc/main.bb b/doc/main.bb
index 8c28ccce2..1d323b918 100644
--- a/doc/main.bb
+++ b/doc/main.bb
@@ -44,6 +44,7 @@ Zot is the great new communicaton protocol invented especially for the $Projectn
[zrl=[baseurl]/help/troubleshooting]Troubleshooting Tips[/zrl]
[zrl=[baseurl]/help/hidden_configs]Tweaking $Projectname's Hidden Configurations[/zrl]
[zrl=[baseurl]/help/faq_admins]FAQ For Admins[/zrl]
+[zrl=[baseurl]/help/service_classes]Service Classes[/zrl]
[size=large][b]Technical Documentation[/b][/size]
[zrl=[baseurl]/help/history]$Projectname history[/zrl]
diff --git a/doc/service_classes.bb b/doc/service_classes.bb
index a36ec1021..e5d4ecfad 100644
--- a/doc/service_classes.bb
+++ b/doc/service_classes.bb
@@ -18,6 +18,12 @@ list the services that are part of 'firstclass' service class
[code]util/service_class firstclass photo_upload_limit 10000000[/code]
set firstclass total photo disk usage to 10 million bytes
+[code]util/service_class --account=5 firstclass[/code]
+set account id 5 to service class 'firstclass' (with confirmation)
+
+[code]util/service_class --channel=blogchan firstclass[/code]
+set the account that owns channel 'blogchan' to service class 'firstclass' (with confirmation)
+
[b]current limits[/b]
photo_upload_limit - maximum total bytes for photos
total_items - maximum total toplevel posts
diff --git a/util/service_class b/util/service_class
index e762d8ad6..a1a172518 100755
--- a/util/service_class
+++ b/util/service_class
@@ -14,6 +14,72 @@ if($argc > 3) {
echo 'Updated service class "' . $argv[1] . '" service "' . $argv[2] . '" to ' . $argv[3] . "\n";
}
+if($argc == 3) {
+ if(substr($argv[1], 0, 10) == '--account=') {
+ $acct = substr($argv[1], 10);
+ } else if(substr($argv[1], 0, 10) == '--channel=') {
+ $chan = substr($argv[1], 10);
+ $r = q("SELECT channel_account_id FROM channel WHERE channel_address='%s'",
+ dbesc($chan)
+ );
+ if(!$r)
+ die('could not find channel');
+
+ $acct = intval($r[0]['channel_account_id']);
+ } else {
+ exit();
+ }
+ $r = q('SELECT account_service_class FROM account WHERE account_id=%d',
+ intval($acct)
+ );
+ if(!$r)
+ die('could not find account');
+
+ $c = q('SELECT channel_address FROM channel WHERE channel_account_id=%d',
+ intval($acct)
+ );
+
+ echo "Account $acct: ";
+
+ foreach($c as $chan)
+ echo $chan['channel_address'] . ', ';
+
+ echo "\n\033[1mProperty Old\t\tNew\033[0m\n";
+
+ if(empty($r[0]['account_service_class'])) {
+ $oclass = 'None';
+ $old = false;
+ } else {
+ $oclass = $r[0]['account_service_class'];
+ $old = get_config('service_class', $oclass);
+ }
+ echo "service_class $oclass\t\t\033[1m" . $argv[2] . "\033[0m\n";
+
+ $new = get_config('service_class', $argv[2]);
+ foreach(array('photo_upload_limit','total_items','total_pages','total_identities','total_channels','total_feeds','attach_upload_limit','minimum_feedcheck_minutes','chatrooms','chatters_inroom') as $prop) {
+ echo $prop . str_repeat(' ',26 - strlen($prop)) . (($old && $old[$prop]) ? $old[$prop] : 'unlimited') . "\t\t\033[1m" . (($new && $new[$prop]) ? $new[$prop] : 'unlimited') . "\033[0m\n";
+ }
+ $r = '';
+ $k = fopen('php://stdin', 'r');
+ while($r != 'y' && $r != 'n') {
+ echo "Are you sure? (y/n)";
+ $r = substr(fgets($k), 0, 1);
+ }
+ if($r == 'n')
+ die('no update done');
+
+ $r = q("UPDATE account SET account_service_class='%s' WHERE account_id=%d",
+ dbesc($argv[2]),
+ intval($acct)
+ );
+ if($r) {
+ echo "updated successfully\n";
+ } else {
+ echo "failed\n";
+ }
+}
+
+
if($argc == 2) {
$d = get_config('service_class', $argv[1]);
echo $argv[1] . ":\n";