Overview

Packages

  • Kolab
    • Server

Classes

  • Horde_Kolab_Server_Composite
  • Horde_Kolab_Server_Connection_File
  • Horde_Kolab_Server_Connection_Mock
  • Horde_Kolab_Server_Connection_Mock_Ldap
  • Horde_Kolab_Server_Connection_Mock_Search
  • Horde_Kolab_Server_Connection_Simpleldap
  • Horde_Kolab_Server_Connection_Splittedldap
  • Horde_Kolab_Server_Decorator_Clean
  • Horde_Kolab_Server_Decorator_Count
  • Horde_Kolab_Server_Decorator_Log
  • Horde_Kolab_Server_Decorator_Map
  • Horde_Kolab_Server_Exception
  • Horde_Kolab_Server_Exception_Bindfailed
  • Horde_Kolab_Server_Exception_Novalue
  • Horde_Kolab_Server_Factory
  • Horde_Kolab_Server_Ldap
  • Horde_Kolab_Server_Ldap_Changes
  • Horde_Kolab_Server_Ldap_Filtered
  • Horde_Kolab_Server_Ldap_Standard
  • Horde_Kolab_Server_List_Base
  • Horde_Kolab_Server_Object_Attribute_Base
  • Horde_Kolab_Server_Object_Attribute_Createtimestamp
  • Horde_Kolab_Server_Object_Attribute_Createtimestampdate
  • Horde_Kolab_Server_Object_Attribute_Decorator
  • Horde_Kolab_Server_Object_Attribute_Default
  • Horde_Kolab_Server_Object_Attribute_Empty
  • Horde_Kolab_Server_Object_Attribute_External
  • Horde_Kolab_Server_Object_Attribute_Field
  • Horde_Kolab_Server_Object_Attribute_Firstnamelastname
  • Horde_Kolab_Server_Object_Attribute_Guid
  • Horde_Kolab_Server_Object_Attribute_Id
  • Horde_Kolab_Server_Object_Attribute_Internal
  • Horde_Kolab_Server_Object_Attribute_Locked
  • Horde_Kolab_Server_Object_Attribute_Modifytimestamp
  • Horde_Kolab_Server_Object_Attribute_Modifytimestampdate
  • Horde_Kolab_Server_Object_Attribute_Objectclass
  • Horde_Kolab_Server_Object_Attribute_Openldapaci
  • Horde_Kolab_Server_Object_Attribute_Required
  • Horde_Kolab_Server_Object_Attribute_Single
  • Horde_Kolab_Server_Object_Attribute_Value
  • Horde_Kolab_Server_Object_Attribute_Writelock
  • Horde_Kolab_Server_Object_Base
  • Horde_Kolab_Server_Object_Factory
  • Horde_Kolab_Server_Object_Groupofnames
  • Horde_Kolab_Server_Object_Hash
  • Horde_Kolab_Server_Object_Inetorgperson
  • Horde_Kolab_Server_Object_Kolab
  • Horde_Kolab_Server_Object_Kolab_Address
  • Horde_Kolab_Server_Object_Kolab_Administrator
  • Horde_Kolab_Server_Object_Kolab_Adminrole
  • Horde_Kolab_Server_Object_Kolab_Distlist
  • Horde_Kolab_Server_Object_Kolab_Domainmaintainer
  • Horde_Kolab_Server_Object_Kolab_Maintainer
  • Horde_Kolab_Server_Object_Kolab_User
  • Horde_Kolab_Server_Object_Kolabgermanbankarrangement
  • Horde_Kolab_Server_Object_Kolabgroupofnames
  • Horde_Kolab_Server_Object_Kolabinetorgperson
  • Horde_Kolab_Server_Object_Kolabpop3account
  • Horde_Kolab_Server_Object_Kolabsharedfolder
  • Horde_Kolab_Server_Object_Mcached
  • Horde_Kolab_Server_Object_Organizationalperson
  • Horde_Kolab_Server_Object_Person
  • Horde_Kolab_Server_Object_Top
  • Horde_Kolab_Server_Objects_Base
  • Horde_Kolab_Server_Query_Element_And
  • Horde_Kolab_Server_Query_Element_Approx
  • Horde_Kolab_Server_Query_Element_Begins
  • Horde_Kolab_Server_Query_Element_Contains
  • Horde_Kolab_Server_Query_Element_Ends
  • Horde_Kolab_Server_Query_Element_Equals
  • Horde_Kolab_Server_Query_Element_Greater
  • Horde_Kolab_Server_Query_Element_Group
  • Horde_Kolab_Server_Query_Element_Less
  • Horde_Kolab_Server_Query_Element_Mapped
  • Horde_Kolab_Server_Query_Element_Not
  • Horde_Kolab_Server_Query_Element_Or
  • Horde_Kolab_Server_Query_Element_Single
  • Horde_Kolab_Server_Query_Ldap
  • Horde_Kolab_Server_Result_Ldap
  • Horde_Kolab_Server_Schema_Base
  • Horde_Kolab_Server_Schema_Decorator_Cache
  • Horde_Kolab_Server_Search_Base
  • Horde_Kolab_Server_Search_Operation_Addressesforuidormail
  • Horde_Kolab_Server_Search_Operation_Attributes
  • Horde_Kolab_Server_Search_Operation_Base
  • Horde_Kolab_Server_Search_Operation_Children
  • Horde_Kolab_Server_Search_Operation_Constraint_Single
  • Horde_Kolab_Server_Search_Operation_Constraint_Strict
  • Horde_Kolab_Server_Search_Operation_Groupsformember
  • Horde_Kolab_Server_Search_Operation_Guid
  • Horde_Kolab_Server_Search_Operation_Guidforalias
  • Horde_Kolab_Server_Search_Operation_Guidforcn
  • Horde_Kolab_Server_Search_Operation_Guidforkolabusers
  • Horde_Kolab_Server_Search_Operation_Guidformail
  • Horde_Kolab_Server_Search_Operation_Guidformailoralias
  • Horde_Kolab_Server_Search_Operation_Guidforuid
  • Horde_Kolab_Server_Search_Operation_Guidforuidormail
  • Horde_Kolab_Server_Search_Operation_Guidforuidormailoralias
  • Horde_Kolab_Server_Search_Operation_Mailforuidormail
  • Horde_Kolab_Server_Search_Operation_Restrictgroups
  • Horde_Kolab_Server_Search_Operation_Restrictkolab
  • Horde_Kolab_Server_Structure_Attribute_Double
  • Horde_Kolab_Server_Structure_Attribute_Value
  • Horde_Kolab_Server_Structure_Base
  • Horde_Kolab_Server_Structure_Kolab
  • Horde_Kolab_Server_Structure_Ldap

