Changeset 4313
- Timestamp:
- 10/06/06 21:45:48 (2 years ago)
- Files:
-
- trunk/support/migrate_26.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/support/migrate_26.php
r4184 r4313 50 50 if (PEAR::isError($args)) 51 51 { 52 $header = "Usage: " .basename($ _SERVER['SCRIPT_NAME'])." [options]\n\n" ;52 $header = "Usage: " .basename($GLOBALS['argv'][0])." [options]\n\n" ; 53 53 if ($args->getCode() === CONSOLE_GETARGS_ERROR_USER) 54 54 { … … 83 83 84 84 // Map components 85 $qb_component = new midgard_query_builder('midgard_parameter');85 $qb_component = new MidgardQueryBuilder('midgard_parameter'); 86 86 $qb_component->add_constraint('domain', '=', 'midcom'); 87 87 $qb_component->add_constraint('name', '=', 'component'); … … 123 123 124 124 // Clear style parameters 125 $qb_style = new midgard_query_builder('midgard_parameter');125 $qb_style = new MidgardQueryBuilder('midgard_parameter'); 126 126 $qb_style->add_constraint('domain', '=', 'midcom'); 127 127 $qb_style->add_constraint('tablename', '=', 'topic'); … … 144 144 145 145 // Convert topic owner to midcom_core_privilege_db object 146 $qb_topic = new midgard_query_builder('midgard_topic');146 $qb_topic = new MidgardQueryBuilder('midgard_topic'); 147 147 $qb_topic->add_constraint('owner', '<>', 0); 148 148 $topics = $qb_topic->execute(); … … 175 175 176 176 // Convert old ViewerGroups parameters to midcom_core_privilege_db objects 177 $qb_vg = new midgard_query_builder('midgard_parameter');177 $qb_vg = new MidgardQueryBuilder('midgard_parameter'); 178 178 $qb_vg->add_constraint('domain', '=', 'ViewerGroups'); 179 179 $qb_vg->add_constraint('tablename', '=', 'topic'); … … 198 198 $topic_cache[$topic_id] = $topic; 199 199 } 200 // Any other privileges that may be inherited stupidly and possibly override the midgard:read 201 $names = array ('midgard:read', 'midcom.admin.folder:topic_management'); 200 202 $topic =& $topic_cache[$topic_id]; 201 $acl = new midcom_core_privilege_db(); 202 $acl->objectguid = $topic->guid; 203 $acl->name = 'midgard:read'; 204 $acl->assignee = 'EVERYONE'; 205 $acl->value = 2; //MIDCOM_PRIVILEGE_DENY 206 if (!$acl->create()) 207 { 208 echo "ERROR: could not create '{$acl->name} / {$acl->value}' privilige for '{$acl->assignee}' (concerning object {$acl->objectguid})\n"; 209 continue; 203 foreach ($names as $name) 204 { 205 $acl = new midcom_core_privilege_db(); 206 $acl->objectguid = $topic->guid; 207 $acl->name = $name; 208 $acl->assignee = 'EVERYONE'; 209 $acl->value = 2; //MIDCOM_PRIVILEGE_DENY 210 if (!$acl->create()) 211 { 212 echo "ERROR: could not create '{$acl->name} / {$acl->value}' privilige for '{$acl->assignee}' (concerning object {$acl->objectguid})\n"; 213 continue; 214 } 210 215 } 211 216 foreach ($grp_guids as $grp_guid) … … 214 219 $acl->objectguid = $topic->guid; 215 220 $acl->name = 'midgard:read'; 216 $acl->assignee = "group:{$grp_guid}"; 221 if ($grp_guid == 'all') 222 { 223 $acl->assignee = 'USERS'; 224 } 225 else 226 { 227 $acl->assignee = "group:{$grp_guid}"; 228 } 217 229 $acl->value = 1; //MIDCOM_PRIVILEGE_ALLOW 218 230 if (!$acl->create()) … … 234 246 // Convert parameters metadata/keywords & metadata/target values CSV to PSV (and add extr pipes to start and end as well fro DM2s benefit) 235 247 /* 236 $qb_md = new midgard_query_builder('midgard_parameter');248 $qb_md = new MidgardQueryBuilder('midgard_parameter'); 237 249 $qb_md->add_constraint('domain', '=', 'metadata'); 238 250 $qb_md->begin_group('OR'); … … 255 267 // Clean up article expiry 256 268 /* 257 $qb_exp = new midgard_query_builder('midgard_article');269 $qb_exp = new MidgardQueryBuilder('midgard_article'); 258 270 $qb_exp->begin_group('OR'); 259 271 $qb_exp->add_constraint('extra1', 'LIKE', '%.%.%');
