forked from extern/egroupware
Initial commit. From Jonathon Sim <sim@zeald.com>
This commit is contained in:
parent
4697629414
commit
efc0287bc1
61
filemanager/tests/benchmark_dav.php
Normal file
61
filemanager/tests/benchmark_dav.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
$phpgw_info["flags"] = array("currentapp" => "phpwebhosting",
|
||||||
|
"noheader" => False,
|
||||||
|
"noappheader" => False,
|
||||||
|
"enable_vfs_class" => True);
|
||||||
|
|
||||||
|
include("../../header.inc.php");
|
||||||
|
|
||||||
|
function getmicrotime()
|
||||||
|
{
|
||||||
|
list($usec, $sec) = explode(" ",microtime());
|
||||||
|
return ((float)$usec + (float)$sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
function stats($array)
|
||||||
|
{
|
||||||
|
$mean = array_sum($array)/count($array);
|
||||||
|
$a = 0;
|
||||||
|
foreach ($array as $value)
|
||||||
|
{
|
||||||
|
$a += ($value - $mean)*($value - $mean);
|
||||||
|
}
|
||||||
|
$std = sqrt($a/count($array));
|
||||||
|
$error = $std/sqrt(count($array));
|
||||||
|
echo "mean time: $mean error: +-$error";
|
||||||
|
}
|
||||||
|
echo '<b>Benchmarking vfs::ls</b><br>';
|
||||||
|
$times = array();
|
||||||
|
$phpgw->vfs->cd();
|
||||||
|
for ($i=0;$i<20; $i++)
|
||||||
|
{
|
||||||
|
$phpgw->vfs->dav_client->cached_props = array();
|
||||||
|
$time1 = getmicrotime();
|
||||||
|
$result = $phpgw->vfs->ls (array ('string' => ''));
|
||||||
|
$time = getmicrotime() - $time1;
|
||||||
|
$times[] = $time;
|
||||||
|
echo "run $i: $time<br>";
|
||||||
|
//sleep(1);
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
stats($times);
|
||||||
|
|
||||||
|
echo '<br><b>Benchmarking dav_client::get_properties</b><br>';
|
||||||
|
$times = array();
|
||||||
|
$phpgw->vfs->cd();
|
||||||
|
for ($i=0;$i<20; $i++)
|
||||||
|
{
|
||||||
|
$phpgw->vfs->dav_client->cached_props = array();
|
||||||
|
$time1 = getmicrotime();
|
||||||
|
$result = $phpgw->vfs->dav_client->get_properties('/home/sim');
|
||||||
|
$time = getmicrotime() - $time1;
|
||||||
|
$times[] = $time;
|
||||||
|
echo "run $i: $time<br>";
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
stats($times);
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
531
filemanager/tests/test_dav.php
Normal file
531
filemanager/tests/test_dav.php
Normal file
@ -0,0 +1,531 @@
|
|||||||
|
<?php
|
||||||
|
function ok($string){
|
||||||
|
/* html_table_row_begin();
|
||||||
|
html_table_col_begin();*/
|
||||||
|
echo "<h3>$string ";
|
||||||
|
/* html_table_col_end();
|
||||||
|
html_table_col_begin();*/
|
||||||
|
echo " OK</h3>";
|
||||||
|
/* html_table_col_end();
|
||||||
|
html_table_row_end();*/
|
||||||
|
}
|
||||||
|
function fail($string){
|
||||||
|
/* html_table_row_begin();
|
||||||
|
html_table_col_begin();*/
|
||||||
|
echo "<h3>$string ";
|
||||||
|
/* html_table_col_end();
|
||||||
|
html_table_col_begin();*/
|
||||||
|
echo " <b>FAILED!</b></h3>";
|
||||||
|
/* html_table_col_end();
|
||||||
|
html_table_row_end(); */
|
||||||
|
}
|
||||||
|
|
||||||
|
$phpgw_info["flags"] = array("currentapp" => "filemanager",
|
||||||
|
"noheader" => False,
|
||||||
|
"noappheader" => False,
|
||||||
|
"enable_vfs_class" => True);
|
||||||
|
|
||||||
|
include("../../header.inc.php");
|
||||||
|
|
||||||
|
html_text('VFS_DAV tests:');
|
||||||
|
html_break (1);
|
||||||
|
html_text_italic (PHP_OS . " - " . $phpgw_info["server"]["db_type"] . " - " . PHP_VERSION . " - " . $phpgw->vfs->basedir);
|
||||||
|
html_break (1);
|
||||||
|
//html_table_begin();
|
||||||
|
|
||||||
|
|
||||||
|
$sep = SEP;
|
||||||
|
$user = $phpgw->vfs->working_lid;
|
||||||
|
$homedir = $phpgw->vfs->fakebase . "/" . $user;
|
||||||
|
$realhomedir = preg_replace ("|/|", $sep, $homedir);
|
||||||
|
$filesdir = $phpgw->vfs->basedir;
|
||||||
|
$currentapp = $phpgw_info["flags"]["currentapp"];
|
||||||
|
$time1 = time();
|
||||||
|
|
||||||
|
echo ' override locks : ';print_r($phpgw->vfs->override_locks);
|
||||||
|
###
|
||||||
|
# write test
|
||||||
|
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$testfile = 'sdhdsjjkldggfsbhgbnirooaqojsdkljajklvagbytoi-test';
|
||||||
|
$teststring = 'delete me' ;
|
||||||
|
if (!$result = $phpgw->vfs->write (array ('string' => $testfile,
|
||||||
|
'content' => $teststring
|
||||||
|
)))
|
||||||
|
{
|
||||||
|
fail( __LINE__." failed writing file!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("write");
|
||||||
|
}
|
||||||
|
|
||||||
|
#read
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$result = $phpgw->vfs->read (array ('string' => $testfile, 'noview' => true ));
|
||||||
|
if (!$result==$teststring)
|
||||||
|
{
|
||||||
|
fail( __LINE__." failed reading file!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(" read");
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
# ls test
|
||||||
|
|
||||||
|
$result1 = $phpgw->vfs->ls (array ('string' => $testfile ));
|
||||||
|
|
||||||
|
if (!count($result1))
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed listing file!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(" ls : known file");
|
||||||
|
}
|
||||||
|
//list the parent dir
|
||||||
|
|
||||||
|
$result = $phpgw->vfs->ls (array ('string' => ''));
|
||||||
|
foreach ($result as $file)
|
||||||
|
{
|
||||||
|
if ($testfile == $file['name'])
|
||||||
|
{
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed listing file!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(" ls : parent");
|
||||||
|
}
|
||||||
|
$found = false;
|
||||||
|
foreach ($result as $file)
|
||||||
|
{
|
||||||
|
if ($result1[0]['directory'] == $file['full_name'])
|
||||||
|
{
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($found)
|
||||||
|
{
|
||||||
|
fail(__LINE__." parent is present in its own listing!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(" ls : parent self reference");
|
||||||
|
}
|
||||||
|
# getsize
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$result = $phpgw->vfs->get_size (array ('string' => $testfile ));
|
||||||
|
$len = strlen($teststring);
|
||||||
|
if (!($result== $len))
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed getting size of file result $result strlen $len");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("get_size");
|
||||||
|
}
|
||||||
|
|
||||||
|
#filetype
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$result = $phpgw->vfs->file_type(array ('string' => $testfile ));
|
||||||
|
$len = strlen($teststring);
|
||||||
|
if (!($result== 'application/octet-stream'))
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed getting file type $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("file_type");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#file_exists
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$result = $phpgw->vfs->file_exists(array ('string' => $testfile ));
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." file_exist failed: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("file_exists");
|
||||||
|
}
|
||||||
|
|
||||||
|
#lock
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$result = $phpgw->vfs->lock (array ('string' => $testfile ));
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__."failed locking file!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(" lock");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$ls_array = $GLOBALS['phpgw']->vfs->ls (array (
|
||||||
|
'string' => $testfile,
|
||||||
|
'relatives' => array (RELATIVE_ALL),
|
||||||
|
'checksubdirs' => False
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (!count($ls_array[0]['locks']))
|
||||||
|
{
|
||||||
|
fail(__LINE__."after locking file no locks exist!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(" lock: after locking lock exists.");
|
||||||
|
}
|
||||||
|
$lock = end($ls_array[0]['locks']);
|
||||||
|
$tokens = end($lock['lock_tokens']);
|
||||||
|
$token = $tokens['name'];
|
||||||
|
//write should now fail
|
||||||
|
$result = $phpgw->vfs->write (array ('string' => $testfile,
|
||||||
|
'content' => 'delete me'
|
||||||
|
));
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
fail(__LINE__."I can write a supposidly locked file!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("lock: after locking write fails");
|
||||||
|
}
|
||||||
|
|
||||||
|
$phpgw->vfs->add_lock_override(array ('string' => $testfile));
|
||||||
|
$result = $phpgw->vfs->write (array ('string' => $testfile,
|
||||||
|
'content' => 'delete me'
|
||||||
|
));
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__."I cant write a locked file after overriding the lock!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("lock: after lock override write succeeds");
|
||||||
|
}
|
||||||
|
###
|
||||||
|
# unlock test
|
||||||
|
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$result = $phpgw->vfs->unlock (array ('string' => $testfile ), $token);
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail( __LINE__."failed unlocking file!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OK("unlock");
|
||||||
|
}
|
||||||
|
|
||||||
|
#server side copy
|
||||||
|
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$result = $phpgw->vfs->cp(array ('from' => $testfile,
|
||||||
|
'to' => $testfile.'2',
|
||||||
|
'relatives' => array (RELATIVE_ALL, RELATIVE_ALL)
|
||||||
|
));
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed copying! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("server-side copy");
|
||||||
|
}
|
||||||
|
$result = $phpgw->vfs->file_exists(array ('string' => $testfile.'2'
|
||||||
|
));
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." after copy, target doesnt exist!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("server-side copy : test for target");
|
||||||
|
}
|
||||||
|
$result = $phpgw->vfs->read (array ('string' => "$testfile".'2',
|
||||||
|
'noview' => true,
|
||||||
|
'relatives' => array (RELATIVE_ALL)
|
||||||
|
));
|
||||||
|
if (!$result==$teststring)
|
||||||
|
{
|
||||||
|
fail( __LINE__."after copy, read returned '$result' not '$teststring' ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(" server-side copy: read target");
|
||||||
|
}
|
||||||
|
$result = $phpgw->vfs->delete(array ('string' => $testfile.'2'
|
||||||
|
));
|
||||||
|
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed copying! delete copied file returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("server-side copy : delete target");
|
||||||
|
}
|
||||||
|
|
||||||
|
#remote -> local copy
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
echo "<pre>";
|
||||||
|
$result = $phpgw->vfs->cp(array ('from' => $testfile,
|
||||||
|
'to' => "/tmp/$testfile".'2',
|
||||||
|
'relatives' => array (RELATIVE_ALL, RELATIVE_NONE | VFS_REAL)
|
||||||
|
));
|
||||||
|
echo "</pre>";
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed remote->local copying! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("remote->local copy");
|
||||||
|
}
|
||||||
|
echo "<pre>";
|
||||||
|
$result = $phpgw->vfs->file_exists(array ('string' => "/tmp/$testfile".'2',
|
||||||
|
'relatives' => array (RELATIVE_NONE | VFS_REAL)
|
||||||
|
));
|
||||||
|
echo "</pre>";
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." after remote->local copy, target doesnt exist!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("remote->local copy : test for target");
|
||||||
|
}
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
echo "<pre>";
|
||||||
|
$result = $phpgw->vfs->read (array ('string' => "/tmp/$testfile".'2',
|
||||||
|
'noview' => true,
|
||||||
|
'relatives' => array (RELATIVE_NONE | VFS_REAL)
|
||||||
|
));
|
||||||
|
echo "</pre>";
|
||||||
|
if (!$result==$teststring)
|
||||||
|
{
|
||||||
|
fail( __LINE__."after remote->local copy, returned $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(" remote->local copy: read target");
|
||||||
|
}
|
||||||
|
echo "<pre>";
|
||||||
|
$result = $phpgw->vfs->delete(array ('string' => "/tmp/$testfile".'2',
|
||||||
|
'relatives' => array (RELATIVE_NONE | VFS_REAL)
|
||||||
|
));
|
||||||
|
echo "</pre>";
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed copying! delete copied file returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("remote->local copy : delete target");
|
||||||
|
}
|
||||||
|
|
||||||
|
#move
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
echo "<pre>";
|
||||||
|
$result = $phpgw->vfs->mv(array ('from' => $testfile,
|
||||||
|
'to' => $testfile.'2',
|
||||||
|
'relatives' => array (RELATIVE_ALL, RELATIVE_ALL)
|
||||||
|
));
|
||||||
|
echo "</pre>";
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed moving! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("server-side move");
|
||||||
|
}
|
||||||
|
$result = $phpgw->vfs->file_exists(array ('string' => $testfile,
|
||||||
|
));
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed moving! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("server-side move : test for source");
|
||||||
|
}
|
||||||
|
$result = $phpgw->vfs->file_exists(array ('string' => $testfile.'2',
|
||||||
|
));
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed moving! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("server-side move : test for target");
|
||||||
|
}
|
||||||
|
echo "<pre>";
|
||||||
|
$result = $phpgw->vfs->read (array ('string' => $testfile.'2',
|
||||||
|
'noview' => true,
|
||||||
|
'relatives' => array (RELATIVE_ALL)
|
||||||
|
));
|
||||||
|
echo "</pre>";
|
||||||
|
if (!$result==$teststring)
|
||||||
|
{
|
||||||
|
fail( __LINE__."after move, read returned '$result' not '$teststring' ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(" server-side move: read target");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
$result = $phpgw->vfs->mv(array ('from' => $testfile.'2',
|
||||||
|
'to' => $testfile,
|
||||||
|
'relatives' => array (RELATIVE_ALL, RELATIVE_ALL)
|
||||||
|
));
|
||||||
|
echo "</pre>";
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed moving! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("server-side move : move back");
|
||||||
|
}
|
||||||
|
|
||||||
|
#remote->local move
|
||||||
|
echo "<pre>";
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$result = $phpgw->vfs->mv(array ('from' => $testfile,
|
||||||
|
'to' => '/tmp/'.$testfile.'2',
|
||||||
|
'relatives' => array (RELATIVE_ALL, RELATIVE_NONE | VFS_REAL)
|
||||||
|
));
|
||||||
|
echo "</pre>";
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed moving! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("remote->local move");
|
||||||
|
}
|
||||||
|
$result = $phpgw->vfs->file_exists(array ('string' => $testfile,
|
||||||
|
));
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed moving! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("remote->local move : test for source");
|
||||||
|
}
|
||||||
|
$result = $phpgw->vfs->file_exists(array ('string' => '/tmp/'.$testfile.'2',
|
||||||
|
'relatives' => array(RELATIVE_NONE | VFS_REAL)
|
||||||
|
));
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed moving! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("remote->local move : test for target");
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $phpgw->vfs->read (array ('string' => '/tmp/'.$testfile.'2',
|
||||||
|
'noview' => true,
|
||||||
|
'relatives' => array(RELATIVE_NONE | VFS_REAL)
|
||||||
|
));
|
||||||
|
if (!$result==$teststring)
|
||||||
|
{
|
||||||
|
fail( __LINE__."after move, read returned '$result' not '$teststring' ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("remote->local move: read target");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
$result = $phpgw->vfs->mv(array ('from' => '/tmp/'.$testfile.'2',
|
||||||
|
'to' => $testfile,
|
||||||
|
'relatives' => array (RELATIVE_NONE | VFS_REAL, RELATIVE_ALL)
|
||||||
|
));
|
||||||
|
echo "</pre>";
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed moving! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("server-side move : move back");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
# delete test
|
||||||
|
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$result = $phpgw->vfs->delete(array ('string' => $testfile ));
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__."failed deleting file! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("delete");
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
# mkdir test
|
||||||
|
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$result = $phpgw->vfs->mkdir(array ('string' => $testfile ));
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__."failed creating collection! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("mkdir");
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $phpgw->vfs->write (array ('string' => $testfile.'/'.$testfile.'2',
|
||||||
|
'content' => $teststring
|
||||||
|
));
|
||||||
|
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail( __LINE__." failed writing file into new dir!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("mkdir : write into dir");
|
||||||
|
}
|
||||||
|
###
|
||||||
|
# rm dir test
|
||||||
|
|
||||||
|
$phpgw->vfs->cd ();
|
||||||
|
$result = $phpgw->vfs->rm(array ('string' => $testfile ));
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
fail(__LINE__." failed deleting collection! returned: $result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok("delete dir");
|
||||||
|
}
|
||||||
|
|
||||||
|
//html_table_end();
|
||||||
|
$time = time() - $time1;
|
||||||
|
html_text("Done in $time s");
|
||||||
|
html_page_close ();
|
||||||
|
|
||||||
|
?>
|
122
phpgwapi/doc/vfs/vfs_dav/README
Normal file
122
phpgwapi/doc/vfs/vfs_dav/README
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
vfs_dav: WebDAV support for phpGroupWare
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
WARNING::This is still alpha-quality code, and may delete all your files,
|
||||||
|
corrupt all your data, and run away with your daughter. Dont use it unless
|
||||||
|
you know what your doing.
|
||||||
|
|
||||||
|
|
||||||
|
This package contains classes and patches implementing a virtual filesystem
|
||||||
|
for phpGroupWare (0.9.14) that uses a WebDAV file repository as a
|
||||||
|
storage area. This allows you to store your files online in phpgroupware,
|
||||||
|
in a way that cooperates well with other web applications (for instance,
|
||||||
|
in Windows you can then access your files as a "web folder", and similarly
|
||||||
|
KDE, Gnome, MacOSX, and a multitude of applications all include some way of
|
||||||
|
browsing files on a WebDAV share)
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
- (should be) fully compatible with the WebDAV standard, as specified in
|
||||||
|
RFC2518 http://www.ietf.org/rfc/rfc2518.txt (NB : this doesn't imply that it
|
||||||
|
is :) only that I consider it a bug if it isn't )
|
||||||
|
- Maps vfs properties (eg creator_id etc) to the Dublin Core metadata
|
||||||
|
specification (http://dublincore.org/) (eg "author") where possible, and
|
||||||
|
stores them as DAV properties
|
||||||
|
- Limited Access control support - when you create a dir in groupware, it
|
||||||
|
puts a .htaccess file in it with "limit user <username>" in it. Combined
|
||||||
|
with an Apache module authenticating against your phpgroupware account
|
||||||
|
database, this provides reasonable user-security (proper ACL support is
|
||||||
|
trickier to implement though :(
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
-----
|
||||||
|
- DELTA-V versioning extensions, using the subversion DELTA-V server
|
||||||
|
- Journalling -> Versioning. Journalling is currently unimplemented
|
||||||
|
- Locking (phpGroupWare doesn't really have any locking mechanism yet)
|
||||||
|
- ACL support for users accessing through an external webdav client.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
To install:
|
||||||
|
|
||||||
|
1/ Setup a WebDAV server - currently this code has only been well tested using
|
||||||
|
Apache's mod_dav (http://www.webdav.org/mod_dav/). To setup mod_dav ensure
|
||||||
|
that you have the module installed correctly ( RTFM :) and create a virtual
|
||||||
|
host (eg files.yourdomain.com) something like this:
|
||||||
|
|
||||||
|
<VirtualHost files.yourdomain.com:80>
|
||||||
|
AccessFileName .htaccess
|
||||||
|
ServerAdmin webmaster@yourdomain.com
|
||||||
|
DocumentRoot /var/files
|
||||||
|
<Location />
|
||||||
|
AllowOverride All
|
||||||
|
Options +Indexes
|
||||||
|
DAV on
|
||||||
|
DirectoryIndex /
|
||||||
|
RemoveHandler .php .php4 .php3 .phtml
|
||||||
|
</Location>
|
||||||
|
<Files ~ "^\.ht">
|
||||||
|
#This ensures phpgroupware can modify .htaccess files
|
||||||
|
order deny,allow
|
||||||
|
deny from all
|
||||||
|
#make sure your phpgroupware server is included here.
|
||||||
|
allow from localhost .localdomain 192.168.
|
||||||
|
</Files>
|
||||||
|
ServerName files.yourdomain.com
|
||||||
|
ErrorLog logs/dav_err
|
||||||
|
CustomLog logs/dav_acc combined
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
2/ On the setup page (phpgroupware/setup/config.php) specify
|
||||||
|
the WebDAV server URL (eg http://files.yourdomain.com ) in the: "Full path
|
||||||
|
for users and groups files" text area, and select DAV in:
|
||||||
|
"Select where you want to store/retrieve filesystem information"
|
||||||
|
combo. If your file repository supports SSL you might want to enter
|
||||||
|
'https://files.yourdomain.com' instead - note that phpGroupWare itself wont
|
||||||
|
use SSL to access the repository, but when it redirects the users browser to
|
||||||
|
the repository it will use the secure https url.
|
||||||
|
|
||||||
|
3/ Make sure your WebDAV repository contains a "home" directory (important!)
|
||||||
|
So if your WebDAV directory is /var/files, you would need:
|
||||||
|
/var/files/
|
||||||
|
/var/files/home/
|
||||||
|
|
||||||
|
4/ To enable authentication you must use a third-party Apache authentication
|
||||||
|
module. Which you use depends on how you have setup authentication in
|
||||||
|
phpGroupWare - for instance if you use an SQL DB (the default) then set up
|
||||||
|
mod_auth_pgsql (http://www.giuseppetanzilli.it/mod_auth_pgsql/) or
|
||||||
|
mod_auth_mysql (http://modauthmysql.sourceforge.net/)
|
||||||
|
An example .htaccess file is included for postgresql - mysql would be
|
||||||
|
similar. Your file repository also needs to be configured to allow
|
||||||
|
phpGroupWare to write .htaccess files (the setup in (3) will allow this)
|
||||||
|
|
||||||
|
Note that using an Apache module for authentication is not strictly
|
||||||
|
required in order to use WebDAV within phpGroupWare.
|
||||||
|
|
||||||
|
Authors
|
||||||
|
-------
|
||||||
|
Jonathon Sim <sim@zeald.com> for Zeald Ltd (http://zeald.com), Paolo Andreetto
|
||||||
|
<paolo@prosa.it>. Also contains code from the Net_HTTP_Client PHP class
|
||||||
|
(http://lwest.free.fr/doc/php/lib/net_http_client-en.html) by Leo West
|
||||||
|
<west_leo@yahoo.com>.
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
By using this software you agree to the terms of the GNU LGPL: this is the same
|
||||||
|
license that the phpGroupWare API is distributed under:
|
||||||
|
|
||||||
|
Copyright (C) 2002 Zeald Ltd.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2.1 of the License,
|
||||||
|
or any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this library; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
21
phpgwapi/doc/vfs/vfs_dav/htaccess.pgsql_example
Normal file
21
phpgwapi/doc/vfs/vfs_dav/htaccess.pgsql_example
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
php_flag engine off
|
||||||
|
RemoveHandler cgi-script .cgi .pl
|
||||||
|
RemoveType application/x-httpd-php .php .php3
|
||||||
|
RemoveType application/x-httpd-php-source .phps
|
||||||
|
|
||||||
|
AuthName "Groupware File Repository"
|
||||||
|
AuthType basic
|
||||||
|
Auth_PG_cache_passwords on
|
||||||
|
Auth_PG_host orion.zeald.com
|
||||||
|
Auth_PG_database gw_zeald
|
||||||
|
Auth_PG_user zeald
|
||||||
|
Auth_PG_pwd password
|
||||||
|
Auth_PG_pwd_table phpgw_accounts
|
||||||
|
Auth_PG_grp_table phpgw_accounts
|
||||||
|
Auth_PG_uid_field account_lid
|
||||||
|
Auth_PG_pwd_field account_pwd
|
||||||
|
Auth_PG_gid_field account_groups
|
||||||
|
Auth_PG_hash_type MD5
|
||||||
|
Auth_PG_pwd_whereclause " AND account_status='A' AND account_type='u' AND account_expires<NOW()"
|
||||||
|
Auth_PG_grp_whereclause " AND account_status='A' AND account_type='g' AND account_expires<NOW()"
|
||||||
|
require valid-user
|
1112
phpgwapi/inc/class.http_dav_client.inc.php
Normal file
1112
phpgwapi/inc/class.http_dav_client.inc.php
Normal file
File diff suppressed because it is too large
Load Diff
2978
phpgwapi/inc/class.vfs_dav.inc.php
Normal file
2978
phpgwapi/inc/class.vfs_dav.inc.php
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user