Skip to content

Commit

Permalink
Remove metadata code see #1370
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Apr 1, 2015
1 parent 80982cc commit 0c0a2bf
Show file tree
Hide file tree
Showing 50 changed files with 5 additions and 10,360 deletions.
5 changes: 1 addition & 4 deletions main/document/edit_document.php
Expand Up @@ -458,12 +458,9 @@
}

if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) {
$metadata_link = '<a href="../metadata/index.php?eid='.urlencode('Document.'.$document_data['id']).'">'.get_lang('AddMetadata').'</a>';

//Updated on field
// Updated on field
$last_edit_date = api_get_local_time($last_edit_date);
$display_date = date_to_str_ago($last_edit_date).' <span class="dropbox_date">'.api_format_date($last_edit_date).'</span>';
$form->addElement('static', null, get_lang('Metadata'), $metadata_link);
$form->addElement('static', null, get_lang('UpdatedOn'), $display_date);
}

Expand Down
1 change: 0 additions & 1 deletion main/inc/lib/add_course.lib.inc.php
Expand Up @@ -284,7 +284,6 @@ public static function get_course_tables()
$tables[] = 'thematic';
$tables[] = 'thematic_plan';
$tables[] = 'thematic_advance';
$tables[] = 'metadata';

return $tables;
}
Expand Down
3 changes: 0 additions & 3 deletions main/inc/lib/database.constants.inc.php
Expand Up @@ -294,9 +294,6 @@
define('TABLE_MESSAGE', 'message');
define('TABLE_MESSAGE_ATTACHMENT', 'message_attachment');

// Metadata
define('TABLE_METADATA', 'metadata');

// Attendance Sheet
define('TABLE_ATTENDANCE', 'attendance');
define('TABLE_ATTENDANCE_CALENDAR', 'attendance_calendar');
Expand Down
16 changes: 0 additions & 16 deletions main/inc/lib/document.lib.php
Expand Up @@ -1045,25 +1045,9 @@ public static function deleteDocumentFromDb(
$sql = "DELETE FROM $TABLE_DOCUMENT
WHERE c_id = {$course_info['real_id']} AND id = ".$document_id;
Database::query($sql);
self::delete_document_metadata($document_id);
}
}

/**
* @param int $document_id
*/
public static function delete_document_metadata($document_id)
{
// needed to deleted medadata
require_once api_get_path(SYS_CODE_PATH) . 'metadata/md_funcs.php';
$mdStore = new mdstore(true);

//delete metadata
$eid = 'Document' . '.' . $document_id;
$mdStore->mds_delete($eid);
$mdStore->mds_delete_offspring($eid);
}

/**
* This deletes a document by changing visibility to 2, renaming it to filename_DELETED_#id
* Files/folders that are inside a deleted folder get visibility 2
Expand Down
14 changes: 0 additions & 14 deletions main/inc/lib/fileManage.lib.php
Expand Up @@ -25,20 +25,6 @@ function update_db_info($action, $old_path, $new_path = '')
$old_path = Database::escape_string($old_path);
$to_delete = "WHERE c_id = $course_id AND (path LIKE BINARY '".$old_path."' OR path LIKE BINARY '".$old_path."/%')";
$query = "DELETE FROM $dbTable " . $to_delete;
$result = Database::query("SELECT id FROM $dbTable " . $to_delete);

if (Database::num_rows($result)) {
require_once api_get_path(INCLUDE_PATH).'../metadata/md_funcs.php';
$mdStore = new mdstore(TRUE); // create if needed

$md_type = (substr($dbTable, -13) == 'scormdocument') ? 'Scorm' : 'Document';

while ($row = Database::fetch_array($result)) {
$eid = $md_type . '.' . $row['id'];
$mdStore->mds_delete($eid);
$mdStore->mds_delete_offspring($eid);
}
}
Database::query($query);
break;
case 'update':
Expand Down

0 comments on commit 0c0a2bf

Please sign in to comment.