* Convert comment annotations to entities. * * Register comment subtype and add ElggUpgrade for ajax upgrade. * * We do not migrate comments in this upgrade. See the comment * upgrade action in actions/admin/upgrades/upgrade_comments.php for that. */ // Register subtype and class for comments if (get_subtype_id('object', 'comment')) { update_subtype('object', 'comment', 'ElggComment'); } else { add_subtype('object', 'comment', 'ElggComment'); } $access_status = access_get_show_hidden_status(); access_show_hidden_entities(true); $ia = elgg_set_ignore_access(true); // add ElggUpgrade object if need to migrate comments $options = array('annotation_names' => 'generic_comment', 'order_by' => 'n_table.id DESC', 'count' => true); if (elgg_get_annotations($options)) { $url = "admin/upgrades/comments"; $upgrade = new ElggUpgrade(); // Create the upgrade if one with the same URL doesn't already exist if (!$upgrade->getUpgradeFromURL($url)) { $upgrade->setURL($url); $upgrade->title = 'Comments Upgrade'; $upgrade->description = 'Comments have been improved in Elgg 1.9 and require a migration. Run this upgrade to complete the migration.'; $upgrade->save(); } } elgg_set_ignore_access($ia); access_show_hidden_entities($access_status);
<?php /** * Convert discussion replies from annotations to entities * * Run for 2 seconds per request as set by $batch_run_time_in_secs. This includes * the engine loading time. */ // from engine/start.php global $START_MICROTIME; $batch_run_time_in_secs = 2; if (get_input('upgrade_completed')) { // set the upgrade as completed $factory = new ElggUpgrade(); $upgrade = $factory->getUpgradeFromURL('/admin/upgrades/discussion_replies'); if ($upgrade instanceof ElggUpgrade) { $upgrade->setCompleted(); } return true; } // Offset is the total amount of errors so far. We skip these // annotations to prevent them from possibly repeating the same error. $offset = get_input('offset', 0); $limit = 50; $access_status = access_get_show_hidden_status(); access_show_hidden_entities(true); // don't want any event or plugin hook handlers from plugins to run $original_events = _elgg_services()->events; $original_hooks = _elgg_services()->hooks; _elgg_services()->events = new Elgg\EventsService(); _elgg_services()->hooks = new Elgg\PluginHooksService();
<?php /** * Convert comment annotations to entities * * Run for 2 seconds per request as set by $batch_run_time_in_secs. This includes * the engine loading time. */ // from engine/start.php global $START_MICROTIME; $batch_run_time_in_secs = 2; // if upgrade has run correctly, mark it done if (get_input('upgrade_completed')) { // set the upgrade as completed $factory = new ElggUpgrade(); $upgrade = $factory->getUpgradeFromURL('/admin/upgrades/comments'); if ($upgrade instanceof ElggUpgrade) { $upgrade->setCompleted(); } return true; } // Offset is the total amount of errors so far. We skip these // comments to prevent them from possibly repeating the same error. $offset = get_input('offset', 0); $limit = 50; $access_status = access_get_show_hidden_status(); access_show_hidden_entities(true); // don't want any event or plugin hook handlers from plugins to run $original_events = _elgg_services()->events; $original_hooks = _elgg_services()->hooks; _elgg_services()->events = new Elgg_EventsService();
<?php /** * Data dirs upgrade page */ // Upgrade also possible hidden users. This feature get run // by an administrator so there's no need to ignore access. $access_status = access_get_show_hidden_status(); access_show_hidden_entities(true); $factory = new ElggUpgrade(); $upgrade = $factory->getUpgradeFromURL('/admin/upgrades/datadirs'); if ($upgrade->isCompleted()) { $count = 0; } else { $helper = new Elgg_Upgrades_Helper2013022000(elgg_get_site_entity()->guid, elgg_get_config('dbprefix')); $helper->forgetFailures(); $count = $helper->countUnmigratedUsers(); } echo elgg_view('admin/upgrades/view', array('count' => $count, 'action' => 'action/admin/upgrades/upgrade_datadirs')); access_show_hidden_entities($access_status);