aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php
blob: fe2af99282595a1fa157530d08ff7067ce0f5500 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
/**
 * Elgg 1.8-svn upgrade 2011030700
 * blog_status_metadata
 *
 * Add a "status" metadata entry to every blog entity because in 1.8 you can have status = draft or
 * status = published
 */
$ia = elgg_set_ignore_access(true);
$options = array(
	'type' => 'object',
	'subtype' => 'blog',
	'limit' => 0,
);
$batch = new ElggBatch('elgg_get_entities', $options);

foreach ($batch as $entity) {
	if (!$entity->status) {
		// create metadata owned by the original owner
		create_metadata($entity->getGUID(), 'status', 'published', '', $entity->owner_guid,
			$entity->access_id);
	}
}
elgg_set_ignore_access($ia);