mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 00:58:55 +01:00
removing vfs-context*.php early 21.1 vfs tests
This commit is contained in:
parent
ddda3b4165
commit
5165dd82e7
@ -1,68 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use EGroupware\Api;
|
|
||||||
use EGroupware\Api\Vfs;
|
|
||||||
|
|
||||||
$GLOBALS['egw_info'] = [
|
|
||||||
'flags' => [
|
|
||||||
'currentapp' => 'login',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
require_once __DIR__.'/header-default.inc.php';
|
|
||||||
$_SESSION = []; // reset session, specially cache for links
|
|
||||||
$egw->session->create($sysop='ralf', '', '', true, false);
|
|
||||||
|
|
||||||
$so = new infolog_so();
|
|
||||||
$so->delete(['info_id' => [1, 2]]);
|
|
||||||
$infolog_sysop = $so->write(['info_id' => 1, 'info_owner' => 5, 'info_subject' => 'Test-InfoLog Ralf', 'info_type' => 'task'], 0, null, true);
|
|
||||||
// anonymous user give not grants, has not shared groups with Ralf or sysop
|
|
||||||
$infolog_anon = $so->write(['info_id' => 2, 'info_owner' => ($anon=Api\Accounts::getInstance()->name2id('anonymous')), 'info_subject' => 'Test-InfoLog Anonymous', 'info_type' => 'task'], 0, null, true);
|
|
||||||
//var_dump($so->read(['info_id' => $infolog_sysop]), $so->read(['info_id' => $infolog_anon]));
|
|
||||||
// anonymous user needs infolog run rights for further tests
|
|
||||||
$acl = new Api\Acl($anon);
|
|
||||||
$acl->add_repository('infolog', 'run', $anon, 1);
|
|
||||||
|
|
||||||
$schema = 'stylite.links'; //'links';
|
|
||||||
Vfs::$is_root = true;
|
|
||||||
Vfs::mount("$schema://default/apps", '/apps', false, false);
|
|
||||||
Vfs::$is_root = false;
|
|
||||||
var_dump(Vfs::mount());
|
|
||||||
|
|
||||||
$infolog_sysop_dir = "/apps/infolog/$infolog_sysop";
|
|
||||||
$infolog_anon_dir = "/apps/infolog/$infolog_anon";
|
|
||||||
var_dump(file_put_contents("vfs://default$infolog_sysop_dir/test.txt", "Just a test ;)\n"));
|
|
||||||
var_dump("Vfs::proppatch('$infolog_sysop_dir/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])=" . array2string(Vfs::proppatch("$infolog_sysop_dir/test.txt", [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])),
|
|
||||||
"Vfs::propfind('$infolog_sysop_dir/test.txt')=" . json_encode(Vfs::propfind("$infolog_sysop_dir/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
|
|
||||||
var_dump($f = fopen("vfs://default$infolog_sysop_dir/test.txt", 'r'), fread($f, 100), fclose($f));
|
|
||||||
|
|
||||||
Vfs::$is_root = true;
|
|
||||||
var_dump(file_put_contents("vfs://default$infolog_anon_dir/test.txt", "Just a test ;)\n"));
|
|
||||||
var_dump("Vfs::proppatch('$infolog_anon_dir/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])=" . array2string(Vfs::proppatch("$infolog_anon_dir/test.txt", [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])),
|
|
||||||
"Vfs::propfind('$infolog_anon_dir/test.txt')=" . json_encode(Vfs::propfind("$infolog_anon_dir/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump(Vfs::mount(/*"$schema://anonymous@default$infolog_anon_dir"*/"vfs://anonymous@default$infolog_anon_dir", $share_dir = "/home/$sysop/anon-infolog", false, false));
|
|
||||||
Vfs::$is_root = false;
|
|
||||||
|
|
||||||
var_dump(Vfs::mount());
|
|
||||||
|
|
||||||
var_dump("Vfs::resolve_url('$share_dir/test.txt')=" . Vfs::resolve_url("$share_dir/test.txt"));
|
|
||||||
var_dump("Vfs::url_stat('$share_dir/test.txt')=" . json_encode(Vfs::stat("$share_dir/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::is_readable('$share_dir/test.txt')=" . json_encode(Vfs::is_readable("$share_dir/test.txt")));
|
|
||||||
var_dump("fopen('vfs://default$share_dir/test.txt', 'r')", $f = fopen("vfs://default$share_dir/test.txt", 'r'), fread($f, 100), fclose($f));
|
|
||||||
var_dump("Vfs::propfind('$share_dir/test.txt')", Vfs::propfind("$share_dir/test.txt"));
|
|
||||||
var_dump("Vfs::proppatch('$share_dir/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something else']])=" . array2string(Vfs::proppatch("$share_dir/test.txt", [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something else']])),
|
|
||||||
"Vfs::propfind('$share_dir/test.txt')=" . json_encode(Vfs::propfind("$share_dir/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
|
|
||||||
var_dump("Vfs::url_stat('$share_dir/test-dir')=" . json_encode(Vfs::stat("$share_dir/test-dir")));
|
|
||||||
var_dump("Vfs::mkdir('$share_dir/test-dir')=" . json_encode(Vfs::mkdir("$share_dir/test-dir")));
|
|
||||||
var_dump("Vfs::url_stat('$share_dir/test-dir')=" . json_encode(Vfs::stat("$share_dir/test-dir"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump(file_put_contents("vfs://default$share_dir/test-dir/test.txt", "Just a test ;)\n"));
|
|
||||||
var_dump("Vfs::url_stat('$share_dir/test-dir/test.txt')=" . json_encode(Vfs::stat("$share_dir/test-dir"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump(file_get_contents("vfs://default$share_dir/test-dir/test.txt"));
|
|
||||||
var_dump("Vfs::unlink('$share_dir/test-dir/test.txt')=" . json_encode(Vfs::unlink("$share_dir/test-dir/test.txt")));
|
|
||||||
var_dump("Vfs::rmdir('$share_dir/test-dir')=" . json_encode(Vfs::rmdir("$share_dir/test-dir")));
|
|
||||||
var_dump("Vfs::url_stat('$share_dir/test-dir')=" . json_encode(Vfs::stat("$share_dir/test-dir")));
|
|
||||||
|
|
||||||
var_dump("Vfs::scandir('$share_dir')=" . json_encode(Vfs::scandir($share_dir), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::remove('$share_dir/test.txt')=" . json_encode(Vfs::remove("$share_dir/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::scandir('$share_dir')=" . json_encode(Vfs::scandir($share_dir), JSON_UNESCAPED_SLASHES));
|
|
@ -1,72 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use EGroupware\Api;
|
|
||||||
use EGroupware\Api\Vfs;
|
|
||||||
|
|
||||||
$GLOBALS['egw_info'] = [
|
|
||||||
'flags' => [
|
|
||||||
'currentapp' => 'login',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
require_once __DIR__.'/header-default.inc.php';
|
|
||||||
|
|
||||||
$GLOBALS['egw_info']['user'] = [
|
|
||||||
'account_id' => 5,
|
|
||||||
'account_lid' => $sysop='ralf',
|
|
||||||
];
|
|
||||||
|
|
||||||
$other = 'birgit';
|
|
||||||
|
|
||||||
$schema = 'sqlfs';//'stylite.versioning'; //'sqlfs';
|
|
||||||
Vfs::$is_root = true;
|
|
||||||
Vfs::mount("$schema://default/home", '/home', false, false);
|
|
||||||
Vfs::$is_root = false;
|
|
||||||
var_dump(Vfs::mount());
|
|
||||||
//var_dump(Vfs::scandir('/home'));
|
|
||||||
//var_dump(Vfs::find('/home', ['maxdepth' => 1]));
|
|
||||||
//var_dump(Vfs::scandir("/home/$sysop"));
|
|
||||||
|
|
||||||
var_dump(file_put_contents("vfs://default/home/$sysop/test.txt", "Just a test ;)\n"));
|
|
||||||
var_dump("Vfs::proppatch('/home/$sysop/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])=".array2string(Vfs::proppatch("/home/$sysop/test.txt", [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])),
|
|
||||||
"Vfs::propfind('/home/$sysop/test.txt')=".json_encode(Vfs::propfind("/home/$sysop/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
|
|
||||||
var_dump($f=fopen("vfs://default/home/$sysop/test.txt", 'r'), fread($f, 100), fclose($f));
|
|
||||||
//var_dump(Vfs::find("/home/$sysop", ['maxdepth' => 1]));
|
|
||||||
|
|
||||||
Vfs::$is_root = true;
|
|
||||||
var_dump(file_put_contents("vfs://default/home/$other/test.txt", "Just a test ;)\n"));
|
|
||||||
var_dump("Vfs::proppatch('/home/$other/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])=".array2string(Vfs::proppatch("/home/$other/test.txt", [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])),
|
|
||||||
"Vfs::propfind('/home/$other/test.txt')=".json_encode(Vfs::propfind("/home/$other/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
$backup = Vfs::$user; Vfs::$user = Api\Accounts::getInstance()->name2id($other);
|
|
||||||
$share = stylite_sharing::create("/home/$other", stylite_sharing::WRITABLE, '', $sysop);
|
|
||||||
Vfs::$user = $backup;
|
|
||||||
var_dump($share);
|
|
||||||
var_dump(Vfs::mount($sharing_url="sharing://$share[share_token]@default/", "/home/$sysop/$other", false, false));
|
|
||||||
Vfs::$is_root = false;
|
|
||||||
|
|
||||||
var_dump(Vfs::mount());
|
|
||||||
|
|
||||||
var_dump(Vfs::load_wrapper('sharing'));
|
|
||||||
var_dump(stat($sharing_url.'test.txt'));
|
|
||||||
var_dump(file_get_contents($sharing_url.'test.txt'));
|
|
||||||
|
|
||||||
var_dump("Vfs::resolve_url('/home/$sysop/$other/test.txt')=".Vfs::resolve_url("/home/$sysop/$other/test.txt"));
|
|
||||||
var_dump("Vfs::stat('/home/$sysop/$other/test.txt')=".json_encode(Vfs::stat("/home/$sysop/$other/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::is_readable('/home/$sysop/$other/test.txt')=".json_encode(Vfs::is_readable("/home/$sysop/$other/test.txt")));
|
|
||||||
var_dump("fopen('vfs://default/home/$sysop/$other/test.txt', 'r')", $f=fopen("vfs://default/home/$sysop/$other/test.txt", 'r'), fread($f, 100), fclose($f));
|
|
||||||
|
|
||||||
var_dump("Vfs::propfind('/home/$sysop/$other/test.txt')", Vfs::propfind("/home/$sysop/$other/test.txt"));
|
|
||||||
var_dump("Vfs::proppatch('/home/$sysop/$other/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something else']])=".array2string(Vfs::proppatch("/home/$sysop/$other/test.txt", [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something else']])),
|
|
||||||
"Vfs::propfind('/home/$sysop/$other/test.txt')=".json_encode(Vfs::propfind("/home/$sysop/$other/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
|
|
||||||
var_dump("Vfs::url_stat('/home/$sysop/$other/test-dir')=".json_encode(Vfs::stat("/home/$sysop/$other/test-dir")));
|
|
||||||
var_dump("Vfs::mkdir('/home/$sysop/$other/test-dir')=".json_encode(Vfs::mkdir("/home/$sysop/$other/test-dir")));
|
|
||||||
var_dump("Vfs::scandir('/home/$sysop/$other')=".json_encode(Vfs::scandir("/home/$sysop/$other"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::stat('/home/$sysop/$other/test-dir')=".json_encode(Vfs::stat("/home/$sysop/$other/test-dir"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::rmdir('/home/$sysop/$other/test-dir')=".json_encode(Vfs::rmdir("/home/$sysop/$other/test-dir")));
|
|
||||||
var_dump("Vfs::stat('/home/$sysop/$other/test-dir')=".json_encode(Vfs::stat("/home/$sysop/$other/test-dir")));
|
|
||||||
var_dump("Vfs::remove('/home/$sysop/$other/test.txt')=".json_encode(Vfs::remove("/home/$sysop/$other/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::stat('/home/$sysop/$other/test.txt')=".json_encode(Vfs::stat("/home/$sysop/$other/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::scandir('/home/$sysop/$other')=".json_encode(Vfs::scandir("/home/$sysop/$other"), JSON_UNESCAPED_SLASHES));
|
|
||||||
|
|
||||||
stylite_sharing::delete($share['share_id']);
|
|
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use EGroupware\Api\Vfs;
|
|
||||||
use Grale\WebDav;
|
|
||||||
|
|
||||||
$GLOBALS['egw_info'] = [
|
|
||||||
'flags' => [
|
|
||||||
'currentapp' => 'login',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
require_once __DIR__.'/header-default.inc.php';
|
|
||||||
|
|
||||||
$GLOBALS['egw_info']['user'] = [
|
|
||||||
'account_id' => 5,
|
|
||||||
'account_lid' => $sysop='ralf',
|
|
||||||
];
|
|
||||||
|
|
||||||
$other = 'birgit';
|
|
||||||
|
|
||||||
WebDav\StreamWrapper::register();
|
|
||||||
|
|
||||||
var_dump(file_put_contents("vfs://default/home/$sysop/test.txt", "Just a test ;)\n"));
|
|
||||||
|
|
||||||
$base = "webdavs://$sysop:secret@boulder.egroupware.org/egroupware/webdav.php";
|
|
||||||
var_dump(scandir("$base/home"));
|
|
||||||
|
|
||||||
Vfs::$is_root = true;
|
|
||||||
Vfs::mount("$base/home/$sysop", "/home/$sysop/webdav", false, false);
|
|
||||||
Vfs::$is_root = false;
|
|
||||||
var_dump(Vfs::mount());
|
|
||||||
var_dump(Vfs::scandir("/home/$sysop/webdav"));
|
|
||||||
var_dump(file_get_contents("vfs://default/home/$sysop/webdav/test.txt"));
|
|
||||||
var_dump(Vfs::find("/home/$sysop/webdav", ['maxdepth' => 1], true));
|
|
||||||
//var_dump(Vfs::scandir("/home/$sysop"));
|
|
||||||
|
|
||||||
var_dump(scandir($share = "webdavs://pole.egroupware.org/egroupware/share.php/c2nqd6plwiTT8ha6U22sZXsLc7vkVdM3"));
|
|
||||||
Vfs::$is_root = true;
|
|
||||||
Vfs::mount("$share", "/home/$sysop/shares/PressRelease-20.1", false, false);
|
|
||||||
Vfs::$is_root = false;
|
|
||||||
var_dump(Vfs::find("/home/$sysop/shares/PressRelease-20.1", ['maxdepth' => 1], true));
|
|
@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use EGroupware\Api\Vfs;
|
|
||||||
|
|
||||||
$GLOBALS['egw_info'] = [
|
|
||||||
'flags' => [
|
|
||||||
'currentapp' => 'login',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
require_once __DIR__.'/header-default.inc.php';
|
|
||||||
|
|
||||||
$GLOBALS['egw_info']['user'] = [
|
|
||||||
'account_id' => 5,
|
|
||||||
'account_lid' => $sysop='ralf',
|
|
||||||
];
|
|
||||||
|
|
||||||
$other = 'birgit';
|
|
||||||
|
|
||||||
$schema = 'stylite.versioning'; //'sqlfs';
|
|
||||||
Vfs::$is_root = true;
|
|
||||||
Vfs::mount("$schema://default/home", '/home', false, false);
|
|
||||||
Vfs::$is_root = false;
|
|
||||||
var_dump(Vfs::mount());
|
|
||||||
var_dump(Vfs::scandir('/home'));
|
|
||||||
var_dump(Vfs::find('/home', ['maxdepth' => 1]));
|
|
||||||
//var_dump(Vfs::scandir("/home/$sysop"));
|
|
||||||
|
|
||||||
Vfs::$is_root = true;
|
|
||||||
Vfs::mount('filesystem://default/var/lib/egroupware', "/home/$other/something", false, false);
|
|
||||||
Vfs::$is_root = false;
|
|
||||||
var_dump(Vfs::stat("/home/$other/something"));
|
|
||||||
|
|
||||||
var_dump(file_put_contents("vfs://default/home/$sysop/test.txt", "Just a test ;)\n"));
|
|
||||||
var_dump("Vfs::proppatch('/home/$sysop/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])=".array2string(Vfs::proppatch("/home/$sysop/test.txt", [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])),
|
|
||||||
"Vfs::propfind('/home/$sysop/test.txt')=".json_encode(Vfs::propfind("/home/$sysop/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
|
|
||||||
var_dump($f=fopen("vfs://default/home/$sysop/test.txt", 'r'), fread($f, 100), fclose($f));
|
|
||||||
//var_dump(Vfs::find("/home/$sysop", ['maxdepth' => 1]));
|
|
||||||
|
|
||||||
Vfs::$is_root = true;
|
|
||||||
var_dump(file_put_contents("vfs://default/home/$other/test.txt", "Just a test ;)\n"));
|
|
||||||
var_dump("Vfs::proppatch('/home/$other/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])=".array2string(Vfs::proppatch("/home/$other/test.txt", [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something']])),
|
|
||||||
"Vfs::propfind('/home/$other/test.txt')=".json_encode(Vfs::propfind("/home/$other/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump(Vfs::mount("vfs://$other@default/home/$other", "/home/$sysop/$other", false, false));
|
|
||||||
Vfs::$is_root = false;
|
|
||||||
|
|
||||||
var_dump(Vfs::mount());
|
|
||||||
|
|
||||||
var_dump("Vfs::resolve_url('/home/$sysop/$other/test.txt')=".Vfs::resolve_url("/home/$sysop/$other/test.txt"));
|
|
||||||
var_dump("Vfs::url_stat('/home/$sysop/$other/test.txt')=".json_encode(Vfs::stat("/home/$sysop/$other/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::is_readable('/home/$sysop/$other/test.txt')=".json_encode(Vfs::is_readable("/home/$sysop/$other/test.txt")));
|
|
||||||
var_dump("fopen('vfs://default/home/$sysop/$other/test.txt', 'r')", $f=fopen("vfs://default/home/$sysop/$other/test.txt", 'r'), fread($f, 100), fclose($f));
|
|
||||||
var_dump("Vfs::propfind('/home/$sysop/$other/test.txt')", Vfs::propfind("/home/$sysop/$other/test.txt"));
|
|
||||||
var_dump("Vfs::proppatch('/home/$sysop/$other/test.txt', [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something else']])=".array2string(Vfs::proppatch("/home/$sysop/$other/test.txt", [['ns' => Vfs::DEFAULT_PROP_NAMESPACE, 'name' => 'test', 'val' => 'something else']])),
|
|
||||||
"Vfs::propfind('/home/$sysop/$other/test.txt')=".json_encode(Vfs::propfind("/home/$sysop/$other/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
|
|
||||||
|
|
||||||
var_dump("Vfs::url_stat('/home/$sysop/$other/test-dir')=".json_encode(Vfs::stat("/home/$sysop/$other/test-dir")));
|
|
||||||
var_dump("Vfs::mkdir('/home/$sysop/$other/test-dir')=".json_encode(Vfs::mkdir("/home/$sysop/$other/test-dir")));
|
|
||||||
var_dump("Vfs::url_stat('/home/$sysop/$other/test-dir')=".json_encode(Vfs::stat("/home/$sysop/$other/test-dir"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::rmdir('/home/$sysop/$other/test-dir')=".json_encode(Vfs::rmdir("/home/$sysop/$other/test-dir")));
|
|
||||||
var_dump("Vfs::url_stat('/home/$sysop/$other/test-dir')=".json_encode(Vfs::stat("/home/$sysop/$other/test-dir")));
|
|
||||||
|
|
||||||
var_dump("Vfs::scandir('/home/$sysop/$other')=".json_encode(Vfs::scandir("/home/$sysop/$other"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::remove('/home/$sysop/$other/test.txt')=".json_encode(Vfs::remove("/home/$sysop/$other/test.txt"), JSON_UNESCAPED_SLASHES));
|
|
||||||
var_dump("Vfs::scandir('/home/$sysop/$other')=".json_encode(Vfs::scandir("/home/$sysop/$other"), JSON_UNESCAPED_SLASHES));
|
|
Loading…
Reference in New Issue
Block a user