Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
ldap_user_group_management.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset_management.inc';
19 
31 {
32 
33 
39  {
40  $this->Asset_Management($pm);
41 
42  }//end constructor
43 
44 
53  function _upgrade($current_version)
54  {
55  // first do things as normal
56  $res = parent::_upgrade($current_version);
57 
58  if (version_compare($current_version, '0.2', '<')) {
59  echo 'UPGRADING LDAP USER GROUP TO v0.2';
60  // move the data path data
61  $bridge_ids = $GLOBALS['SQ_SYSTEM']->am->getTypeAssetids('ldap_bridge');
62  foreach ($bridge_ids as $bridge_id) {
63  $bridge =& $GLOBALS['SQ_SYSTEM']->am->getAsset($bridge_id);
64  $groups = $bridge->getChildren($bridge_id);
65  foreach ($groups as $groupid => $type) {
66  if ($type != 'ldap_user_group') continue;
67  $asset =& $GLOBALS['SQ_SYSTEM']->am->getAsset($groupid, 'ldap_user_group');
68  $dn = substr($asset->id, strpos($asset->id, ':') + 1);
69  $old_data_path = $bridge->data_path.'/'.$dn;
70  $old_data_path_public = $bridge->data_path_public.'/'.$dn;
71  if (is_dir($old_data_path)) {
72  copy_directory($old_data_path, $asset->data_path);
73  delete_directory($old_data_path);
74  }
75  if (is_dir($old_data_path_public)) {
76  copy_directory($old_data_path_public, $asset->data_path_public);
77  delete_directory($old_data_path);
78  }
79  }
80  }
81  }
82 
83  return $res;
84 
85  }//end _upgrade()
86 
87 
88 }//end class
89 
90 ?>