aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2024-03-24 09:58:21 +0000
committerMario <mario@mariovavti.com>2024-03-24 09:58:21 +0000
commit0dc959d9fe40bddce5e99b8162bb0e770fc28ed9 (patch)
tree4ad4413b0c00d1a478111b031d9de46218f31a89 /util
parentacc1834b0dc4804703610101fa95a3375649bc45 (diff)
downloadvolse-hubzilla-0dc959d9fe40bddce5e99b8162bb0e770fc28ed9.tar.gz
volse-hubzilla-0dc959d9fe40bddce5e99b8162bb0e770fc28ed9.tar.bz2
volse-hubzilla-0dc959d9fe40bddce5e99b8162bb0e770fc28ed9.zip
Deprecate *_config() functions in core.
Diffstat (limited to 'util')
-rwxr-xr-xutil/addons20
-rwxr-xr-xutil/config17
-rwxr-xr-xutil/db_update.php4
-rwxr-xr-xutil/service_class34
-rwxr-xr-xutil/storageconv21
5 files changed, 52 insertions, 44 deletions
diff --git a/util/addons b/util/addons
index 7bd70984e..f700dfcf7 100755
--- a/util/addons
+++ b/util/addons
@@ -19,7 +19,9 @@ require_once('include/cli_startup.php');
cli_startup();
- $plugs = get_config('system', 'addon');
+use Zotlabs\Lib\Config;
+
+ $plugs = Config::Get('system', 'addon');
$plugins_arr = array();
if($plugs)
@@ -42,7 +44,7 @@ cli_startup();
if ($idz !== false) {
unset(App::$plugins[$idz]);
uninstall_plugin($id);
- set_config("system","addon", implode(", ",App::$plugins));
+ Config::Set("system","addon", implode(", ",App::$plugins));
}
}
$info['disabled'] = 1-intval($x);
@@ -65,7 +67,7 @@ if($argc == 2 && $argv[1] === 'list') {
echo $p[0] . "\n";
}
}
- }
+ }
killme();
}
@@ -89,7 +91,7 @@ if($argc == 3 && $argv[1] === 'list' && $argv[2] === 'all') {
foreach($plugins as $p) {
echo $p[0] . (($p[1]) ? $p[1] : (($p[2]['disabled']) ? '!' : '')) . "\n";
}
- }
+ }
killme();
}
@@ -107,12 +109,12 @@ if($argc == 3 && $argv[1] === 'install') {
else {
App::$plugins[] = $p[0];
install_plugin($p[0]);
- set_config("system","addon", implode(", ",App::$plugins));
+ Config::Set("system","addon", implode(", ",App::$plugins));
echo $p[0] . ' installed.' . "\n";
}
}
}
- }
+ }
killme();
}
@@ -136,12 +138,12 @@ if($argc == 3 && $argv[1] === 'uninstall') {
if ($idx !== false)
unset(App::$plugins[$idx]);
uninstall_plugin($p[0]);
- set_config("system","addon", implode(", ",App::$plugins));
+ Config::Set("system","addon", implode(", ",App::$plugins));
echo $p[0] . ' uninstalled.' . "\n";
}
}
}
- }
+ }
// force uninstall of addon which no longer exists
@@ -150,7 +152,7 @@ if($argc == 3 && $argv[1] === 'uninstall') {
if ($idx !== false)
unset(App::$plugins[$idx]);
uninstall_plugin($argv[2]);
- set_config("system","addon", implode(", ",App::$plugins));
+ Config::Set("system","addon", implode(", ",App::$plugins));
echo $argv[2] . ' uninstalled.' . "\n";
}
diff --git a/util/config b/util/config
index cfe4500b5..c0f51b3fb 100755
--- a/util/config
+++ b/util/config
@@ -12,13 +12,14 @@ require_once('include/cli_startup.php');
cli_startup();
+use Zotlabs\Lib\Config;
$helpArgs = getopt('h', array('help'));
if (count($helpArgs) === 1) {
echo <<<'EndOfOutput'
Gets, sets, or lists site-wide configuration settings.
-Usage: util/config
+Usage: util/config
util/config <family>
util/config <family> <key>
util/config <family> <key> <value>
@@ -36,8 +37,8 @@ Usage: util/config
Set config entry for specified family and key to value and display result
Notes:
- Setting config entries which are manually set in .htconfig.php may result
- in conflict between database settings and the manual startup settings.
+ Setting config entries which are manually set in .htconfig.php may result
+ in conflict between database settings and the manual startup settings.
For channel-specific configuration settings, use util/pconfig
@@ -55,16 +56,16 @@ if($argc > 1 && strpos($argv[1],'.')) {
}
if($argc > 3) {
- set_config($argv[1],$argv[2],$argv[3]);
- echo "config[{$argv[1]}][{$argv[2]}] = " . printable_config(get_config($argv[1],$argv[2])) . "\n";
+ Config::Set($argv[1],$argv[2],$argv[3]);
+ echo "config[{$argv[1]}][{$argv[2]}] = " . printable_config(Config::Get($argv[1],$argv[2])) . "\n";
}
if($argc == 3) {
- echo "config[{$argv[1]}][{$argv[2]}] = " . printable_config(get_config($argv[1],$argv[2])) . "\n";
+ echo "config[{$argv[1]}][{$argv[2]}] = " . printable_config(Config::Get($argv[1],$argv[2])) . "\n";
}
if($argc == 2) {
- load_config($argv[1]);
+ Config::Load($argv[1]);
foreach(App::$config[$argv[1]] as $k => $x) {
echo "config[{$argv[1]}][{$k}] = " . $x . "\n";
}
@@ -89,4 +90,4 @@ function printable_config($x) {
}
else
return $x;
-} \ No newline at end of file
+}
diff --git a/util/db_update.php b/util/db_update.php
index 8fc7c7616..d74dc6ca3 100755
--- a/util/db_update.php
+++ b/util/db_update.php
@@ -9,7 +9,9 @@ require_once('boot.php');
require_once('include/cli_startup.php');
cli_startup();
-$build = get_config('system','db_version');
+use Zotlabs\Lib\Config;
+
+$build = Config::Get('system','db_version');
echo "Old DB VERSION: " . $build . "\n";
echo "New DB VERSION: " . DB_UPDATE_VERSION . "\n";
diff --git a/util/service_class b/util/service_class
index b8a1f2386..afad4c709 100755
--- a/util/service_class
+++ b/util/service_class
@@ -7,10 +7,12 @@ require_once('include/cli_startup.php');
cli_startup();
+use Zotlabs\Lib\Config;
+
if($argc > 3) {
- $d = get_config('service_class', $argv[1]);
+ $d = Config::Get('service_class', $argv[1]);
$d[$argv[2]] = $argv[3];
- set_config('service_class', $argv[1], $d);
+ Config::Set('service_class', $argv[1], $d);
echo 'Updated service class "' . $argv[1] . '" service "' . $argv[2] . '" to ' . $argv[3] . "\n";
}
@@ -24,7 +26,7 @@ if($argc == 3) {
);
if(!$r)
die('could not find channel');
-
+
$acct = intval($r[0]['channel_account_id']);
} else {
exit();
@@ -34,28 +36,28 @@ if($argc == 3) {
);
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);
+ $old = Config::Get('service_class', $oclass);
}
echo "service_class $oclass\t\t\033[1m" . $argv[2] . "\033[0m\n";
-
- $new = get_config('service_class', $argv[2]);
+
+ $new = Config::Get('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','access_tokens') 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";
}
@@ -67,7 +69,7 @@ if($argc == 3) {
}
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)
@@ -77,11 +79,11 @@ if($argc == 3) {
} else {
echo "failed\n";
}
-}
+}
if($argc == 2) {
- $d = get_config('service_class', $argv[1]);
+ $d = Config::Get('service_class', $argv[1]);
echo $argv[1] . ":\n";
foreach($d as $k => $v) {
echo "$k = $v\n";
@@ -89,7 +91,7 @@ if($argc == 2) {
}
if($argc == 1) {
- load_config('service_class');
+ Config::Load('service_class');
if(is_array(App::$config['service_class']) && App::$config['service_class']) {
foreach(App::$config['service_class'] as $class=>$props) {
echo "$class:\n";
@@ -106,4 +108,4 @@ if($argc == 1) {
}
}
}
-} \ No newline at end of file
+}
diff --git a/util/storageconv b/util/storageconv
index 676425038..fe12137a3 100755
--- a/util/storageconv
+++ b/util/storageconv
@@ -18,6 +18,7 @@ require_once('include/cli_startup.php');
cli_startup();
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Hashpath;
if($argc == 1) {
@@ -26,8 +27,8 @@ if($argc == 1) {
}
if($argc == 2) {
-
- $storage = (intval(get_config('system','photo_storage_type', 1)) > 0 ? 1 : 0);
+
+ $storage = (intval(Config::Get('system','photo_storage_type', 1)) > 0 ? 1 : 0);
echo 'Current storage set to: ' . ($storage ? 'filesystem' : 'SQL database') . PHP_EOL;
switch($argv[1]) {
case 'stats':
@@ -38,14 +39,14 @@ if($argc == 2) {
$xx = intval($x[0]['qty']);
$x = q("SELECT COUNT(resource_id) AS qty FROM photo WHERE photo_usage IN (1, 2)");
echo 'Imported profiles thumbnails: ' . $x[0]['qty'] . PHP_EOL;
- $xx += intval($x[0]['qty']);
+ $xx += intval($x[0]['qty']);
echo 'Thumbnails total: ' . $xx . PHP_EOL;
$x = q("SELECT COUNT(id) AS qty FROM photo WHERE os_storage != %d AND imgscale > 0",
$storage
);
echo 'Thumbnails to convert: ' . $x[0]['qty'] . PHP_EOL;
break;
-
+
case 'fs':
if($storage == 0) {
echo 'Please set system.photo_storage_type to 1 before move thumbnails to filesystem storage' . PHP_EOL;
@@ -101,7 +102,7 @@ if($argc == 2) {
}
echo $i . PHP_EOL . 'Total thumbnails processed: ' . $i;
break;
-
+
case 'db':
if($storage == 1) {
echo 'Please set system.photo_storage_type to 0 before move thumbnails to SQL database storage' . PHP_EOL;
@@ -119,15 +120,15 @@ if($argc == 2) {
$x = q("SELECT id, uid, resource_id, content, imgscale FROM photo WHERE id > %d AND os_storage = 1 AND imgscale > 0 ORDER BY id LIMIT 10",
intval($cur_id)
);
-
+
if($x) {
foreach($x as $xx) {
-
+
$filename = dbunescbin($xx['content']);
$content = file_get_contents($filename);
if($content) {
-
+
$z = q("UPDATE photo SET content = '%s', os_storage = 0 WHERE id = %d",
dbescbin($content),
intval($xx['id'])
@@ -136,7 +137,7 @@ if($argc == 2) {
echo PHP_EOL . 'Failed to update stored file metadata ' . $filename . PHP_EOL;
continue;
}
-
+
@unlink($filename);
}
else
@@ -152,7 +153,7 @@ if($argc == 2) {
}
echo $i . PHP_EOL . 'Total files processed: ' . $i;
break;
-
+
default:
usage();
return;