<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ideas.... &#187; Moodle</title>
	<atom:link href="http://rosalynmetz.com/ideas/tag/moodle/feed/" rel="self" type="application/rss+xml" />
	<link>http://rosalynmetz.com/ideas</link>
	<description>a blog for me to record thoughts and ideas</description>
	<lastBuildDate>Thu, 14 Apr 2011 17:56:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Backing Up Moodle to the Cloud</title>
		<link>http://rosalynmetz.com/ideas/2010/06/26/backing-up-moodle-to-the-cloud/</link>
		<comments>http://rosalynmetz.com/ideas/2010/06/26/backing-up-moodle-to-the-cloud/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 14:42:11 +0000</pubDate>
		<dc:creator>Rosalyn Metz</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Moodle]]></category>

		<guid isPermaLink="false">http://rosalynmetz.com/ideas/?p=882</guid>
		<description><![CDATA[I have a plan to back up Wheaton&#8217;s Learning Management System (LMS) to the cloud on a yearly basis. I talked about the basics of this architecture in my post I &#60;3 Redmine and You Will Too.Essentially each academic year &#8230; <a href="http://rosalynmetz.com/ideas/2010/06/26/backing-up-moodle-to-the-cloud/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div id="attachment_861" class="wp-caption alignright" style="width: 310px"><a href="http://rosalynmetz.com/ideas/wp-content/uploads/2010/05/moodle-arch.png"><img class="size-medium wp-image-861" title="Moodle Architecture" src="http://rosalynmetz.com/ideas/wp-content/uploads/2010/05/moodle-arch-300x223.png" alt="Moodle Architecture" width="300" height="223" /></a><p class="wp-caption-text">Visual depiction of the rotating Moodle architecture</p></div>
<p>I have a plan to back up Wheaton&#8217;s Learning Management System (LMS) to the cloud on a yearly basis.  I talked about the basics of this architecture in my post <em><a href="http://rosalynmetz.com/ideas/2010/05/24/i/" target="_blank">I &lt;3 Redmine and You Will Too</a>.</em>Essentially each academic year I will rotate a years worth of Moodle into the cloud, only keeping the current year and the previous year.  Here&#8217;s a picture to give you a little help in understanding<span style="font-size: small;"><span style="line-height: 17px;">.</span></span></p>
<p><span style="font-size: small;">So now I need to find a way for people that are <strong>not me</strong> to access the Moodle that lives in the cloud.  The problem is that every moodle has a config file, and in that config file, Moodle asks you to specify the URL for where your Moodle is located, this is slightly problematic because:</span></p>
<ol>
<li>Amazon EC2 servers are not given IP addresses, they are given a Public DNS like</li>
<li>Technically they can be assigned to an IP address but <a href="http://aws.amazon.com/ec2/#features" target="_blank">Elastic IPs</a> cost money when they aren&#8217;t being used, and frankly I would rather not have to pay extra if I don&#8217;t have to.</li>
<li>The people accessing these Moodles can&#8217;t be expected to ssh into a server and change the config file.</li>
</ol>
<p>So I need to make this happen automagically when the server starts up.  I tried using the php variable $_SERVER but I got some weird things.  So my idea is to have a start up script call the public-hostname (using the API amazon provides) and then edit the config file.  That way when the server starts up, Moodle will automagically be available.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Frosalynmetz.com%2Fideas%2F2010%2F06%2F26%2Fbacking-up-moodle-to-the-cloud%2F&amp;title=Backing%20Up%20Moodle%20to%20the%20Cloud" id="wpa2a_2">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://rosalynmetz.com/ideas/2010/06/26/backing-up-moodle-to-the-cloud/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Who wants a PHP Cloud?  Users of OSS that&#8217;s who.</title>
		<link>http://rosalynmetz.com/ideas/2010/05/25/who-wants-a-php-cloud-users-of-oss-thats-who/</link>
		<comments>http://rosalynmetz.com/ideas/2010/05/25/who-wants-a-php-cloud-users-of-oss-thats-who/#comments</comments>
		<pubDate>Tue, 25 May 2010 20:43:15 +0000</pubDate>
		<dc:creator>Rosalyn Metz</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Moodle]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://rosalynmetz.com/ideas/?p=865</guid>
		<description><![CDATA[Last week Geva Perry wrote a post published on GigaOm called Who Will Build the LAMP Cloud.  In it he speculated on current cloud providers that may be interested in building a PaaS (platform as a service) offering of the &#8230; <a href="http://rosalynmetz.com/ideas/2010/05/25/who-wants-a-php-cloud-users-of-oss-thats-who/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last week Geva Perry wrote a post published on GigaOm called <a href="http://gigaom.com/2010/05/22/who-will-build-the-lamp-cloud/">Who Will Build the LAMP Cloud</a>.  In it he speculated on current cloud providers that may be interested in building a PaaS (platform as a service) offering of the traditional LAMP stack.  A few days later James Urquhart responded with his blog post entitled <a href="http://news.cnet.com/8301-19413_3-20005709-240.html?tag=contentMain;contentBody">Does Cloud Computing Need LAMP</a>.  In it he questions whether the Linux and Apache piece are really necessary in a PaaS offering.  He then goes on to question the usefulness of P languages (PHP, Perl, Python) and MySQL, using a <a href="http://gigaom.com/2010/05/22/who-will-build-the-lamp-cloud/#comment-1034560">comment to Geva&#8217;s post</a> as a jumping off point.  Geva then comments back with a post on his own blog entitled <a href="http://gevaperry.typepad.com/main/2010/05/lamp-cloud.html">Who Will Build the LAMP Cloud? And Who Cares?</a> In it he agrees with James&#8217; comments on not caring about the LA in LAMP, but says:</p>
<blockquote><p>James&#8217; last question: &#8220;Is the &#8216;open sourceness&#8217; of a programming stack even that important anymore?&#8221; is a good one, but orthogonal to the discussion about a LAMP/PHP cloud, in my mind.</p></blockquote>
<p>So why has this conversation gotten me in a tizzy and forced me to write two blog posts in one week?  Well two reasons:</p>
<ol>
<li>Many web based open source projects are built on the back of P languages (PHP, Perl, and Python)</li>
<li>The cloud exists to make technology easier for the masses.</li>
</ol>
<p>Now before I go any further I will disclose that the first language I learned was PHP.  The second one was Perl.  While I know there are <a href="http://www.mail-archive.com/code4lib@listserv.nd.edu/msg07498.html" target="_blank">wars that start on listservs</a> about what languages are better, that is not the purpose of this post, so put it out of your head and don&#8217;t say anything about how much you think PHP sucks in the comments.</p>
<h2>Web based open source projects are built on the back of P languages</h2>
<p>Now I could write something about this, but I like lists.  So here is a brief off the cuff list of what open source projects use P languages:</p>
<ol>
<li>MediaWiki (PHP)</li>
<li>WordPress (PHP)</li>
<li>Bugzilla (Perl)</li>
<li>Drupal (PHP)</li>
<li>Plone (Python)</li>
<li>Moodle (PHP)</li>
<li>AWStats (Perl)</li>
<li>MovableType (PHP and Perl)</li>
<li>Subversion (Python and C)</li>
<li>Trac (Python)</li>
</ol>
<p>Now, I&#8217;m not going to argue the merits of how good each of these piece of software are. Again that&#8217;s not my point.  But they are popular whether you like it or not.  And to just dismiss them would be foolish.</p>
<h2>The cloud exists to make technology easier for the masses</h2>
<p>Google Docs makes it easier to get to files you need to edit.  Heroku makes it easier to deploy Ruby on Rails apps.  Amazon EC2 makes it easier for you to deploy a server.  The fall out of the cloud is that technology suddenly becomes much easier to create and deploy.</p>
<p>So what happens when my mom wants to write her own blog.  Well, most likely she heads over to WordPress.com and creates a blog for herself.  And if she needs a little more, then she signs up for the WordPress Premium services.  But what if I want my own blog.  Well right now I have my friend hosting my stuff.  But what if I want it hosted elsewhere and I don&#8217;t want to maintain servers (since I do that all day long).  My only option right now is to do what my mom is doing, but the reality is, that&#8217;s not what I want.  I want something like Heroku but for PHP.  And if I had it, I could install any of the PHP applications listed above.</p>
<p>And I think this conversation is very pertinent given that Google just announced its <a href="http://google-opensource.blogspot.com/2010/05/cloudcourse-enterprise-application-in.html" target="_blank">open source learning management system</a> written in Python and <a href="http://code.google.com/p/cloudcourse/wiki/WikiInstall" target="_blank">intended to be deployed in Google App Engine</a>.  This could potentially be a big blow to Moodle who doesn&#8217;t have a cloud to turn to.</p>
<h2>Conclusion</h2>
<p>So yes a PHP based cloud does matter.  And yes it should be built because there are lots of <a href="http://groups.google.com/group/google-appengine/browse_thread/thread/34635d269014b2bd/">people clamoring</a> to use it (or who have already <a href="http://www.google.com/search?hl=en&amp;q=google+app+engine+php">figured out a way</a>).</p>
<p>And yes this blog post could be more coherent.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Frosalynmetz.com%2Fideas%2F2010%2F05%2F25%2Fwho-wants-a-php-cloud-users-of-oss-thats-who%2F&amp;title=Who%20wants%20a%20PHP%20Cloud%3F%20%20Users%20of%20OSS%20that%26%238217%3Bs%20who." id="wpa2a_4">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://rosalynmetz.com/ideas/2010/05/25/who-wants-a-php-cloud-users-of-oss-thats-who/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I </title>
		<link>http://rosalynmetz.com/ideas/2010/05/24/i/</link>
		<comments>http://rosalynmetz.com/ideas/2010/05/24/i/#comments</comments>
		<pubDate>Mon, 24 May 2010 14:38:13 +0000</pubDate>
		<dc:creator>Rosalyn Metz</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Moodle]]></category>
		<category><![CDATA[Redmine]]></category>

		<guid isPermaLink="false">http://rosalynmetz.com/ideas/?p=860</guid>
		<description><![CDATA[Right now I&#8217;m insanely busy. But its the hurry up and wait kind of insanely busy stuff. I&#8217;m in the process of setting up an architecture for Moodle. Essentially using VMWare I&#8217;ll rotate out servers every academic year.  Older server &#8230; <a href="http://rosalynmetz.com/ideas/2010/05/24/i/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Right now I&#8217;m insanely busy.  But its the hurry up and wait kind of insanely busy stuff.</p>
<div id="attachment_861" class="wp-caption alignright" style="width: 310px"><a href="http://rosalynmetz.com/ideas/wp-content/uploads/2010/05/moodle-arch.png"><img class="size-medium wp-image-861 " title="Moodle Architecture" src="http://rosalynmetz.com/ideas/wp-content/uploads/2010/05/moodle-arch-300x223.png" alt="Moodle Architecture" width="300" height="223" /></a><p class="wp-caption-text">Visual depiction of the rotating Moodle architecture</p></div>
<p>I&#8217;m in the process of setting up an architecture for Moodle. Essentially using VMWare I&#8217;ll rotate out servers every academic year.  Older server images will be put in the cloud so that if we need access to them quickly, we can do that without any problems.  This will allow me to:</p>
<p>1) get away with not having to do necessary MySQL tuning since Moodle doesn&#8217;t really delete much from its database.</p>
<p>2) not have to deal with compatibility issues since Moodle has been know to create course back ups that don&#8217;t work with future versions of the software.</p>
<p>3) deal with file storage issues, namely that users often thing the course management software is the place to store all of your files for ever and ever (its not by the way).</p>
<p>So now that I&#8217;ve come up with that I need a way to figure out what I have to do to make this work and then hope that I don&#8217;t forget those tasks.  Enter Redmine.  If you haven&#8217;t used it before, I recommend checking it out.  There is a <a href="http://demo.redmine.org/" target="_blank">demo redmine</a> you can use to play around with it.</p>
<div id="attachment_862" class="wp-caption alignleft" style="width: 310px"><a href="http://rosalynmetz.com/ideas/wp-content/uploads/2010/05/redmine-tasks.png"><img class="size-medium wp-image-862" title="Redmine SubProject" src="http://rosalynmetz.com/ideas/wp-content/uploads/2010/05/redmine-tasks-300x166.png" alt="Redmine SubProject" width="300" height="166" /></a><p class="wp-caption-text">tasks that need to be accomplished in order to set up the Moodle architecture.</p></div>
<p>What I like about it is its flexibility.  At MPOW I am essentially a developer, systems administrator, and project manager all rolled up into one.  Its a lot of hats to wear, and often times I forget tasks, or I need to talk out the entire process.  Essentially I use Redmine to help me with that.  I can enter new features for the developer Rosalyn to work on.  I can enter tasks for sys admin Rosalyn to work on.  And all of this is done by project manager Rosalyn who is trying to help the sys admin and developer work together (yes i do talk to myself&#8230;and answer back).</p>
<p>Redmine has subtasking, subprojects, and you can change all kinds of things in it so that it can essentially function however you want it to.  And its written in Ruby on Rails so extending is easy (although the <a href="http://www.redmine.org/wiki/redmine/Plugin_List" target="_blank">plugins are plentiful</a> so you may not even need to write your own code).  I&#8217;ve gotten my boss on board with it, and he&#8217;s slowly trying to infect others so that they use it too.</p>
<p>So that&#8217;s my new best friend Redmine.  It has helped me organize and focus my day on the things that need to get done.  I &lt;3 it and if you try it out, I think you will too.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Frosalynmetz.com%2Fideas%2F2010%2F05%2F24%2Fi%2F&amp;title=I%20%3C3%20Redmine%20and%20you%20will%20too" id="wpa2a_6">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://rosalynmetz.com/ideas/2010/05/24/i/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Why Moodle Keeps Going Down</title>
		<link>http://rosalynmetz.com/ideas/2009/09/02/why-moodle-keeps-going-down/</link>
		<comments>http://rosalynmetz.com/ideas/2009/09/02/why-moodle-keeps-going-down/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 05:35:22 +0000</pubDate>
		<dc:creator>Rosalyn Metz</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Moodle]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://rosalynmetz.com/ideas/?p=690</guid>
		<description><![CDATA[For those of you that aren&#8217;t Systems Administrators, here is the reason you don&#8217;t want to be.  At 12:30am when things go down, you have to wake up and figure out why.  And here I am writing a blog post &#8230; <a href="http://rosalynmetz.com/ideas/2009/09/02/why-moodle-keeps-going-down/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For those of you that aren&#8217;t Systems Administrators, here is the reason you don&#8217;t want to be.  At 12:30am when things go down, you have to wake up and figure out why.  And here I am writing a blog post about it.  Luckily its not 4am.  That was totally worse (I say this now&#8230;let&#8217;s see how long it takes me to figure this stuff out).</p>
<p>So I got my text message at 12:30am.  It confused me but then I woke up a bit.  It was a good thing I wrote the notes I did in my previous post, because trust me, I could have never come up with that stuff on my own right now.</p>
<p>First thing I did was run top.  CPU was at 100.1% (way to work hard server) for the mysqld process.  Second thing I did was check the slow query log.  There were actually a few slow queries, the first ones are still puzzling me.  Basically these were checking a table that had a whole lot of rows of data, the data didn&#8217;t need to be stored in those tables, i removed the data, and I stopped logging that data in the tables.  I probably won&#8217;t see those queries ever again. But this doesn&#8217;t really matter, those queries weren&#8217;t the ones hanging up the system, they were only take 11 t0 17 seconds to run.</p>
<p>I did see the last query that ran though, and this seems to be part of the problem, but not the query that was actually causing mysqld to hang. This query was:</p>
<blockquote><p>INSERT INTO stats_daily (stattype, timeend, courseid, roleid, stat1, stat2)</p>
<p>SELECT &#8216;enrolments&#8217;, timeend, courseid, roleid, COUNT(DISTINCT userid), 0<br />
FROM (<br />
SELECT 1251691200 AS timeend, pl.courseid, pl.roleid, pl.userid<br />
FROM (<br />
SELECT DISTINCT ra.roleid, ra.userid, c.id as courseid<br />
FROM role_assignments ra JOIN context ctx<br />
ON ctx.id = ra.contextid<br />
CROSS JOIN course c<br />
JOIN role_capabilities rc<br />
ON rc.roleid = ra.roleid LEFT OUTER JOIN course_categories cc1<br />
ON cc1.id = c.category<br />
WHERE ((rc.capability = &#8216;moodle/course:view&#8217; )<br />
AND rc.permission = 1 AND rc.contextid = 1<br />
AND (ctx.contextlevel = 10<br />
OR (c.id = ctx.instanceid AND ctx.contextlevel = 50) OR (cc1.id = ctx.instanceid AND ctx.contextlevel = 40)))<br />
) pl<br />
) inline_view<br />
GROUP BY timeend, courseid, roleid;</p></blockquote>
<p>This query took a total of 41 seconds to execute.  I&#8217;m assuming that the next query after this was the one that brought the house down.  I saw the beginning of this when I went into mysql and did a show processlist:</p>
<blockquote><p>+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| Id    | User       | Host      | db     | Command | Time | State        | Info                                                                                                 |<br />
+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| 45654 | moodleuser | localhost | moodle | Query   | 1776 | Sending data | UPDATE stats_daily<br />
SET stat2 = (SELECT COUNT(DISTINCT ra.userid)<br />
|</p></blockquote>
<p>The full query finally showed up in my query log once I killed the process.  Here it is in case you&#8217;re curious:</p>
<blockquote><p>090902  0:01:29      45654 Query       UPDATE stats_daily<br />
SET stat2 = (SELECT COUNT(DISTINCT ra.userid)<br />
FROM role_assignments ra JOIN context ctx<br />
ON ctx.id = ra.contextid<br />
CROSS JOIN course c<br />
JOIN role_capabilities rc<br />
ON rc.roleid = ra.roleid LEFT OUTER JOIN course_categories cc1<br />
ON cc1.id = c.category<br />
WHERE ra.roleid = stats_daily.roleid AND<br />
c.id = stats_daily.courseid AND<br />
((rc.capability = &#8216;moodle/course:view&#8217; )<br />
AND rc.permission = 1 AND rc.contextid = 1<br />
AND (ctx.contextlevel = 10<br />
OR (c.id = ctx.instanceid AND ctx.contextlevel = 50) OR (cc1.id = ctx.instanceid AND ctx.contextlevel = 40))) AND<br />
EXISTS (SELECT &#8216;x&#8217;<br />
FROM log l<br />
WHERE l.course = stats_daily.courseid AND<br />
l.userid = ra.userid AND l.time &gt;= 1251604800  AND l.time  &lt; 1251691200))<br />
WHERE stats_daily.stattype = &#8216;enrolments&#8217; AND<br />
stats_daily.timeend = 1251691200 AND<br />
stats_daily.courseid IN<br />
(SELECT DISTINCT l.course<br />
FROM log l<br />
WHERE l.time &gt;= 1251604800  AND l.time  &lt; 1251691200)</p></blockquote>
<p>I also saw a whole bunch of other queries locked, waiting for this query to run.  I thought that perhaps switching the tables over to InnoDB rather than MyISAM might help alleviate the problem, but the truth is this appears to be a &#8220;the query is just ridiculous&#8221; problem rather than a &#8220;InnoDB is better at performance&#8221; problem.</p>
<p>So at anyrate I looked around and it seems this is a problem with the stats that Moodle keeps about itself.  Apparently in version 1.6 people had this problem a lot (because stats was new).  Basically I enabled stats because someone thought it was a good idea and I didn&#8217;t bother to consider how resource intensive this process could be (note to self: be a better sys admin and read documentation when someone thinks something might be useful).  I changed some settings in the stats configuration page and hope that this reduces the load and processing time of the stats query.  We&#8217;ll see if this fixes my problem.</p>
<p>Also, the amount of time I spent on this right now totally makes up for leaving work an hour and a half early to go meet my brother in law the electrician so he could replace outlets and light fixtures (my $12 sconces from lowes look quite lovely).</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Frosalynmetz.com%2Fideas%2F2009%2F09%2F02%2Fwhy-moodle-keeps-going-down%2F&amp;title=Why%20Moodle%20Keeps%20Going%20Down" id="wpa2a_8">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://rosalynmetz.com/ideas/2009/09/02/why-moodle-keeps-going-down/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Moodle&#8217;s MySQL Keeps Going Down</title>
		<link>http://rosalynmetz.com/ideas/2009/08/31/moodles-mysql-keeps-going-down/</link>
		<comments>http://rosalynmetz.com/ideas/2009/08/31/moodles-mysql-keeps-going-down/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 20:38:28 +0000</pubDate>
		<dc:creator>Rosalyn Metz</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Moodle]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://rosalynmetz.com/ideas/?p=687</guid>
		<description><![CDATA[If you&#8217;re not interested in Moodle or troubleshooting MySQL problems, than you probably don&#8217;t want to read this post.  I however wanted to write some notes for myself and need it to be portable.  Since that&#8217;s technically the purpose of &#8230; <a href="http://rosalynmetz.com/ideas/2009/08/31/moodles-mysql-keeps-going-down/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re not interested in Moodle or troubleshooting MySQL problems, than you probably don&#8217;t want to read this post.  I however wanted to write some notes for myself and need it to be portable.  Since that&#8217;s technically the purpose of this blog, I figured I should put it here.</p>
<p>Recently Nagios started informing me that HTTPS was going down infrequently (but started to become more frequent).</p>
<blockquote><p><em>***** Nagios  *****<br />
Notification Type: PROBLEM<br />
Service: HTTPS<br />
Host: Moodle Server<br />
Address: 123.456.78.912<br />
State: CRITICAL<br />
Date/Time: Fri Aug 28 01:06:50 EDT 2009<br />
Additional Info:<br />
CRITICAL &#8211; Socket timeout after 10 seconds</em></p></blockquote>
<p>What was strange was that HTTP wasn&#8217;t going down.  I felt like Nagios was lying to me so I figured I would have to wake up late at night (early in the morning?) and catch it lying to me.  To do this I decided I&#8217;d try to figure out if my cellphone had an <a href="http://www.tech-recipes.com/rx/939/sms_email_cingular_nextel_sprint_tmobile_verizon_virgin/">email to associate to text messaging</a>.  Mine wasn&#8217;t working so I had to talk to Sprint about it.</p>
<p>In the mean time though, it was still going down.  Luckily last night at 4am I randomly woke up. I ran downstairs (imagine kid at Christmas&#8230;but like a reverse Christmas) and fired up the laptop.  Sure enough when I went to the Moodle homepage I saw this:</p>
<blockquote><p><em>Error: Database connection failed.</em></p>
<p><em> It is possible that the database is overloaded or otherwise not running properly.</em></p>
<p><em> The site administrator should also check that the database details have been correctly specified in config.php</em></p></blockquote>
<p>Now in hindsight, there were so many things I could have done at this point.  But it was 4am and my house was freezing so I made some mistakes.  The first thing I did was restart Apache.  It appeared to be running and the restart didn&#8217;t throw any errors, but it didn&#8217;t fix the problem either.  Next I &#8220;turned off SSL&#8221;.  I was able to get to the error page without the HTTPS so I determined at this point that Nagios clearly was lying to me, something else was wrong (p.s. i am thankful to Nagios for telling me that something was wrong).  So then I decided that maybe it was a database problem.  I went into MySQL and was able to access the Moodle database and do a &#8220;show tables;&#8221;.  So I thought at that point I should restart MySQL, in hindsight there are so many other things I should have done first, but I will document those below.  A restart of MySQL fixed the issue.</p>
<p>So what will I do next time (and yes&#8230;there will be a next time):</p>
<p style="padding-left: 30px;"><em><strong>1) run top on the server:</strong></em> See if MySQL is hogging the CPU.  This could lead you to a number of options.</p>
<p style="padding-left: 30px;"><em><strong>2) </strong></em><em><strong>check the mysql-slow-queries.log:</strong></em> I set up the <a href="http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html">mysql option log-slow-queries</a>.  this in conjunction with the <a href="http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_long_query_time">long-query-time option</a> will log any query that takes over a certain amount of time (default is 10s).</p>
<p style="padding-left: 30px;"><em><strong>3) </strong></em><em><strong>show mysql processlist:</strong></em> If you haven&#8217;t set up the log slow queries option this might also be helpful in determining what mysql is doing.  Here is a brief explaination of <a href="http://dev.mysql.com/doc/refman/5.0/en/show-processlist.html">show processlist</a> and its companion of <a href="http://dev.mysql.com/doc/refman/5.0/en/kill.html">kill &lt;processid&gt;</a>.  I also found this handy script that you could set up as part of a cron to <a href="http://forge.mysql.com/tools/tool.php?id=228">kill any runaway processes</a>.</p>
<p style="padding-left: 30px;"><em><strong>4) </strong></em><em><strong>query is poorly written:</strong></em> I&#8217;ve found a number of reports that MySQL queries are poorly written in Moodle and that these can cause the CPU usage to top out at %100 which causes Moodle to be unusable.  Below are a few Moodle Tracker reports of this:</p>
<blockquote>
<ul style="padding-left: 30px;">
<li><a href="http://tracker.moodle.org/browse/MDL-14911">http://tracker.moodle.org/browse/MDL-14911</a></li>
<li><a href="http://tracker.moodle.org/browse/MDL-19584">http://tracker.moodle.org/browse/MDL-19584</a></li>
<li><a href="http://tracker.moodle.org/browse/MDL-17051">http://tracker.moodle.org/browse/MDL-17051</a></li>
<li><a href="http://tracker.moodle.org/browse/MDL-10848">http://tracker.moodle.org/browse/MDL-10848</a></li>
</ul>
</blockquote>
<p style="padding-left: 30px;">To see if this is the case with your Moodle use the slow query logging (or just the plain old query logging) with a backup of your database to see if you can replicate the problem somewhere else.  If you can the problem is probably the query and maybe you can figure out a way to rewrite the query (or get it rewritten) to see if that fixes the problem.</p>
<p style="padding-left: 30px;"><em><strong>5) check your persistent db connection:</strong></em> Check to see if you have persistent database connections set up in the Moodle config.php file and in the php.ini file.  If you do, turn it off and see if this solves the problem.  it may be that your connections aren&#8217;t closing and they are killing your database regularly.</p>
<p style="padding-left: 30px;"><em><strong>6) check your max connections:</strong></em> Are the maximum number of Apache connections greater than your maximum number of MySQL connections?  If so that <a href="http://moodle.org/mod/forum/discuss.php?d=30603#p370708">might be a problem</a>.  Basically users could get to the website but then when they go to request something in the database they can&#8217;t because the # of connections are taken up.  I have a feeling though that this may be a completely different error than what I was experiencing (people&#8230;including myself&#8230;really need to take screenshots or document errors better).</p>
<p style="padding-left: 30px;"><em><strong>7) check your MySQL performance:</strong></em> Perhaps you haven&#8217;t configured Moodle right.  Take a look at these <a href="http://docs.moodle.org/en/Performance#MySQL_performance">performance tuning tips</a> to see if you can get it working better.</p>
<p style="padding-left: 30px;"><em><strong>8) check your database tables:</strong></em> Stop mysqld and run a check on your Moodle tables.  See if some of the tables are corrupted, if they are fix them.</p>
<p>So if you&#8217;re wondering what I&#8217;m doing at 4am tomorrow, there&#8217;s the list.  Wish me luck.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Frosalynmetz.com%2Fideas%2F2009%2F08%2F31%2Fmoodles-mysql-keeps-going-down%2F&amp;title=Moodle%26%238217%3Bs%20MySQL%20Keeps%20Going%20Down" id="wpa2a_10">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://rosalynmetz.com/ideas/2009/08/31/moodles-mysql-keeps-going-down/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Moodle Enrollment: Flat Files</title>
		<link>http://rosalynmetz.com/ideas/2009/06/17/moodle-enrollment-flat-files/</link>
		<comments>http://rosalynmetz.com/ideas/2009/06/17/moodle-enrollment-flat-files/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 20:57:20 +0000</pubDate>
		<dc:creator>Rosalyn Metz</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Moodle]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://rosalynmetz.com/ideas/?p=622</guid>
		<description><![CDATA[Currently we are using the LMB Plugin for Moodle to enroll students into our courses.  This works swimmingly, until you have to enroll a large group into a class that really isn&#8217;t a class.  Let me explain&#8230;no let me sum &#8230; <a href="http://rosalynmetz.com/ideas/2009/06/17/moodle-enrollment-flat-files/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Currently we are using the LMB Plugin for Moodle to enroll students into our courses.  This works swimmingly, until you have to enroll a large group into a class that really isn&#8217;t a class.  Let me explain&#8230;no let me sum up.</p>
<p>We have a bunch of placement tests and advising courses and that sort of thing we want our first year students to be enrolled in.  Moodle happens to have a flat file enrollment feature.  Below are the instructions from that enrollment feature:</p>
<blockquote><p>This method will repeatedly check for and process a specially-formatted text file in the location that you specify. The file is a comma separated file assumed to have four or six fields per line:</p>
<pre>*  operation, role, idnumber(user), idnumber(course) [, starttime, endtime]
where:
*  operation        = add | del
*  role             = student | teacher | teacheredit
*  idnumber(user)   = idnumber in the user table NB not id
*  idnumber(course) = idnumber in the course table NB not id
*  starttime        = start time (in seconds since epoch) - optional
*  endtime          = end time (in seconds since epoch) - optional</pre>
<p>It could look something like this:</p>
<pre>   add, student, 5, CF101
   add, teacher, 6, CF101
   add, teacheredit, 7, CF101
   del, student, 8, CF101
   del, student, 17, CF101
   add, student, 21, CF101, 1091115000, 1091215000</pre>
</blockquote>
<p>So great, I need to pull a randomly generated number rather than a username in order to enroll students.  So now I need to figure out a way to take a list of usernames in banner and get their corresponding idnumbers in Moodle.</p>
<p>Now if this were a one time thing I would take the lazy man&#8217;s way out and I would create a table in the database and do a simple</p>
<pre>select table.username, user.idnumber
from table, user
where table.username = user.username;</pre>
<p>But I&#8217;m going to have to do this every year until we either get rid of Moodle or I leave Wheaton.  Since plans are not in the work for either, I&#8217;ll actually do something more substantive.</p>
<p>First I made the decision to use the MySQL select in clause.  For those of you who don&#8217;t know, you can do:</p>
<pre>select username, idnumber
from user
where username in ('value1', 'value2', 'valueN');</pre>
<p>Its pretty useful really.  I can&#8217;t really find a MySQL page that talks about the in() clause but I did find a <a href="http://lists.mysql.com/internals/2077">good post in the MySQL lists</a>.  The next thing I had to figure out was how to push a file into a php array.  Again I found a <a href="http://www.phpbuilder.com/board/showthread.php?t=10365807">great post on using the file() </a>command to do this.  The only drawback is that when i go to print it&#8217;ll just show:</p>
<pre>value1 value2 valueN</pre>
<p>When that&#8217;s not what I want.  I need quotes and commas and crap around it.  So I found another great post that talks about <a href="http://bytes.com/topic/mysql/answers/854031-pass-php-array-into-mysql-clause">using the implode function to put a php array into an in() clause</a>.  The implode function will allow me to put quotes and what not around each one of the values in the array so it will look like this:</p>
<pre>'value1', 'value2', 'valueN'</pre>
<p>So now that I have the component parts, all I need to do is create a php page that will let me upload a file, run the query, and retrieve the outfile.  Of course the idea of writing this code makes me tired and since its 5pm I shall just publish this post and write the code tomorrow (hopefully).</p>
<p><em><strong>UPDATE</strong></em></p>
<p>I was wrong.  The value is not a randomly generated number, well it is, but its randomly generated by Banner.  In the Banner XML the value is the &lt;sourcedid&gt; for a &lt;person&gt;.</p>
<p>Luckily this randomly generated value is something that we can pull out of Banner using our reporting system.  The value (in our Banner) is <em>gobsrid_sourced_id</em>.  Not sure if it will be the same in your Banner, but hopefully this will put someone on the right track.</p>
<p>My next step is to document how to do all of this in our Moodle Documentation Wiki.  I might do a Jing Video.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Frosalynmetz.com%2Fideas%2F2009%2F06%2F17%2Fmoodle-enrollment-flat-files%2F&amp;title=Moodle%20Enrollment%3A%20Flat%20Files" id="wpa2a_12">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://rosalynmetz.com/ideas/2009/06/17/moodle-enrollment-flat-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>NITLE Moodle Exchange is a bit Cloudy</title>
		<link>http://rosalynmetz.com/ideas/2009/04/06/nitle-moodle-exchange-is-a-bit-cloudy/</link>
		<comments>http://rosalynmetz.com/ideas/2009/04/06/nitle-moodle-exchange-is-a-bit-cloudy/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 15:00:09 +0000</pubDate>
		<dc:creator>Rosalyn Metz</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Moodle]]></category>
		<category><![CDATA[NITLE]]></category>

		<guid isPermaLink="false">http://rosalynmetz.com/ideas/?p=569</guid>
		<description><![CDATA[I&#8217;ve been scouring academia for cloud computing projects and came across one that I myself am looking to get involved in (and not because its cloud computing). NITLE hosts a Moodle Exchange (NME). For faculty, technologists, and librarians at participating &#8230; <a href="http://rosalynmetz.com/ideas/2009/04/06/nitle-moodle-exchange-is-a-bit-cloudy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been scouring academia for cloud computing projects and came across one that I myself am looking to get involved in (and not because its cloud computing).</p>
<p>NITLE hosts a <a href="http://www.nitle.org/www/site/peer_communities#Moodle_Exchange">Moodle Exchange</a> (NME).</p>
<blockquote><p>For faculty, technologists, and librarians at participating campuses that use or are interested in using Moodle.  Participants in this collaborative user community focus on the use of Moodle at smaller, independent colleges and universities, sharing ideas and best practices and helping each other troubleshoot technical or use issues specific to liberal education and undergraduate colleges and universities.  In the NME, Moodle-using or Moodle-interested campuses share strategies and ask and answer questions about implementation, evaluation, migration, customization, and other Moodle-related topics.</p></blockquote>
<p>NME also works together to develop a Liberal Arts Edition of Moodle as well as plugins specifically focused on the needs of Liberal Arts Colleges.  So how does this get cloudy?  Well they use <a href="http://code.google.com/p/nitle-moodle-xtns/">Google Code</a> to distribute their developments.  This allows everyone involved in the project to access or share code that has been developed for the community.</p>
<p>If you&#8217;re doing something similar let me know about it.  I&#8217;m very interested in how different academic institutions are using the cloud to develop systems and applications.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Frosalynmetz.com%2Fideas%2F2009%2F04%2F06%2Fnitle-moodle-exchange-is-a-bit-cloudy%2F&amp;title=NITLE%20Moodle%20Exchange%20is%20a%20bit%20Cloudy" id="wpa2a_14">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://rosalynmetz.com/ideas/2009/04/06/nitle-moodle-exchange-is-a-bit-cloudy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random Moodle</title>
		<link>http://rosalynmetz.com/ideas/2009/02/13/random-moodle/</link>
		<comments>http://rosalynmetz.com/ideas/2009/02/13/random-moodle/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 15:24:29 +0000</pubDate>
		<dc:creator>Rosalyn Metz</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Moodle]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://rosalynmetz.com/ideas/?p=450</guid>
		<description><![CDATA[It&#8217;s been a while since I wrote, and its not that I forgot about my blog, it&#8217;s just that I&#8217;ve been busy.  Our Moodle installation is growing up and will be getting its own server soon.  I&#8217;m hoping that it&#8217;ll &#8230; <a href="http://rosalynmetz.com/ideas/2009/02/13/random-moodle/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since I wrote, and its not that I forgot about my blog, it&#8217;s just that I&#8217;ve been busy.  Our Moodle installation is growing up and will be getting its own server soon.  I&#8217;m hoping that it&#8217;ll be a OSX 10.5 Server so I&#8217;ve been working out some of the kinks in my test installation:</p>
<ol>
<li>GD Library &#8212; By default the GD library&#8217;s aren&#8217;t part of the PHP package in Server 10.5.  I was poking around in this <a href="http://docs.moodle.org/en/Step_by_Step_Installation_on_a_Mac_OS_X_10.5_Server">Step by Step Installation guide</a> trying to upgrade my PHP library on my server.  Turns out I didn&#8217;t need to for various reasons (also the package recommended screwed with my Apache).  So instead i went into my php.ini file and uncommented the line:<br />
<blockquote><p>extension=php_gd2.dll</p></blockquote>
<p>This turned on the GD Library and Moodle looks much better now.</li>
<li>MySQL &#8212; I was getting a weird error in Moodle under Admin &gt; Server &gt; Environment.<br />
<blockquote><p>It is required that you store all your data in Unicode format (UTF-8). New installations must be performed into databases that have their default character set as Unicode. If you are upgrading, you should perform the UTF-8 migration process (see the Admin page).</p></blockquote>
<p>I thought that was a bit weird cause I installed the database from scratch. But sometimes you just need to do what it tells you to.  So I ran the following query:</p>
<blockquote><p><code>alter database moodle collate = utf8_unicode_ci;</code></p></blockquote>
<p>And voila the error went away.</li>
</ol>
<p>So now my Moodle is a bit happier.  I am of course (like always) recording this so that when I get my new server and I run into these problems again, I can remember what the heck I did.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Frosalynmetz.com%2Fideas%2F2009%2F02%2F13%2Frandom-moodle%2F&amp;title=Random%20Moodle" id="wpa2a_16">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://rosalynmetz.com/ideas/2009/02/13/random-moodle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickmail and Groups in Moodle</title>
		<link>http://rosalynmetz.com/ideas/2009/01/19/quickmail-and-groups-in-moodle/</link>
		<comments>http://rosalynmetz.com/ideas/2009/01/19/quickmail-and-groups-in-moodle/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 20:03:10 +0000</pubDate>
		<dc:creator>Rosalyn Metz</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Moodle]]></category>

		<guid isPermaLink="false">http://rosalynmetz.com/ideas/?p=411</guid>
		<description><![CDATA[We were discussing metacourses and email certain members of a metacourse and thought, I wonder if Quickmail uses group. Unfortunately the version of Quickmail we&#8217;re currently using doesn&#8217;t do that. However there is a patch for Quickmail that allows you &#8230; <a href="http://rosalynmetz.com/ideas/2009/01/19/quickmail-and-groups-in-moodle/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We were discussing metacourses and email certain members of a metacourse and thought, I wonder if Quickmail uses group.  Unfortunately the version of Quickmail we&#8217;re currently using doesn&#8217;t do that.  However there is a <a href="http://tracker.moodle.org/browse/CONTRIB-346">patch for Quickmail that allows you to email groups</a>.</p>
<p>Documenting it here for future reference.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Frosalynmetz.com%2Fideas%2F2009%2F01%2F19%2Fquickmail-and-groups-in-moodle%2F&amp;title=Quickmail%20and%20Groups%20in%20Moodle" id="wpa2a_18">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://rosalynmetz.com/ideas/2009/01/19/quickmail-and-groups-in-moodle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Moodle Courses Not Enrollable</title>
		<link>http://rosalynmetz.com/ideas/2008/12/23/making-moodle-courses-not-enrollable/</link>
		<comments>http://rosalynmetz.com/ideas/2008/12/23/making-moodle-courses-not-enrollable/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 15:52:13 +0000</pubDate>
		<dc:creator>Rosalyn Metz</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Moodle]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://rosalynmetz.com/ideas/?p=285</guid>
		<description><![CDATA[What?!? Rosalyn what the heck are you talking about. I know, I know, my blog&#8217;s tag cloud is becoming Moodle heavy. Its true. But the boss man thinks that students shouldn&#8217;t be able to enroll themselves into any Moodle class &#8230; <a href="http://rosalynmetz.com/ideas/2008/12/23/making-moodle-courses-not-enrollable/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em>What?!? Rosalyn what the heck are you talking about.</em></p>
<p>I know, I know, my blog&#8217;s tag cloud is becoming Moodle heavy.  Its true.  But the boss man thinks that students shouldn&#8217;t be able to enroll themselves into any Moodle class at the drop of a hat.  Sadly this makes sense (professors can be very protective of their class information because often times it informs their research).  Sigh.  So I&#8217;m off to make this happen.</p>
<p>So I&#8217;ve come up with a few ideas:</p>
<ol>
<li>I can just run a MySQL query every month:<br />
<blockquote><p><code>update course set enrollable = 0;</code></p></blockquote>
<p>While yes this will work, how much of a pain will that be.  I guess I could create a little script to do it for me.  But honestly that&#8217;s not a solution that&#8217;s a patch.</li>
<li>I can try going into moodle/course/edit_form.php and find the line:<br />
<blockquote><p><code>$mform-&gt;setDefault('enrollable', 1);</code></p></blockquote>
<p>And change it to:</p>
<blockquote><p><code>$mform-&gt;setDefault('enrollable', 0);</code></p></blockquote>
<p><em>Wow Rosalyn you&#8217;re genius!</em> Yeah, no, I&#8217;m not I just found that in the <a href="http://moodle.org/mod/forum/discuss.php?d=103018">Moodle Enrollment Plugins forum</a>.  A guy named Michael Skwara came up with it.  So I tried it out.  Unfortunately it doesn&#8217;t effect (or is that affect) courses I create using the LMB Enrollment Plugin.  You can still enroll yourself into those.  Darn it!  Foiled again.</li>
<li>Just change the database schema (<em>oh yeah rosalyn&#8230;like that&#8217;s just so easy)</em>.  I took a look in MySQL and the default for that column is set to 1, so if I set it to 0 perhaps that will make all new courses created with LMB default to <em><strong>not</strong></em> enrollable.  Of course I&#8217;m assuming that LMB doesn&#8217;t really update things like the enrollable field in the course table (I mean where would it get that information).  So I set about testing my theory.<br />
First things first, I asked <a href="http://moodle.org/mod/forum/discuss.php?d=103018">in the forum I referenced above</a> if anyone saw a problem with what I was about to do before I did it.  One of the Moodlers, Iñaki Arenaza, said that there shouldn&#8217;t be any problem with this.  Which is what I suspected, unless of course Moodle goes crazy and revamps their DB schema&#8230;which would cause me other headaches.So on to my next portion of the testing, does LMB update the field enrollable or does it just leave it alone.  So I installed a fresh Moodle (including the LMB plugin).  From there I logged into the MySQL and changed the default value for the column enrollable by running the query:</p>
<blockquote><p><code>alter table course alter column enrollable set default 0;</code></p></blockquote>
<p>Your query might be different if you are using a prefix for your Moodle tables. I then ran an import using the LMB plug in.  After that had finished I logged in using LDAP and tried to enroll myself in a course.  And lo and behold I received the message:</p>
<blockquote><p>This course is not enrollable at the moment.</p></blockquote>
<p>SUCCESS!  So students who aren&#8217;t attached to the course in Banner, can&#8217;t attach themselves to the course in Moodle.  Professors however can still go in and add students (or delete students) from a course the way they did before.</li>
</ol>
<p>So that&#8217;s my foyer into the world of altering the Moodle database schema in order to make the boss man happy.  My next step is to upgrade Moodle so I can take advantage of the fun new features.</p>
<h2><em><strong>UPDATE</strong></em></h2>
<p>I noticed a few people have visited this post recently.  While this fixed worked for me I recommend that you <em><strong>TEST IT OUT FIRST</strong></em>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Frosalynmetz.com%2Fideas%2F2008%2F12%2F23%2Fmaking-moodle-courses-not-enrollable%2F&amp;title=Making%20Moodle%20Courses%20Not%20Enrollable" id="wpa2a_20">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://rosalynmetz.com/ideas/2008/12/23/making-moodle-courses-not-enrollable/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

