<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/index.php?action=history&amp;feed=atom&amp;title=Document_Management_API</id>
	<title>Document Management API - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/index.php?action=history&amp;feed=atom&amp;title=Document_Management_API"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Document_Management_API&amp;action=history"/>
	<updated>2026-07-03T10:43:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Document_Management_API&amp;diff=42972&amp;oldid=prev</id>
		<title>Skodak at 12:37, 10 November 2013</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Document_Management_API&amp;diff=42972&amp;oldid=prev"/>
		<updated>2013-11-10T12:37:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:37, 10 November 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{obsolete}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This page is for (rapidly!) designing the new DMS APIs.  As Martin says, &amp;quot;Basically we&amp;#039;ll have an API that interfaces Moodle files handling everywhere via a plugin to the chosen repository (or repositories). This allows us to use all the great repositories are around without needing to restrict ourselves to just one.&amp;quot;  ([http://moodle.org/mod/forum/discuss.php?d=4380 relevant forum post])&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This page is for (rapidly!) designing the new DMS APIs.  As Martin says, &amp;quot;Basically we&amp;#039;ll have an API that interfaces Moodle files handling everywhere via a plugin to the chosen repository (or repositories). This allows us to use all the great repositories are around without needing to restrict ourselves to just one.&amp;quot;  ([http://moodle.org/mod/forum/discuss.php?d=4380 relevant forum post])&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Skodak</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Document_Management_API&amp;diff=26414&amp;oldid=prev</id>
		<title>Deraadt: Created page with &quot;This page is for (rapidly!) designing the new DMS APIs.  As Martin says, &quot;Basically we&#039;ll have an API that interfaces Moodle files handling everywhere via a plugin to the chosen ...&quot;</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Document_Management_API&amp;diff=26414&amp;oldid=prev"/>
		<updated>2011-06-22T07:13:52Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This page is for (rapidly!) designing the new DMS APIs.  As Martin says, &amp;quot;Basically we&amp;#039;ll have an API that interfaces Moodle files handling everywhere via a plugin to the chosen ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page is for (rapidly!) designing the new DMS APIs.  As Martin says, &amp;quot;Basically we&amp;#039;ll have an API that interfaces Moodle files handling everywhere via a plugin to the chosen repository (or repositories). This allows us to use all the great repositories are around without needing to restrict ourselves to just one.&amp;quot;  ([http://moodle.org/mod/forum/discuss.php?d=4380 relevant forum post])&lt;br /&gt;
