Beispiel #1
0
<?php

/**
 * Move user data directories
 * 
 * Run for 2 seconds per request as set by $batch_run_time_in_secs. This includes
 * 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}";
Beispiel #2
0
<?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->getUpgradeFromPath('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);