db->autoCommit(false); $f->addToLog("app/om_filestorage_migrate.php: db->autocommit(false);", VERBOSE_MODE); // $files = array( "commission" => array( "pkey" => array( "field" => "commission", "type" => "N", ), "file_fields" => array("om_fichier_commission_ordre_jour" => "NULL", "om_fichier_commission_compte_rendu" => "NULL", ), ), "consultation" => array( "pkey" => array( "field" => "consultation", "type" => "N", ), "file_fields" => array("om_fichier_consultation" => "NULL", "fichier" => "NULL", ), ), "document_numerise" => array( "pkey" => array( "field" => "document_numerise", "type" => "N", ), "file_fields" => array("uid" => "NULL", ) ), "instruction" => array( "pkey" => array( "field" => "instruction", "type" => "N", ), "file_fields" => array("om_fichier_instruction" => "NULL"), ), "om_logo" => array( "pkey" => array( "field" => "om_logo", "type" => "N", ), "file_fields" => array("fichier" => "NULL", ), ), "rapport_instruction" => array( "pkey" => array( "field" => "rapport_instruction", "type" => "N", ), "file_fields" => array("om_fichier_rapport_instruction" => "NULL", ), ), ); // $source_conf = array( "storage" => "deprecated", "path" => "../trs/1/", ); require_once PATH_OPENMAIRIE."om_filestorage_".$source_conf["storage"].".class.php"; $class_name = 'filestorage_'.$source_conf["storage"]; $storage_source = new $class_name($source_conf); // $destination_conf = array( "storage" => "filesystem", "path" => "../trs/1/", ); require_once PATH_OPENMAIRIE."om_filestorage_".$destination_conf["storage"].".class.php"; $class_name = 'filestorage_'.$destination_conf["storage"]; $storage_destination = new $class_name($destination_conf); // $uids_created = array(); // $old_files_to_delete = array(); // foreach ($files as $table => $params) { // $error = false; // $uids_created_table = array(); // $old_files_to_delete_table = array(); foreach ($params["file_fields"] as $field => $constraint ) { // echo "

"; echo $table." => ".$field; echo "

"; // echo ""; } // if ($error === true || $error === NULL) { // $f->db->rollback(); $f->addToLog("app/om_filestorage_migrate.php: db->rollback();", VERBOSE_MODE); // foreach($uids_created_table as $uid_created_table) { // $storage_destination->delete($uid_created_table); } } else { // $f->db->commit(); $f->addToLog("app/om_filestorage_migrate.php: db->commit();", VERBOSE_MODE); // $old_files_to_delete_table = array_unique($old_files_to_delete_table); foreach($old_files_to_delete_table as $old_file_to_delete_table) { // $storage_source->delete($old_file_to_delete_table); } } } ?>