[dev] DAV questions round 2
Jan Schneider
jan at horde.org
Mon Sep 28 12:30:22 UTC 2009
Zitat von Evert Pot <evertpot at gmail.com>:
> Hi Guys,
>
> Few questions..
>
> 1. I'm assuming I'm developing within horde-git. Jan already made a
> 'Sabre' package here.
> How can I easily generate the package.xml. Do you guys have a script
> for this?
There already is a package.xml in there. Currently we still generate
the package.xml files manually.
> 2. I'm trying to get a list of applications for the root directory.
> This is the relevant code for this in the existing Rpc/Webdav.php:
>
> foreach ($apps as $app) {
> // Call each application's browse method to get
> // their collections
> if ($registry->hasMethod('browse', $app)) {
> $origdepth = $options['depth'];
> if ($options['depth'] == 1) {
> // Make sure the applications each only
> return one level
> $options['depth'] = 0;
> }
>
> try {
> $results = $registry->callByPackage($app,
> 'browse', array('path' => '/', 'depth' => $options['depth']));
> } catch (Horde_Exception $e) {
> continue;
> }
>
> $options['depth'] = $origdepth;
>
> foreach ($results as $itemPath => $item) {
> if (($item !== false) && !is_a($item, 'PEAR_Error')) {
> // A false return is "file not found"
> // A PEAR_Error return is an error.
> Silently ignore
> // those errors from the applications.
> Errors will
> // will nevertheless be logged.
> $list[] =
> array('path' => $this->path . '/' . $itemPath,
> 'props' =>
> $this->_getProps($options['props'], $item));
> }
> }
> }
>
>
> I would expect the contents of $itemPath in the inner loop to be for
> example 'kronolith'. Instead I get 'kronolith/Administrator'.
> So for the actual question: am I just supposed to use the first part
> of $itemPath? Am I doing it wrong altogether? Is there a better way
> to get a list of application-names for use in the directory tree?
Since the the first part of the path is always the application name,
you could use $app directly, if you only want to use that. IIRC the
browse() call even for the top-level listing is there to make sure
that the applications we are listing are actually working.
The weird path-as-key method of storing the tree is due to using
HTTP_WebDAV_Server as the backend at the moment. I'm perfectly fine
with streamlining this now that we switch over to Sabre even for
simple WebDAV access.
> 3. SabreDAV supports custom locking backend support. I've noticed
> Horde has a standard Lock driver model as well. Should I integrate
> with this as well?
Yes, it has explicitly been written for CalDAV.
> 4. How do you guys want the code delivered? I can create patches,
> but having access to your repositories might allow you to be more
> judgemental =)
Usually we only give access after receiving and reviewing a few
patches. But since you are going to contribute a larger bunch of code,
it probably makes more sense to give you access right from the start.
Jan.
--
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/
More information about the dev
mailing list