예제 #1
0
error_reporting(15);
$tree = array();
sql::display(1);
$nbr_items_per_table = 20;
$dirs = ModuleManager::getAllModules();
$contactsrandomapi = true;
// Detection si real contacts est set
if (in_array("--realcontacts", $argv) || 1) {
    $fields = OrmNode::getFieldsFor('contacts');
    $dir = 'contacts';
    if (sql::tableExists($dir)) {
        unset($fields);
        $toinclude = PATH_MODULES . $dir . PATH_SEP . "fields.php";
        include $toinclude;
        for ($j = 0; $j < $nbr_items_per_table + 100; $j++) {
            $data = DataNode::peopleTableContacts($dir, $fields);
            $obj = new OrmNode();
            $allFields = array_keys($fields);
            $obj->upsert($dir, $allFields, $data);
            print_r($data);
        }
    }
    // Création de toutes les jointures
    $fields = OrmNode::getFieldsFor($dir);
    foreach ($fields as $name => $field) {
        if ($field['type'] == 'join') {
            $joinmodule = $field['join']['table'];
            $orm = new OrmNode();
            $alldata = $orm->getAllData($joinmodule, array('id' => 'id'));
            foreach ($alldata as $d) {
                $randjoin = rand(1, $nbr_items_per_table);