Example #1
0
 * the engine loading time.
 */
// Migrate also directories that belong to hidden users
$access_status = access_get_show_hidden_status();
access_show_hidden_entities(true);
$helper = new Elgg\Upgrades\Helper2013022000(elgg_get_site_entity()->guid, elgg_get_config('dbprefix'));
// from engine/start.php
global $START_MICROTIME;
$batch_run_time_in_secs = 2;
$data_root = elgg_get_config('dataroot');
$cleanup_years = array();
$num_successes = 0;
$num_errors = 0;
$is_complete = true;
_elgg_services()->db->disableQueryCache();
$batch = new ElggBatch('elgg_get_entities', $helper->getBatchOptions(), null, 50, false);
foreach ($batch as $user_row) {
    if (microtime(true) - $START_MICROTIME > $batch_run_time_in_secs) {
        $is_complete = false;
        break;
    }
    $guid = $user_row->guid;
    $from = $data_root . $helper->makeMatrix($user_row);
    $bucket_dir = $data_root . $helper->getLowerBucketBound($guid);
    $to = "{$bucket_dir}/{$guid}";
    if (!is_dir($from)) {
        $num_successes += 1;
        $helper->markSuccess($guid);
        continue;
    }
    // make sure bucket dir exists