&lt;br /&gt;
This is an interesting thing to do, because some DMS backends will provide features that others don&amp;#039;t provide, and Moodle will/may have to provide those features transparently for backends that don&amp;#039;t.&lt;br /&gt;
&lt;br /&gt;
This is a first pass at doing this, and the naming conventions I&amp;#039;m using are intended to be clear but not necessarily to indicate what I think these things should really be called in code.&lt;br /&gt;
&lt;br /&gt;
==DMS Properties Object==&lt;br /&gt;
class dms_document_properties&lt;br /&gt;
&lt;br /&gt;
var $id;&lt;br /&gt;
&lt;br /&gt;
var $name;&lt;br /&gt;
&lt;br /&gt;
var $author;&lt;br /&gt;
&lt;br /&gt;
var $directory;&lt;br /&gt;
&lt;br /&gt;
// every time a separate module/instance refers to this document, refcount is bumped.  When refcount==0, bye-bye, document!&lt;br /&gt;
&lt;br /&gt;
// Hopefully most DMS backends will already implement this sort of thing themselves, so those plugins don&amp;#039;t have to mess with this.&lt;br /&gt;
&lt;br /&gt;
var $refcount;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var $credentials; // username, password, stuff like that&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/* OK, some shameless module promotion here.  I&amp;#039;ve implemented a generic access_control module that I think could be useful here.  Maybe it&amp;#039;s duplicating some other functionality I just don&amp;#039;t know about yet and maybe it has horrible problems that haven&amp;#039;t been pointed out to me yet, but I&amp;#039;ll mention it here just the same.  It&amp;#039;s under contrib/ in the [http://moodle.org/download/modules/portfolio.zip portfolio module]. */&lt;br /&gt;
&lt;br /&gt;
var $access_control; // object with access control specification/methods&lt;br /&gt;
&lt;br /&gt;
==DMS Data Object==&lt;br /&gt;
class dms_document&lt;br /&gt;
&lt;br /&gt;
var $dms_document_properties;&lt;br /&gt;
&lt;br /&gt;
var $content;&lt;br /&gt;
&lt;br /&gt;
var $pwd;  // I&amp;#039;m not sure I like this.  You can traipse around the filesystem carrying $content and the content&amp;#039;s $dms_document_properties-&amp;gt;directory along with you?&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
/* This is just a first pass to get something on the table. */&lt;br /&gt;
&lt;br /&gt;
get_document_content();&lt;br /&gt;
&lt;br /&gt;
Content of the document sufficiently specified by $this-&amp;gt;dms_document_properties is fetched from DMS backend.&lt;br /&gt;
&lt;br /&gt;
Returns: value of $this-&amp;gt;id, or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
put_document_content();&lt;br /&gt;
&lt;br /&gt;
Content of document sufficiently specified by $this-&amp;gt;dms_document_properties is stored/updated in DMS backend.&lt;br /&gt;
&lt;br /&gt;
Returns: value of $this-&amp;gt;id, or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
get_document_properties();&lt;br /&gt;
&lt;br /&gt;
Full properties of the document sufficiently specified by $this-&amp;gt;dms_document_properties (id, owner, title, etc.) are fetched from DMS backend.&lt;br /&gt;
&lt;br /&gt;
Returns: dms_document_properties object, or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
access_change($access_object);&lt;br /&gt;
&lt;br /&gt;
Change the access un/specified for $this according to the $access_object specification (type of access, grant/deny/revoke, designee, etc.)&lt;br /&gt;
&lt;br /&gt;
Returns: true/false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
access_test($access_object);&lt;br /&gt;
&lt;br /&gt;
Check to see whether the specified $access_object describes access that has been granted to $this.&lt;br /&gt;
&lt;br /&gt;
Returns: true if specified access is granted, false otherwise&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
delete();&lt;br /&gt;
&lt;br /&gt;
Decrements the refcount and deletes $this if refcount==0.  Hopefully most DMSes already have their own refcount (or whatever); I&amp;quot;m shooting from the hip here.&lt;br /&gt;
&lt;br /&gt;
Returns: true/false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
move($new_directory_path);&lt;br /&gt;
&lt;br /&gt;
Moves the document from its present directory to the specified new one.&lt;br /&gt;
&lt;br /&gt;
Returns: true/false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
link_that_to_me($new_dms_document);&lt;br /&gt;
&lt;br /&gt;
Make $new_dms_document&amp;#039;s directory, name, owner, etc., refer to $this.  (Think of a UNIX hard link, where the inode -- in our case, id -- gets another reference.)&lt;br /&gt;
&lt;br /&gt;
Returns: true/false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
link_me_to_that($old_dms_document);&lt;br /&gt;
&lt;br /&gt;
Make $this refer to $old_dms_document.  (Think of a UNIX hard link, where the inode -- in our case, id -- gets another reference.)&lt;br /&gt;
&lt;br /&gt;
Returns: true/false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
copy_this_to($new_dms_document);&lt;br /&gt;
&lt;br /&gt;
Copies $this into the directory_path, owner, title, etc. specified by $new_dms_document.&lt;br /&gt;
&lt;br /&gt;
Returns: $new_dms_document-&amp;gt;id, or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
copy_this_from($old_dms_document);&lt;br /&gt;
&lt;br /&gt;
Copies $old_dms_document into the directory_path, owner, title, etc. specified by $this.&lt;br /&gt;
&lt;br /&gt;
Returns: $this-&amp;gt;id, or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
lock();&lt;br /&gt;
&lt;br /&gt;
Locks $this.&lt;br /&gt;
&lt;br /&gt;
Returns: true/false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
unlock();&lt;br /&gt;
&lt;br /&gt;
Unlocks $this.&lt;br /&gt;
&lt;br /&gt;
Returns: true/false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
break_lock();&lt;br /&gt;
&lt;br /&gt;
Forcibly unlocks $this.&lt;br /&gt;
&lt;br /&gt;
Returns: true/false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
mkdir($new_dir);&lt;br /&gt;
&lt;br /&gt;
Make the specified new directory, including necessary parent directories as required (perhaps if an additional boolean parameter is set).&lt;br /&gt;
&lt;br /&gt;
Returns: true/false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
pwd();&lt;br /&gt;
&lt;br /&gt;
Get the present working directory.&lt;br /&gt;
&lt;br /&gt;
Returns: present working directory as a string, or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
chdir($new_directory_path);&lt;br /&gt;
&lt;br /&gt;
Change PWD to the specified $new_directory_path, which can be absolute or relative.&lt;br /&gt;
&lt;br /&gt;
Returns: true/false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
list();&lt;br /&gt;
&lt;br /&gt;
List the files/directories in $pwd.&lt;br /&gt;
&lt;br /&gt;
Returns: array of document_properties of all the files/directories in $pwd, or false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
get_property($property_name);&lt;br /&gt;
&lt;br /&gt;
Get the named property from $this-&amp;gt;dms_document_properties.&lt;br /&gt;
&lt;br /&gt;
Returns: value of property, or false   (er... &amp;#039;false&amp;#039; on failure?)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
set_property($property_name, $value);&lt;br /&gt;
&lt;br /&gt;
Set the named property in $this-&amp;gt;dms_document_properties.&lt;br /&gt;
&lt;br /&gt;
Returns: true/false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
get_my_url();&lt;br /&gt;
&lt;br /&gt;
Return a URL that points to the document specified by $this, if possible.&lt;br /&gt;
&lt;br /&gt;
Returns: URL or false&lt;br /&gt;
&lt;br /&gt;
===Other methods===&lt;br /&gt;
change_owner();&lt;br /&gt;
&lt;br /&gt;
==Other Considerations==&lt;br /&gt;
* Will the plugged-in DMS store access controls, or will Moodle handle those?  (I think it best to let Moodle handle them but perhaps also pass-through as well as possible; not all external DMSes will have the same or sufficient access controls.)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=41026 RFC - Remote object repositories -- consolidating implementations] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Project]]&lt;/div&gt;</summary>
		<author><name>Deraadt</name></author>
	</entry>
</feed>