[dev] Littles questions for using API's methods
Gerard Breiner
gerard.breiner at ias.u-psud.fr
Fri Jun 15 20:05:29 UTC 2012
Many thanks again Jan… I read the doc… No doubt that Xdebug is a very suitable tool for debugging…
However for this time I finally chose to debug by adding temporarily a var_dump(events) at the line 845 in kronolith/lib/Api.php... I found a event_recurtype field set to 1 which I replace by the NULL value and afterwards the calendar has been exported without another error.
Best regards.
Gérard
Le 14 juin 2012 à 14:29, Jan Schneider a écrit :
>
> Zitat von Gerard Breiner <gerard.breiner at ias.u-psud.fr>:
>
>> Many thanks Jan for your fast answer?. However, I Installed Xdebug but I'm trying to use it without result?
>> Yet it is installed? php -m list : [
>> Zend Modules]
>> Xdebug
>>
>> In my Cli php.ini I added :
>>
>> [CODE]
>> error_reporting = E_ALL & E_NOTICE
>>
>> [xdebug]
>> zend_extension="/usr/lib64/php5/20090626/xdebug.so"
>> ;xdebug.default_enable=Off
>> xdebug.default_enable=1
>> xdebug.show_local_vars=1
>> xdebug.trace_format=2
>> xdebug.trace_output_dir="/www/horde4/log"
>> xdebug.trace_output_name="xdebug.log"
>>
>> [/CODE]
>>
>> When I run my script "exportCalendars.phpt" for the calendars which has a bad event I get :
>>
>> PHP Notice: Undefined index: SERVER_NAME in /www/horde4/config/horde.local.php on line 12
>> PHP Stack trace:
>> PHP 1. {main}() /www/horde4/pear/exportcals.php:0
>> PHP 2. require_once() /www/horde4/pear/exportcals.php:12
>> PHP 3. require_once() /www/horde4/lib/Application.php:18
>> PHP 4. include_once() /www/horde4/lib/core.php:40
>> PHP Notice: Undefined index: SERVER_PORT in /www/horde4/config/horde.local.php on line 13
>> PHP Stack trace:
>> PHP 1. {main}() /www/horde4/pear/exportcals.php:0
>> PHP 2. require_once() /www/horde4/pear/exportcals.php:12
>> PHP 3. require_once() /www/horde4/lib/Application.php:18
>> PHP 4. include_once() /www/horde4/lib/core.php:40
>> PHP Notice: Undefined index: SERVER_NAME in /www/horde4/config/horde.local.php on line 22
>> PHP Stack trace:
>> PHP 1. {main}() /www/horde4/pear/exportcals.php:0
>> PHP 2. require_once() /www/horde4/pear/exportcals.php:12
>> PHP 3. require_once() /www/horde4/lib/Application.php:18
>> PHP 4. include_once() /www/horde4/lib/core.php:40
>>
>> ====================
>>
>> Fatal Error:
>> DateTime::__construct(): Failed to parse time string (-001-11-01) at position 7 (-): Double timezone specification
>>
>> 1. Horde_Registry->call() /www/horde4/pear/exportcals.php:68
>> 2. Horde_Registry->callByPackage() /www/horde4/pear/php/Horde/Registry.php:979
>> 3. call_user_func_array() /www/horde4/pear/php/Horde/Registry.php:1020
>> 4. Kronolith_Api->exportCalendar()
>> 5. Kronolith_Event->toiCalendar() /www/horde4/kronolith/lib/Api.php:846
>> 6. Horde_Date->__construct() /www/horde4/kronolith/lib/Event.php:842
>> 7. Horde_Date->_initializeFromArgs() /www/horde4/pear/php/Horde/Date.php:201
>> 8. Horde_Date->_initializeFromArray() /www/horde4/pear/php/Horde/Date.php:1045
>> 9. Horde_Date->_correct() /www/horde4/pear/php/Horde/Date.php:1076
>> 10. Horde_Date_Utils::daysInMonth() /www/horde4/pear/php/Horde/Date.php:1009
>> 11. DateTime->__construct() /www/horde4/pear/php/Horde/Date/Utils.php:58
>>
>> I wonder what else I have to configure for Xdebug works.
>
> See http://xdebug.org/docs/stack_trace especially xdebug.collect_params
>
>>
>> Best regards.
>>
>> Gérard
>>
>>
>>
>>
>>
>> Le 11 juin 2012 à 16:58, Jan Schneider a écrit :
>>
>>> Install Xdebug and you should get a backtrace with function call parameter that would help identifying the broken event.
>>>
>>> Zitat von Gerard Breiner <gerard.breiner at ias.u-psud.fr>:
>>>
>>>> Hello,
>>>>
>>>> I come here back for saying my script works and do what he is supposed to do? I think to have identified the calendar for which "calendar/exportCalendars" rise the error "Double timezone specification".
>>>> Is there a way for identifying what is not clean inside this calendar ?
>>>>
>>>> Many thanks in advance.
>>>>
>>>> Best regards.
>>>>
>>>> Gérard
>>>>
>>>>
>>>> Le 6 juin 2012 à 17:08, Gerard Breiner a écrit :
>>>>
>>>>> Many thanks Jan, Mike?.
>>>>>
>>>>> I picked up a few pieces of code and now I might expect to get an export of all the calendar but I'm facing an error when I run 'calendar/exportCalendars' method :
>>>>> It seems this error occurs for calendars whose owners has never create an event.
>>>>>
>>>>> Fatal Error:
>>>>> DateTime::__construct(): Failed to parse time string (-001-11-01) at position 7 (-): Double timezone specification
>>>>>
>>>>> It seems this error is raised at :
>>>>> DateTime->__construct() /www/horde4/pear/php/Horde/Date/Utils.php:58
>>>>>
>>>>> At this time my code is :
>>>>>
>>>>> [CODE]
>>>>> #!/usr/bin/env php
>>>>> <?php
>>>>> set_include_path('/www/horde4/pear/php' . PATH_SEPARATOR . get_include_path());
>>>>> if (file_exists(dirname(__FILE__) . '/../../kronolith/lib/Application.php')) {
>>>>> $baseDir = dirname(__FILE__) . '/../';
>>>>> } else {
>>>>> require_once 'PEAR/Config.php';
>>>>> $baseDir = PEAR_Config::singleton()
>>>>> ->get('horde_dir', null, 'pear.horde.org') . '/kronolith/';
>>>>> }
>>>>>
>>>>> require_once dirname(__FILE__) . '/../lib/Application.php';
>>>>> Horde_Registry::appInit('kronolith', array(
>>>>> 'cli' => true
>>>>> ));
>>>>> // Call a Registry method.
>>>>> // Retrieve a list of users associated with each calendar, and
>>>>> // thus a list of users who have used kronolith and
>>>>> // potentially have an agenda preference set.
>>>>> $calendars = $GLOBALS['kronolith_shares']->listAllShares();
>>>>> $users = array();
>>>>> foreach (array_keys($calendars) as $calendarId) {
>>>>> try {
>>>>> $calendar = $GLOBALS['kronolith_shares']->getShare($calendarId);
>>>>> } catch (Exception $e) {
>>>>> continue;
>>>>> }
>>>>> $users = array_merge($users, $calendar->listUsers(Horde_Perms::READ));
>>>>> }
>>>>> // Remove duplicates.
>>>>> $users = array_unique($users);
>>>>>
>>>>> // Tell the registry that we are doing authentication ourselves.
>>>>> define('AUTH_HANDLER', true);
>>>>>
>>>>> $contentType = 'text/calendar';
>>>>> foreach ($users as $user) {
>>>>> $registry->setAuth($user, array('password' => ''));
>>>>> $cals[$user] = $registry->call('calendar/listCalendars', array('true', 'HORDE_PERMS::READ'));
>>>>> if ($cals[$user]['0'] != '') {
>>>>> $export[$user] = $registry->call('calendar/exportCalendar', array($cals[$user]['0'], $contentType, 'Horde_Perms::READ'));
>>>>> $file = '/home/webadm/exportCalendars/' . $user . '.ics';
>>>>> $hdl = fopen($file, a);
>>>>> fwrite($hdl, $export[$user]);
>>>>> }
>>>>>
>>>>> }
>>>>> fclose($hdl);
>>>>> [/CODE]
>>>>>
>>>>> Best regards.
>>>>>
>>>>> Gérard
>>>>>
>>>>>
>>>>> Le 4 juin 2012 à 17:20, Michael J Rubinsky a écrit :
>>>>>
>>>>>
>>>>>>
>>>>>> Quoting Gerard Breiner <gerard.breiner at ias.u-psud.fr>:
>>>>>>
>>>>>>> Hello Mike,
>>>>>>>
>>>>>>> Thanks for these precisions? It make me understand what Jan meant?
>>>>>>> I will try soon to reduce registry.local.php and kept only what is necessary.
>>>>>>>
>>>>>>> I have another question about calendar permissions and listCalendars.
>>>>>>> In the admin interface admin/perms I have assigned the permissions 'show' and 'read' to allow the user webadm access to all agendas.
>>>>>>> I dont understand why with the below code I do not list all the calendars but only the others users shares with "webadm" user? It is like the perms I setup has not been validated.
>>>>>>
>>>>>> Permissions for calendars are set by the owner of the calendar, from within Kronolith - not from the administrative interface. Look on the calendar's property view.
>>>>>>
>>>>>>
>>>>>> --
>>>>>> mike
>>>>>>
>>>>>> The Horde Project (www.horde.org)
>>>>>> mrubinsk at horde.org
>>>>>
>>>>> --
>>>>> dev mailing list
>>>>> Frequently Asked Questions: http://wiki.horde.org/FAQ
>>>>> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>>>>
>>>> --
>>>> dev mailing list
>>>> Frequently Asked Questions: http://wiki.horde.org/FAQ
>>>> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>>>
>>> --
>>> Jan Schneider
>>> The Horde Project
>>> http://www.horde.org/
>>>
>>>
>>> --
>>> dev mailing list
>>> Frequently Asked Questions: http://wiki.horde.org/FAQ
>>> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>
> --
> Jan Schneider
> The Horde Project
> http://www.horde.org/
>
>
More information about the dev
mailing list