<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AXMLDB_splitting_datalib.php</id>
	<title>Development:XMLDB splitting datalib.php - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AXMLDB_splitting_datalib.php"/>
	<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:XMLDB_splitting_datalib.php&amp;action=history"/>
	<updated>2026-05-06T21:44:43Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:XMLDB_splitting_datalib.php&amp;diff=12230&amp;oldid=prev</id>
		<title>Олег Давидович: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:XMLDB_splitting_datalib.php&amp;diff=12230&amp;oldid=prev"/>
		<updated>2024-10-21T08:59:24Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 08:59, 21 октября 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Олег Давидович</name></author>
	</entry>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:XMLDB_splitting_datalib.php&amp;diff=12229&amp;oldid=prev</id>
		<title>1&gt;Stronk7: /* Details */</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:XMLDB_splitting_datalib.php&amp;diff=12229&amp;oldid=prev"/>
		<updated>2008-07-31T18:04:58Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Details&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Development:XMLDB Documentation|XMLDB Documentation]] &amp;gt; [[Development:XMLDB roadmap|Roadmap]] &amp;gt; Splitting datalib.php&lt;br /&gt;
----&lt;br /&gt;
The main objective for this point is to isolate Moodle DML functions to one library and DDL functions to another one. This point must be performed before any other point in order to have everything in place before starting to modify everything else.&lt;br /&gt;
&lt;br /&gt;
Currently there are &amp;#039;&amp;#039;&amp;#039;94&amp;#039;&amp;#039;&amp;#039; functions defined in lib/datalib.php where most of them (50) are not directly related with DML or DDL statements at all but with some commonly used DB transactions (let&amp;#039;s call them &amp;#039;&amp;#039;&amp;#039;functional&amp;#039;&amp;#039;&amp;#039; functions. The rest (44) are &amp;#039;&amp;#039;&amp;#039;core&amp;#039;&amp;#039;&amp;#039; functions (from the perspective of being general, used by any script, to access to any table info), used to access to DB (with 42 functions used to handle data - DML - and 2 functions used to handle objects - DDL).&lt;br /&gt;
&lt;br /&gt;
With the adoption of one XMLDB schema, the number of DDL functions will grown beyond its current limits, to have a collection of functions able to perform any operation with DB objects in a common way. Functions to create/alter/drop tables, fields, indexes and constraints will be necessary.&lt;br /&gt;
&lt;br /&gt;
All these DDL functions will be used exclusively at install/upgrade time, so it would be a good idea to put all them together in a new library (ddllib.php), included only when necessary. &lt;br /&gt;
&lt;br /&gt;
Also, it would be great to separate all those 44 &amp;#039;&amp;#039;&amp;#039;core&amp;#039;&amp;#039;&amp;#039; functions from the other 50 &amp;#039;&amp;#039;&amp;#039;functional&amp;#039;&amp;#039;&amp;#039; functions, in order to have everything isolated in its own library.&lt;br /&gt;
&lt;br /&gt;
It seems that there are two approaches for all these changes:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Create two new libraries&amp;#039;&amp;#039;&amp;#039; (ddllib.php and dmllib.php) and &amp;#039;&amp;#039;&amp;#039;leave datalib.php for &amp;#039;&amp;#039;&amp;#039;functional&amp;#039;&amp;#039;&amp;#039; functions&amp;#039;&amp;#039;&amp;#039;. It&amp;#039;s simple, clear, with both datalib and dmllib being included always and ddllib only when necessary. Along the time (after 1.7 release) we could reduce datalib.php by moving their remaining functions to other libraries (course/lib.php, user/lib.php...). Until then we&amp;#039;ll be including all the 90 functions for each request, so memory/process requirements will continue high (not higher than 1.6). And some functions will be out of their &amp;#039;&amp;#039;natural&amp;#039;&amp;#039; place (i.e. a bit more disordered). This solution is 100% compatible with 3rd part modules because everything will continue being automatically available.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Create one new library&amp;#039;&amp;#039;&amp;#039; (dddlib.php), &amp;#039;&amp;#039;&amp;#039;leaving datalib.php for &amp;#039;&amp;#039;&amp;#039;core&amp;#039;&amp;#039;&amp;#039; functions&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;move &amp;#039;&amp;#039;&amp;#039;functional&amp;#039;&amp;#039;&amp;#039; functions to other libraries&amp;#039;&amp;#039;&amp;#039;. This alternative is more &amp;#039;&amp;#039;radical&amp;#039;&amp;#039; because a lot of scripts must be changed in order to allow everything to continue working, but every function will finish in its correct place. Memory/process requirements will be lower because &amp;#039;&amp;#039;&amp;#039;functional&amp;#039;&amp;#039;&amp;#039; functions will be included only if necessary. This solution &amp;#039;&amp;#039;&amp;#039;won&amp;#039;t be compatible with 3rd part modules&amp;#039;&amp;#039;&amp;#039; because some functions won&amp;#039;t be automatically available.&lt;br /&gt;
&lt;br /&gt;
After analysing both alternatives, I think that &amp;#039;&amp;#039;&amp;#039;the 1st one is better&amp;#039;&amp;#039;&amp;#039;, less radical and will provide us and 3rd part developers with time to smoothly upgrade everything later (Moodle 2.0 could be a good moment to have all those &amp;#039;&amp;#039;&amp;#039;functional&amp;#039;&amp;#039;&amp;#039; functions moved to their final place.&lt;br /&gt;
&lt;br /&gt;
All the work should be performed in one branch, call it &amp;#039;&amp;#039;&amp;#039;MOODLE_17_DB_LIBRARIES&amp;#039;&amp;#039;&amp;#039; and merge it back to HEAD &amp;#039;&amp;#039;&amp;#039;before&amp;#039;&amp;#039;&amp;#039; starting with [[XMLDB_Modifying_DML_functions|Point 2: Modifying DML functions]]&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
&lt;br /&gt;
# Create the &amp;#039;&amp;#039;&amp;#039;MOODLE_17_DB_LIBRARIES&amp;#039;&amp;#039;&amp;#039; branch.&lt;br /&gt;
# Create the new &amp;#039;&amp;#039;&amp;#039;dmllib.php&amp;#039;&amp;#039;&amp;#039; library where all the [[Development:DML functions|DML functions]] will exist, moving them from &amp;#039;&amp;#039;&amp;#039;datalib.php&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
# Always &amp;#039;&amp;#039;&amp;#039;require_once()&amp;#039;&amp;#039;&amp;#039; that function in setup.php.&lt;br /&gt;
# Create  the new &amp;#039;&amp;#039;&amp;#039;ddllib.php&amp;#039;&amp;#039;&amp;#039; library where all the [[Development:DDL functions|DDL functions]] will exist, moving them from &amp;#039;&amp;#039;&amp;#039;datalib.php&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;require_once()&amp;#039;&amp;#039;&amp;#039; the new &amp;#039;&amp;#039;&amp;#039;ddllib.php&amp;#039;&amp;#039;&amp;#039; library in the installation/upgrade code (admin/index.php).&lt;br /&gt;
# Test installation/upgrade process.&lt;br /&gt;
# Merge the  &amp;#039;&amp;#039;&amp;#039;MOODLE_17_DB_LIBRARIES&amp;#039;&amp;#039;&amp;#039; back to HEAD.&lt;br /&gt;
&lt;br /&gt;
== Timeframe ==&lt;br /&gt;
&lt;br /&gt;
* 2 days to do it, documenting every DDL and DML function.&lt;br /&gt;
* 1 day to test it, checking that both normal operations and install-upgrade continue working properly.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Total:&amp;#039;&amp;#039;&amp;#039; 3 days&lt;br /&gt;
&lt;br /&gt;
[[Category:XMLDB]]&lt;/div&gt;</summary>
		<author><name>1&gt;Stronk7</name></author>
	</entry>
</feed>