[kronolith] What means "a:0:{}"

Ferdinand Gruber fer.grub at yahoo.de
Thu Apr 4 20:09:56 UTC 2019


Am 04.04.19 um 08:00 schrieb Ralf Lang:
> Let's do an exercise.
> We will need the external API of kronolith, especially
>
> put() https://github.com/horde/kronolith/blob/master/lib/Api.php#L263
> browser() https://github.com/horde/kronolith/blob/master/lib/Api.php#L58
The file kronolith/lib/Api.php already exists in my Horde directory. Why 
should I download it ???
> Create a new file kronolith/bin/events and make it executable (+x) - you
> could also use the horde admin php shell and select context Kronolith
>
> First some boilerplate
>
> #!/usr/bin/env
> php
>
> <?php
>
> $baseDir = __DIR__ . '/../';
> require_once $baseDir . 'lib/Application.php';
> Horde_Registry::appInit('kronolith', array('cli' => true));
>
> This initializes kronolith as admin.
>
> Now let's begin browsing.
>
> // authorize as lang (replace with your name)
>
> $registry->setAuth('lang', array(), array());
>
> // Dive into the calendar path step by step (app, owner, calendar)
>
> print_r($registry->call('calendar/browse', array()));
>
> // This gives you the available calendars both as a dir of individual
> event files and as an ics file of all events
>
> print_r($registry->call('calendar/browse', array('kronolith/lang')));
>
> // dive into one of these
>
> print_r($registry->call('calendar/browse',
> array('kronolith/lang/KI14jYtCMpbet4ecYzAg1bn.ics')));
> print_r($registry->call('calendar/browse',
> array('kronolith/lang/KI14jYtCMpbet4ecYzAg1bn')));

I created the file kronolith/bin/events as you described above.
Then I run:

php ./events

and I get the output - some arrays and the events in ICS format.

But on the last line, I get an error message - i commented it out.

print_r($registry->call('calendar/browse',array('kronolith/ferdinand/gO9NqonqPBun1TwWNl148w1.ics')));
// 
print_r($registry->call('calendar/browse',array('kronolith/ferdinand/gO9NqonqPBun1TwWNl148w1')));

The first line works, the second creates this error.

HORDE[26237]: [kronolith] Error: __clone method called on non-object in 
/srv/www/htdocs/horde/kronolith/lib/Kronolith.php:331
Stack trace:
#0 /srv/www/htdocs/horde/kronolith/lib/Driver/Sql.php(312): 
Kronolith::addEvents(Array, Object(Kronolith_Event_Sql), NULL, NULL, 
false, false, true)
#1 /srv/www/htdocs/horde/kronolith/lib/Driver.php(310): 
Kronolith_Driver_Sql->_listEvents(NULL, NULL, Array)
#2 /srv/www/htdocs/horde/kronolith/lib/Api.php(160): 
Kronolith_Driver->listEvents()
#3 /usr/share/php7/PEAR/Horde/Registry.php(1132): 
Kronolith_Api->browse('ferdinand/gO8Nq...')
#4 /usr/share/php7/PEAR/Horde/Registry.php(1089): 
Horde_Registry->callByPackage('kronolith', 'browse', Array)
#5 /srv/www/htdocs/horde/kronolith/bin/events(16): 
Horde_Registry->call('calendar/browse', Array)
#6 {main} [pid 26237 on line 74 of 
"/usr/share/php7/PEAR/Horde/ErrorHandler.php"]

> Now you know how to use the api and you see examples of event description structure.
Unfortunately I don't know anything how to use the API. In this case I 
am an absolute beginner.
Please help.

I don't know how to use the API in my project.

I don't understand, how to use an API.

-- 
Regards from Austria
Ferdinand Gruber



More information about the kronolith mailing list