[dev] wicked API

Michael J Rubinsky mrubinsk at horde.org
Fri Jul 17 13:44:51 UTC 2015


Quoting Sebastian Birnbach <birnbacs at gmail.com>:

> All,
>
> please forgive me if I am asking stupid questions here but I am having
> ongoing problems using the API of wicked -- and also of other horde
> modules. Here are my questions:
>
> I am playing with blocks and want to access the wicked API for getting page
> information:
> $res = $registry->call('wiki/getPageInfo', array('mypage'));
>
> 1.) APIname 'wiki' corresponds to wicked, 'contacts' to turba (a little
> less intuitive), how about the other modules, where are the APInames
> defined?

These are defined in horde/config/registry.php as the "provides"  
parameter. Most of them are pretty standard - contacts, calendar,  
mail, tasks etc...  Alternatively, you could use $registry->listAPIs()  
in the administrative shell to get a list of all active API names. If  
you need the reverse, and need to know the app name for a given  
interface, use e.g., $registry->hasInterface('contacts') - this will  
give you the name of the app that provides the given interface.


> 2.) I am surprised that the second argument needs to be an array even
> though the documentation says string. It's not the parameter passing as
> such as the pageExists method works fine on a string

You are calling Horde_Registry::call() and THAT is (eventually)  
calling the wicked API. The call() method's second parameter is an  
array of parameters to pass to the API method you are calling.

You can also use the following, cleaner, syntax to call an api method:

$registry->wiki->getPageInfo('mypage');


> 3.) with the above code I get an Exception. From the syslog:
> Jul 17 12:33:31 max HORDE: [wicked] Cannot access protected property
> Wicked_Page_StandardPage::$_page [pid 31625 on line 59 of
> "/usr/local/www/apache24/data/wicked/lib/Api.php"]

Yes, this looks like a bug. I'll have to see when it was introduced to  
see the best way to correct. Please open a ticket on bugs.horde.org  
for this so it doesn't get lost.

> 4.) trying to work around with
> $res = $registry->call('wiki/getMultiplePageInfo', array('mypage'));
> I get a (to me) even more mysterious message:
> Jul 17 12:16:46 max HORDE: [wicked] PHP ERROR:
> require_once(/usr/local/www/apache24/data/wicked/lib/base.php): failed to
> open stream: No such file or directory [pid 37311 on line 77 of
> "/usr/local/www/apache24/data/wicked/lib/Api.php"]
> AFAIK base.php was last used in horde version 3 or so. Any chance I failed
> to installed an optional dependency?

Nope, another bug. Fixing.

> About API documentation:
> * I am using http://dev.horde.org/api/master/
> * but it sometimes seems that other sources like
> http://fossies.org/dox/horde-5.2.6/ are more up to date. Which one to
> choose?

dev.horde.org contains documentaion generated directly from the phpdoc  
in the code via APIGen. This is done nightly.


> * generating documentation from the codebase is probably safest, which tool
> would you recommend? apigen, phpDox or phpDocumentor maybe?
>
> Thanks for all insights
>
>   Sebastian
> --
> dev mailing list
> Frequently Asked Questions: http://wiki.horde.org/FAQ
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org



-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5869 bytes
Desc: S/MIME Signature
URL: <http://lists.horde.org/archives/dev/attachments/20150717/ddd03035/attachment.bin>


More information about the dev mailing list