Interfaces

  • Horde_Kolab_Server_Connection_Interface
  • Horde_Kolab_Server_Interface
  • Horde_Kolab_Server_List_Interface
  • Horde_Kolab_Server_Object_Attribute_Interface
  • Horde_Kolab_Server_Object_Interface
  • Horde_Kolab_Server_Object_Searches
  • Horde_Kolab_Server_Objects_Interface
  • Horde_Kolab_Server_Query_Element_Interface
  • Horde_Kolab_Server_Query_Interface
  • Horde_Kolab_Server_Result_Interface
  • Horde_Kolab_Server_Schema_Interface
  • Horde_Kolab_Server_Search_Interface
  • Horde_Kolab_Server_Search_Operation_Interface
  • Horde_Kolab_Server_Structure_Attribute_Interface
  • Horde_Kolab_Server_Structure_Interface
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * This class handles the db schema.
  4:  *
  5:  * PHP version 5
  6:  *
  7:  * @category Kolab
  8:  * @package  Kolab_Server
  9:  * @author   Gunnar Wrobel <wrobel@pardus.de>
 10:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 11:  * @link     http://pear.horde.org/index.php?package=Kolab_Server
 12:  */
 13: 
 14: /**
 15:  * This class handles the db schema.
 16:  *
 17:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
 18:  *
 19:  * See the enclosed file COPYING for license information (LGPL). If you
 20:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 21:  *
 22:  * @category Kolab
 23:  * @package  Kolab_Server
 24:  * @author   Gunnar Wrobel <wrobel@pardus.de>
 25:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 26:  * @link     http://pear.horde.org/index.php?package=Kolab_Server
 27:  */
 28: class Horde_Kolab_Server_Schema_Base
 29: implements Horde_Kolab_Server_Schema_Interface
 30: {
 31:     /**
 32:      * A link to the composite server handler.
 33:      *
 34:      * @var Horde_Kolab_Server_Composite
 35:      */
 36:     private $_composite;
 37: 
 38:     /**
 39:      * Set the composite server reference for this object.
 40:      *
 41:      * @param Horde_Kolab_Server_Composite $composite A link to the composite
 42:      *                                                server handler.
 43:      *
 44:      * @return NULL
 45:      */
 46:     public function setComposite(
 47:         Horde_Kolab_Server_Composite $composite
 48:     ) {
 49:         $this->_composite = $composite;
 50:     }
 51: 
 52:     /**
 53:      * Return the schema for the given objectClass.
 54:      *
 55:      * @param string $objectclass Fetch the schema for this objectClass.
 56:      *
 57:      * @return array The schema for the given objectClass.
 58:      *
 59:      * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
 60:      */
 61:     public function getObjectclassSchema($objectclass)
 62:     {
 63:         if (!empty($this->_config['schema_support'])) {
 64:             $schema = $this->_getSchema();
 65:             $info = $schema->get('objectclass', $objectclass);
 66:             $this->_handleError($info, Horde_Kolab_Server_Exception::SYSTEM);
 67:             return $info;
 68:         }
 69:         return parent::getObjectclassSchema($objectclass);
 70:     }
 71: 
 72:     /**
 73:      * Return the schema for the given attribute.
 74:      *
 75:      * @param string $attribute Fetch the schema for this attribute.
 76:      *
 77:      * @return array The schema for the given attribute.
 78:      *
 79:      * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
 80:      */
 81:     public function getAttributeSchema($attribute)
 82:     {
 83:         if (!empty($this->_config['schema_support'])) {
 84:             $schema = $this->_getSchema();
 85:             $info = $schema->get('attribute', $attribute);
 86:             $this->_handleError($info, Horde_Kolab_Server_Exception::SYSTEM);
 87:             return $info;
 88:         }
 89:         return parent::getAttributeSchema($attribute);
 90:     }
 91: 
 92:     /**
 93:      * Return the attributes supported by the given object class.
 94:      *
 95:      * @param string $class Determine the attributes for this class.
 96:      *
 97:      * @return array The supported attributes.
 98:      *
 99:      * @throws Horde_Kolab_Server_Exception If the schema analysis fails.
100:      */
101:     public function getExternalAttributes($class)
102:     {
103:         $childclass = get_class($class);
104:         $classes    = array();
105:         $level      = 0;
106:         while ($childclass != 'Horde_Kolab_Server_Object_Top'
107:                && $level < self::MAX_HIERARCHY) {
108:             $classes[]  = $childclass;
109:             $childclass = get_parent_class($childclass);
110:             $level++;
111:         }
112: 
113:         /** Finally add the basic object class */
114:         $classes[] = $childclass;
115: 
116:         //@todo: Throw exception here
117:         if ($level == self::MAX_HIERARCHY) {
118:             if (isset($this->logger)) {
119:                 $logger->err(sprintf('The maximal level of the object hierarchy has been exceeded for class \"%s\"!',
120:                                      $class));
121:             }
122:         }
123: 
124:         /**
125:          * Collect attributes from bottom to top.
126:          */
127:         $classes = array_reverse($classes);
128: 
129:         $attributes = array();
130: 
131:         foreach ($classes as $childclass) {
132:             $vars = get_class_vars($childclass);
133:             if (isset($vars['attributes'])) {
134:                 /**
135:                  * If the user wishes to adhere to the schema
136:                  * information from the server we will skip the
137:                  * attributes defined within the object class here.
138:                  */
139:                 if (!empty($this->params['schema_override'])) {
140:                     continue;
141:                 }
142:                 $attributes = array_merge($vars['attributes'], $attributes);
143:             }
144:         }
145: 
146: /*         $attrs = array(); */
147: 
148: /*         foreach ($object_classes as $object_class) { */
149: /*             $info = $this->getObjectclassSchema($object_class); */
150: /*             if (isset($info['may'])) { */
151: /*                 $defined = array_merge($defined, $info['may']); */
152: /*             } */
153: /*             if (isset($info['must'])) { */
154: /*                 $defined  = array_merge($defined, $info['must']); */
155: /*                 $required = array_merge($required, $info['must']); */
156: /*             } */
157: /*             foreach ($defined as $attribute) { */
158: /*                 try { */
159: /*                     $attrs[$attribute] = $this->getAttributeSchema($attribute); */
160: /*                 } catch (Horde_Kolab_Server_Exception $e) { */
161: /*                     /\** */
162: /*                      * If the server considers the attribute to be */
163: /*                      * invalid we mark it. */
164: /*                      *\/ */
165: /*                     $attrs[$attribute] = array('invalid' => true); */
166: /*                 } */
167: /*             } */
168: /*             foreach ($required as $attribute) { */
169: /*                 $attrs[$attribute]['required'] = true; */
170: /*             } */
171: /*             foreach ($locked as $attribute) { */
172: /*                 $attrs[$attribute]['locked'] = true; */
173: /*             } */
174: /*             foreach ($defaults as $attribute => $default) { */
175: /*                 $attrs[$attribute]['default'] = $default; */
176: /*             } */
177: /*             $attrs[Horde_Kolab_Server_Object::ATTRIBUTE_OC]['default'] = $object_classes; */
178: /*         } */
179: /*         foreach ($derived as $key => $attributes) { */
180: /*             $supported = true; */
181: /*             if (isset($attributes['base'])) { */
182: /*                 foreach ($attributes['base'] as $attribute) { */
183: /*                     /\** */
184: /*                      * Usually derived attribute are determined on basis */
185: /*                      * of one or more attributes. If any of these is not */
186: /*                      * supported the derived attribute should not be */
187: /*                      * included into the set of supported attributes. */
188: /*                      *\/ */
189: /*                     if (!isset($attrs[$attribute])) { */
190: /*                         unset($derived[$attribute]); */
191: /*                         $supported = false; */
192: /*                         break; */
193: /*                     } */
194: /*                 } */
195: /*             } */
196: /*             if ($supported) { */
197: /*                 $attrs[$key] = $attributes; */
198: /*             } */
199: /*         } */
200: /*         $check_collapsed = $collapsed; */
201: /*         foreach ($check_collapsed as $key => $attributes) { */
202: /*             if (isset($attributes['base'])) { */
203: /*                 foreach ($attributes['base'] as $attribute) { */
204: /*                     /\** */
205: /*                      * Usually collapsed attribute are determined on basis */
206: /*                      * of one or more attributes. If any of these is not */
207: /*                      * supported the collapsed attribute should not be */
208: /*                      * included into the set of supported attributes. */
209: /*                      *\/ */
210: /*                     if (!isset($attrs[$attribute])) { */
211: /*                         unset($collapsed[$attribute]); */
212: /*                     } */
213: /*                 } */
214: /*             } */
215: /*         } */
216: /*         $this->attributes[$class] = array($attrs, */
217: /*                                           array( */
218: /*                                               'derived'   => array_keys($derived), */
219: /*                                               'collapsed' => $collapsed, */
220: /*                                               'locked'    => $locked, */
221: /*                                               'required'  => $required)); */
222:         return $attributes;
223:     }
224: 
225:     /**
226:      * Stores the attribute definitions in the cache.
227:      *
228:      * @return Horde_Kolab_Server The concrete Horde_Kolab_Server reference.
229:      */
230:     public function shutdown()
231:     {
232:         if (isset($this->attributes)) {
233:             if (isset($this->cache)) {
234:                 foreach ($this->attributes as $key => $value) {
235:                     $this->cache->set('attributes_' . $key, @serialize($value));
236:                 }
237:             }
238:         }
239:     }
240: 
241: 
242: }
API documentation generated by ApiGen