<?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>GL.IB.LY &#187; computers</title>
	<atom:link href="http://gl.ib.ly/tag/computers/feed/" rel="self" type="application/rss+xml" />
	<link>http://gl.ib.ly</link>
	<description>Thoughts on security, computing, business and stuff!</description>
	<lastBuildDate>Sun, 18 May 2014 11:51:56 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>All configuration variables in Moodle code &#8211; Part two</title>
		<link>http://gl.ib.ly/computing/2009/06/24/configuration-variables-moodle-code-part-two/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=configuration-variables-moodle-code-part-two</link>
		<comments>http://gl.ib.ly/computing/2009/06/24/configuration-variables-moodle-code-part-two/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 17:53:03 +0000</pubDate>
		<dc:creator><![CDATA[tariq]]></dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[cfg]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[configuration variables]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[moodle]]></category>
		<category><![CDATA[one liners]]></category>

		<guid isPermaLink="false">http://gl.ib.ly/?p=73</guid>
		<description><![CDATA[<p>Earlier we looked at how you can extract a list of all the $CFG variables in your Moodle code. Now that&#8217;s not of much use! We need to know where in the code all these variables hide. I feel some spooky awk a<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://gl.ib.ly/computing/2009/06/24/configuration-variables-moodle-code-part-two/">Read more &#8250;</a></div><!-- end of .read-more --></p><p>The post <a href="http://gl.ib.ly/computing/2009/06/24/configuration-variables-moodle-code-part-two/">All configuration variables in Moodle code &#8211; Part two</a> appeared first on <a href="http://gl.ib.ly">GL.IB.LY</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><a style="color: #7da939;" title="http://gl.ib.ly/archives/8-All-configuration-variables-in-Moodle-code.html" href="http://gl.ib.ly/archives/8-All-configuration-variables-in-Moodle-code.html">Earlier</a><span style="color: #545454;"> we looked at how you can extract a list of all the </span><code style="color: #545454;">$CFG</code><span style="color: #545454;"> variables in your Moodle code. Now that&#8217;s not of much use! We need to know where in the code all these variables hide. I feel some spooky awk a coming on.</span></p>
<div class="serendipity_entry_extended" style="color: #545454;"><i>Please note this doesn&#8217;t show all the variables available in Moodle, it shows all the Moodle variables in a particular codebase. Below output is shown from one of my own codebases which is a little different to what you might expect to see in MOODLE_19_STABLE</i>In <a style="color: #7da939;" title="http://gl.ib.ly/archives/8-All-configuration-variables-in-Moodle-code.html" href="http://gl.ib.ly/archives/8-All-configuration-variables-in-Moodle-code.html">All configuration variables in Moodle code</a> we came up with:</p>
<div class="geshi"><span style="font-weight: bold; color: #c20cb9;">grep</span> -r &#8211;no-filename -o &#8216;\$CFG-&gt;<span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span><span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span>*&#8217; &lt;path_to_moodle&gt; | <span style="font-weight: bold; color: #c20cb9;">sort</span> -u</div>
<p>This gives us some useful information but hides a lot of the detail. Let&#8217;s try and include which files the variable appears in even the line numbers. For this we&#8217;ll go back to:</p>
<div class="geshi"><span style="font-weight: bold; color: #c20cb9;">grep</span> -r -no &#8216;\$CFG-&gt;<span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span><span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span>*&#8217;</div>
<p>This will print line numbers for matches. Hmmm, what happens if two or more matches are found on one line? Well the second var will be printed without the file and line number &#8212; silly badness, see below!</p>
<pre>./admin/auth.php:11:$CFG-&gt;libdir
./admin/auth.php:12:$CFG-&gt;libdir
./admin/auth.php:17:$CFG-&gt;wwwroot
<span style="color: #ff0000;">$CFG-&gt;admin</span>
./admin/auth.php:26:$CFG-&gt;auth
./admin/auth.php:29:$CFG-&gt;auth
./admin/auth.php:52:$CFG-&gt;registerauth
./admin/auth_config.php:7:$CFG-&gt;libdir
./admin/auth_config.php:11:$CFG-&gt;pagepath
</pre>
<p>To add some context to <span style="color: #ff0000;">$CFG-&gt;admin</span> (which appears on line 17 of admin/auth.php) we introduce <code>awk</code> to the fray.</p>
<div class="geshi"><span style="font-weight: bold; color: #c20cb9;">grep</span> -r -no &#8216;\$CFG-&gt;<span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span><span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span>*&#8217; . | <span style="font-weight: bold; color: #c20cb9;">awk</span> -F: &#8216;BEGIN<span style="font-weight: bold; color: #7a0874;">{</span> s=<span style="color: #ff0000;">&#8220;&#8221;</span> <span style="font-weight: bold; color: #7a0874;">}</span><span style="font-weight: bold; color: #7a0874;">{</span> <span style="font-weight: bold; color: #000000;">if</span><span style="font-weight: bold; color: #7a0874;">(</span>$<span style="color: #000000;">3</span><span style="font-weight: bold; color: #7a0874;">)</span> <span style="font-weight: bold; color: #7a0874;">{</span> print $<span style="color: #000000;">0</span>; s=$1<span style="color: #ff0000;">&#8220;:&#8221;</span>$2<span style="color: #ff0000;">&#8220;:&#8221;</span>; <span style="font-weight: bold; color: #7a0874;">}</span><span style="font-weight: bold; color: #000000;">else</span>  print s$<span style="color: #000000;">0</span>; <span style="font-weight: bold; color: #7a0874;">}</span>&#8216;</div>
<p>Here, <code>awk</code> saves the previous line&#8217;s first and second fields (separated by &#8216;:&#8217;) if the third field is not empty. If the third field is empty it prepends the first and second fields of the previous line to whatever is on the current line. Nifty, eh? So when we run our command line we now get:</p>
<pre>./admin/auth.php:11:$CFG-&gt;libdir
./admin/auth.php:12:$CFG-&gt;libdir
./admin/auth.php:17:$CFG-&gt;wwwroot
./admin/auth.php:17:$CFG-&gt;admin
./admin/auth.php:26:$CFG-&gt;auth
./admin/auth.php:29:$CFG-&gt;auth
./admin/auth.php:52:$CFG-&gt;registerauth
./admin/auth_config.php:7:$CFG-&gt;libdir
./admin/auth_config.php:11:$CFG-&gt;pagepath</pre>
<p>Much better! Now that we are getting all the data we can do something useful. Let&#8217;s sort everything for convenience.</p>
<div class="geshi"><span style="font-weight: bold; color: #c20cb9;">grep</span> -r -no &#8216;\$CFG-&gt;<span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span><span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span>*&#8217; . | <span style="font-weight: bold; color: #c20cb9;">awk</span> -F: &#8216;BEGIN<span style="font-weight: bold; color: #7a0874;">{</span> s=<span style="color: #ff0000;">&#8220;&#8221;</span> <span style="font-weight: bold; color: #7a0874;">}</span><span style="font-weight: bold; color: #7a0874;">{</span> <span style="font-weight: bold; color: #000000;">if</span><span style="font-weight: bold; color: #7a0874;">(</span>$<span style="color: #000000;">3</span><span style="font-weight: bold; color: #7a0874;">)</span> <span style="font-weight: bold; color: #7a0874;">{</span> print $<span style="color: #000000;">0</span>; s=$1<span style="color: #ff0000;">&#8220;:&#8221;</span>$2<span style="color: #ff0000;">&#8220;:&#8221;</span>; <span style="font-weight: bold; color: #7a0874;">}</span><span style="font-weight: bold; color: #000000;">else</span>  print s$<span style="color: #000000;">0</span>; <span style="font-weight: bold; color: #7a0874;">}</span>&#8216; | <span style="font-weight: bold; color: #c20cb9;">sort</span> -t: -k3</div>
<p>We are sorting our data by the third field in each row. So we tell sort to use &#8216;:&#8217; as our field delimiter with the <code>-t</code> and we tell <code>sort</code> to use the third field with <code>-k3</code>.</p>
<p>Now we&#8217;ll make everything prettier by using <code>awk</code> again (our data should be small enough). We use <code>awk</code> to keep track of the last file and variable <code>awk</code> sees and then make formatting improvements as these values change; e.g. if the Variable changes from $CFG-&gt;admin to $CFG-&gt;wwwroot then prepend variable name with <code>\n\n</code> which inserts two line returns. This all looks pretty scary&#8230;</p>
<div class="geshi"><span style="font-weight: bold; color: #c20cb9;">grep</span> -r -no &#8216;\$CFG-&gt;<span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span><span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span>*&#8217; . | <span style="font-weight: bold; color: #c20cb9;">awk</span> -F: &#8216;BEGIN<span style="font-weight: bold; color: #7a0874;">{</span> s=<span style="color: #ff0000;">&#8220;&#8221;</span> <span style="font-weight: bold; color: #7a0874;">}</span><span style="font-weight: bold; color: #7a0874;">{</span> <span style="font-weight: bold; color: #000000;">if</span><span style="font-weight: bold; color: #7a0874;">(</span>$<span style="color: #000000;">3</span><span style="font-weight: bold; color: #7a0874;">)</span> <span style="font-weight: bold; color: #7a0874;">{</span> print $<span style="color: #000000;">0</span>; s=$1<span style="color: #ff0000;">&#8220;:&#8221;</span>$2<span style="color: #ff0000;">&#8220;:&#8221;</span>; <span style="font-weight: bold; color: #7a0874;">}</span><span style="font-weight: bold; color: #000000;">else</span>  print s$<span style="color: #000000;">0</span>; <span style="font-weight: bold; color: #7a0874;">}</span>&#8216; | <span style="font-weight: bold; color: #c20cb9;">sort</span> -t: -k3 | <span style="font-weight: bold; color: #c20cb9;">awk</span> -F: &#8216;BEGIN<span style="font-weight: bold; color: #7a0874;">{</span> v=<span style="color: #ff0000;">&#8220;&#8221;</span>; f=<span style="color: #ff0000;">&#8220;&#8221;</span>; <span style="font-weight: bold; color: #7a0874;">}</span><span style="font-weight: bold; color: #7a0874;">{</span> <span style="font-weight: bold; color: #000000;">if</span><span style="font-weight: bold; color: #7a0874;">(</span>v!=$<span style="color: #000000;">3</span><span style="font-weight: bold; color: #7a0874;">)</span> <span style="font-weight: bold; color: #7a0874;">{</span> v = $<span style="color: #000000;">3</span>; f=<span style="color: #ff0000;">&#8220;&#8221;</span>; <span style="font-weight: bold; color: #7a0874;">printf</span> <span style="color: #ff0000;">&#8220;\n\n&#8221;</span>$<span style="color: #000000;">3</span>; <span style="font-weight: bold; color: #7a0874;">}</span> <span style="font-weight: bold; color: #000000;">if</span><span style="font-weight: bold; color: #7a0874;">(</span>f!=$<span style="color: #000000;">1</span><span style="font-weight: bold; color: #7a0874;">)</span> <span style="font-weight: bold; color: #7a0874;">{</span> f = $<span style="color: #000000;">1</span>; <span style="font-weight: bold; color: #7a0874;">printf</span> <span style="color: #ff0000;">&#8220;\n\t&#8221;</span>$<span style="color: #000000;">1</span>; <span style="font-weight: bold; color: #7a0874;">}</span> <span style="font-weight: bold; color: #7a0874;">printf</span> <span style="color: #ff0000;">&#8220;:&#8221;</span>$<span style="color: #000000;">2</span> <span style="font-weight: bold; color: #7a0874;">}</span>&#8216;</div>
<p>This gives us something nice and pretty for our terminal window.</p>
<pre>...
$CFG-&gt;apachemaxmem
        ./lib/moodlelib.php:7544:7545:7547:7548
$CFG-&gt;aspellextradicts
        ./lib/speller/server-scripts/spellchecker.php:27:28
$CFG-&gt;aspellpath
        ./admin/settings/appearance.php:57
        ./lib/adminlib.php:2870:2881
        ./lib/editor/htmlarea/htmlarea.php:174:174:279:279
        ./lib/javascript.php:8
        ./lib/speller/changes.txt:19:1:29
        ./lib/speller/server-scripts/spellchecker.php:14:5
        ./lib/weblib.php:4988
...
</pre>
<p>We can, however, spruce things up a bit for the web:</p>
<div class="geshi"><span style="font-weight: bold; color: #c20cb9;">grep</span> -r -no &#8216;\$CFG-&gt;<span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span><span style="font-weight: bold; color: #7a0874;">[</span>a-z<span style="font-weight: bold; color: #7a0874;">]</span>*&#8217; . | <span style="font-weight: bold; color: #c20cb9;">awk</span> -F: &#8216;BEGIN<span style="font-weight: bold; color: #7a0874;">{</span> s=<span style="color: #ff0000;">&#8220;&#8221;</span> <span style="font-weight: bold; color: #7a0874;">}</span><span style="font-weight: bold; color: #7a0874;">{</span> <span style="font-weight: bold; color: #000000;">if</span><span style="font-weight: bold; color: #7a0874;">(</span>$<span style="color: #000000;">3</span><span style="font-weight: bold; color: #7a0874;">)</span> <span style="font-weight: bold; color: #7a0874;">{</span> print $<span style="color: #000000;">0</span>; s=$1<span style="color: #ff0000;">&#8220;:&#8221;</span>$2<span style="color: #ff0000;">&#8220;:&#8221;</span>; <span style="font-weight: bold; color: #7a0874;">}</span><span style="font-weight: bold; color: #000000;">else</span>  print s$<span style="color: #000000;">0</span>; <span style="font-weight: bold; color: #7a0874;">}</span>&#8216; | <span style="font-weight: bold; color: #c20cb9;">sort</span> -t: -k3 | <span style="font-weight: bold; color: #c20cb9;">awk</span> -F: &#8216;BEGIN<span style="font-weight: bold; color: #7a0874;">{</span> v=<span style="color: #ff0000;">&#8220;&#8221;</span>; f=<span style="color: #ff0000;">&#8220;&#8221;</span>; <span style="font-weight: bold; color: #7a0874;">}</span><span style="font-weight: bold; color: #7a0874;">{</span> <span style="font-weight: bold; color: #000000;">if</span><span style="font-weight: bold; color: #7a0874;">(</span>v!=$<span style="color: #000000;">3</span><span style="font-weight: bold; color: #7a0874;">)</span> <span style="font-weight: bold; color: #7a0874;">{</span> v = $<span style="color: #000000;">3</span>; f=<span style="color: #ff0000;">&#8220;&#8221;</span>; <span style="font-weight: bold; color: #7a0874;">printf</span> <span style="color: #ff0000;">&#8220;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;&#8221;</span>$3<span style="color: #ff0000;">&#8220;&lt;/h1&gt;&#8221;</span>; <span style="font-weight: bold; color: #7a0874;">}</span>  <span style="font-weight: bold; color: #000000;">if</span><span style="font-weight: bold; color: #7a0874;">(</span>f!=$<span style="color: #000000;">1</span><span style="font-weight: bold; color: #7a0874;">)</span> <span style="font-weight: bold; color: #7a0874;">{</span> f = $<span style="color: #000000;">1</span>; <span style="font-weight: bold; color: #7a0874;">printf</span> <span style="color: #ff0000;">&#8220;&lt;br&gt;&lt;span style=\&#8221;</span>font-weight: bold\<span style="color: #ff0000;">&#8220;&gt;&#8221;</span>$1<span style="color: #ff0000;">&#8220;&lt;/span&gt;&#8221;</span>; <span style="font-weight: bold; color: #7a0874;">}</span> <span style="font-weight: bold; color: #7a0874;">printf</span> <span style="color: #ff0000;">&#8220;:&#8221;</span>$<span style="color: #000000;">2</span> <span style="font-weight: bold; color: #7a0874;">}</span>&#8216;</div>
<p>This gives us something like the following output:</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ADMIN</h3>
<p><span style="font-weight: bold;">./admin/auth.php</span>:17<br />
<span style="font-weight: bold;">./admin/auth_config.php</span>:18<br />
<span style="font-weight: bold;">./admin/block.php</span>:44<br />
<span style="font-weight: bold;">./admin/blocks.php</span>:157:172:237<br />
<span style="font-weight: bold;">./admin/collect/cron.php</span>:11<br />
<span style="font-weight: bold;">./admin/collect/index.php</span>:108:114:120:126:14:22:22:43:80:91<br />
<span style="font-weight: bold;">./admin/collect/lib.php</span>:31:709:75:76<br />
<span style="font-weight: bold;">./admin/collect/queue.php</span>:105:106:123:13<br />
<span style="font-weight: bold;">./admin/cron.php</span>:168:170<br />
<span style="font-weight: bold;">./admin/environment.php</span>:124<br />
<span style="font-weight: bold;">./admin/filter.php</span>:16<br />
<span style="font-weight: bold;">./admin/filters.php</span>:11<br />
<span style="font-weight: bold;">./admin/index.php</span>:422:427:432:437:441:445:448:451:456:459:460:463:464:465:468:471:471:523:602<br />
<span style="font-weight: bold;">./admin/lang.php</span>:102:122:127:130:131:132:142:493:754<br />
<span style="font-weight: bold;">./admin/langdoc.php</span>:101<br />
<span style="font-weight: bold;">./admin/mnet/access_control.php</span>:48:63:76:87<br />
<span style="font-weight: bold;">./admin/mnet/adminlib.php</span>:75<br />
<span style="font-weight: bold;">./admin/mnet/delete.html</span>:3:4<br />
<span style="font-weight: bold;">./admin/mnet/enr_courses.php</span>:40<br />
<span style="font-weight: bold;">./admin/mnet/enr_hosts.php</span>:40:52<br />
<span style="font-weight: bold;">./admin/module.php</span>:41<br />
<span style="font-weight: bold;">./admin/modules.php</span>:201<br />
<span style="font-weight: bold;">./admin/pagelib.php</span>:72<br />
<span style="font-weight: bold;">./admin/register.php</span>:37<br />
<span style="font-weight: bold;">./admin/report/assess/index.php</span>:12:13:193:50<br />
<span style="font-weight: bold;">./admin/report/certify/index.php</span>:11:159:270<br />
<span style="font-weight: bold;">./admin/report/courseoverview/index.php</span>:18:88<br />
<span style="font-weight: bold;">./admin/report/courseoverview/reportsgraph.php</span>:32<br />
<span style="font-weight: bold;">./admin/report/lastaccess/index.php</span>:12<br />
<span style="font-weight: bold;">./admin/report/lateforleveltwo/index.php</span>:14:86:90<br />
<span style="font-weight: bold;">./admin/report/numberofcourses/index.php</span>:12<br />
<span style="font-weight: bold;">./admin/report/stats/index.php</span>:31:47<br />
<span style="font-weight: bold;">./admin/roles/assign.php</span>:381<br />
<span style="font-weight: bold;">./admin/roles/managetabs.php</span>:10:12:14<br />
<span style="font-weight: bold;">./admin/roles/override.php</span>:160:187<br />
<span style="font-weight: bold;">./admin/roles/tabs.php</span>:182:190<br />
<span style="font-weight: bold;">./admin/settings.php</span>:19:42:6<br />
<span style="font-weight: bold;">./admin/settings/collect.php</span>:12:17:18:19<br />
<span style="font-weight: bold;">./admin/settings/courses.php</span>:12<br />
<span style="font-weight: bold;">./admin/settings/frontpage.php</span>:56<br />
<span style="font-weight: bold;">./admin/settings/language.php</span>:24:25<br />
<span style="font-weight: bold;">./admin/settings/location.php</span>:23<br />
<span style="font-weight: bold;">./admin/settings/misc.php</span>:19:23:24:25:26<br />
<span style="font-weight: bold;">./admin/settings/mnet.php</span>:13:16:19:22:9<br />
<span style="font-weight: bold;">./admin/settings/plugins.php</span>:141:33:41:64<br />
<span style="font-weight: bold;">./admin/settings/server.php</span>:161:218:219:247:248<br />
<span style="font-weight: bold;">./admin/settings/top.php</span>:16:19:36:46:55<br />
<span style="font-weight: bold;">./admin/settings/unsupported.php</span>:10:7:8:9<br />
<span style="font-weight: bold;">./admin/settings/users.php</span>:58:71:72:74:75:81:82<br />
<span style="font-weight: bold;">./admin/stickyblocks.php</span>:47:73<br />
<span style="font-weight: bold;">./admin/upgradesettings.php</span>:31<br />
<span style="font-weight: bold;">./admin/uploaduser.php</span>:65:66<br />
<span style="font-weight: bold;">./admin/user/user_bulk.php</span>:22:23:24:25:26:5:6<br />
<span style="font-weight: bold;">./admin/user/user_bulk_confirm.php</span>:14<br />
<span style="font-weight: bold;">./admin/user/user_bulk_delete.php</span>:14<br />
<span style="font-weight: bold;">./admin/user/user_bulk_display.php</span>:11<br />
<span style="font-weight: bold;">./admin/user/user_bulk_download.php</span>:14<br />
<span style="font-weight: bold;">./admin/user/user_bulk_message.php</span>:13<br />
<span style="font-weight: bold;">./admin/xmldb/actions/XMLDBAction.class.php</span>:161<br />
<span style="font-weight: bold;">./admin/xmldb/index.php</span>:106:78:88<br />
<span style="font-weight: bold;">./admin/xmldb/javascript.php</span>:42:43:49:50<br />
<span style="font-weight: bold;">./backup/backup.php</span>:104:76:91<br />
<span style="font-weight: bold;">./backup/backup_scheduled.php</span>:180<br />
<span style="font-weight: bold;">./backup/log.php</span>:11<br />
<span style="font-weight: bold;">./backup/restore.php</span>:103:96<br />
<span style="font-weight: bold;">./backup/restore_check.html</span>:268<br />
<span style="font-weight: bold;">./blocks/admin/block_admin.php</span>:67<br />
<span style="font-weight: bold;">./blocks/admin_bookmarks/block_admin_bookmarks.php</span>:55<br />
<span style="font-weight: bold;">./blocks/admin_bookmarks/create.php</span>:36<br />
<span style="font-weight: bold;">./blocks/admin_bookmarks/delete.php</span>:32<br />
<span style="font-weight: bold;">./blocks/admin_tree/block_admin_tree.php</span>:212:67<br />
<span style="font-weight: bold;">./blocks/certify/certify.php</span>:11<br />
<span style="font-weight: bold;">./blocks/certify/close.php</span>:86<br />
<span style="font-weight: bold;">./blocks/certify/config_instance.html</span>:13<br />
<span style="font-weight: bold;">./blocks/course_summary/block_course_summary.php</span>:33<br />
<span style="font-weight: bold;">./blocks/moodleblock.class.php</span>:475<br />
<span style="font-weight: bold;">./blocks/reports/block_reports.php</span>:41:50:85<br />
<span style="font-weight: bold;">./blocks/trouble_ticket/thanks.php</span>:25<br />
<span style="font-weight: bold;">./calendar/event.php</span>:64<br />
<span style="font-weight: bold;">./calendar/export.php</span>:19<br />
<span style="font-weight: bold;">./calendar/view.php</span>:54<br />
<span style="font-weight: bold;">./config-dist.php</span>:125<br />
<span style="font-weight: bold;">./config.php</span>:23<br />
<span style="font-weight: bold;">./course/category.php</span>:140:384<br />
<span style="font-weight: bold;">./course/delete.php</span>:34:65<br />
<span style="font-weight: bold;">./course/edit.php</span>:118:150<br />
<span style="font-weight: bold;">./course/editcategory.php</span>:179:323<br />
<span style="font-weight: bold;">./course/importstudents.php</span>:19<br />
<span style="font-weight: bold;">./course/mod.php</span>:706<br />
<span style="font-weight: bold;">./course/modedit.php</span>:446<br />
<span style="font-weight: bold;">./course/report/stats/index.php</span>:28<br />
<span style="font-weight: bold;">./course/search.php</span>:275<br />
<span style="font-weight: bold;">./enrol/authorize/enrol.php</span>:414:746<br />
<span style="font-weight: bold;">./enrol/imsenterprise/importnow.php</span>:13<br />
<span style="font-weight: bold;">./filter/algebra/algebradebug.php</span>:261<br />
<span style="font-weight: bold;">./filter/tex/texdebug.php</span>:263<br />
<span style="font-weight: bold;">./grade/report/grader/preferences.php</span>:87<br />
<span style="font-weight: bold;">./index.php</span>:38:56:62:74:83<br />
<span style="font-weight: bold;">./install.php</span>:139:547<br />
<span style="font-weight: bold;">./lib/adminlib.php</span>:3458:3498:3822:3972:3977:3985:4172:4175:4176:4335:776<br />
<span style="font-weight: bold;">./lib/db/mysql.php</span>:1473<br />
<span style="font-weight: bold;">./lib/db/postgres7.php</span>:1216<br />
<span style="font-weight: bold;">./lib/ddllib.php</span>:818:820<br />
<span style="font-weight: bold;">./lib/dmllib.php</span>:510<br />
<span style="font-weight: bold;">./lib/environmentlib.php</span>:320:323<br />
<span style="font-weight: bold;">./lib/moodlelib.php</span>:5099<br />
<span style="font-weight: bold;">./lib/pagelib.php</span>:471<br />
<span style="font-weight: bold;">./lib/setup.php</span>:184:185<br />
<span style="font-weight: bold;">./login/index.php</span>:9<br />
<span style="font-weight: bold;">./mod/assignment/lib.php</span>:2837<br />
<span style="font-weight: bold;">./mod/glossary/formats.php</span>:27:39<br />
<span style="font-weight: bold;">./mod/hotpot/db/update_to_v2.php</span>:519<br />
<span style="font-weight: bold;">./my/pagelib.php</span>:59<br />
<span style="font-weight: bold;">./question/upgrade.php</span>:90<br />
<span style="font-weight: bold;">./user/editadvanced.php</span>:153:158<br />
<span style="font-weight: bold;">./user/index.php</span>:100:542:548<br />
<span style="font-weight: bold;">./user/tabs.php</span>:225:233:235</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ADMINBLOCKS</h3>
<p><span style="font-weight: bold;">./admin/index.php</span>:522</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ADMINEDITALWAYS</h3>
<p><span style="font-weight: bold;">./config-dist.php</span>:147<br />
<span style="font-weight: bold;">./search/documents/forum_document.php</span>:169</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ADMINSEESALL</h3>
<p><span style="font-weight: bold;">./calendar/lib.php</span>:1426:1427</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ADMINUSEHTMLEDITOR</h3>
<p><span style="font-weight: bold;">./admin/settings.php</span>:166<br />
<span style="font-weight: bold;">./admin/upgradesettings.php</span>:58<br />
<span style="font-weight: bold;">./lib/adminlib.php</span>:2607:2608</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;AJAXCAPABLE</h3>
<p><span style="font-weight: bold;">./course/format/topics/ajax.php</span>:7<br />
<span style="font-weight: bold;">./course/format/weeks/ajax.php</span>:7<br />
<span style="font-weight: bold;">./course/view.php</span>:153:158</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;AJAXTESTEDBROWSERS</h3>
<p><span style="font-weight: bold;">./course/format/topics/ajax.php</span>:8<br />
<span style="font-weight: bold;">./course/format/weeks/ajax.php</span>:8<br />
<span style="font-weight: bold;">./course/view.php</span>:154:161</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ALLOWCATEGORYTHEMES</h3>
<p><span style="font-weight: bold;">./course/category.php</span>:97<br />
<span style="font-weight: bold;">./course/editcategory.php</span>:64<br />
<span style="font-weight: bold;">./course/editcategory_form.php</span>:20<br />
<span style="font-weight: bold;">./lib/weblib.php</span>:3003</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ALLOWCOURSETHEMES</h3>
<p><span style="font-weight: bold;">./course/edit_form.php</span>:143<br />
<span style="font-weight: bold;">./lib/weblib.php</span>:2998<br />
<span style="font-weight: bold;">./theme/chameleon/ui/chameleon.php</span>:14<br />
<span style="font-weight: bold;">./theme/chameleon/ui/css.php</span>:18</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ALLOWEMAILADDRESSES</h3>
<p><span style="font-weight: bold;">./lib/moodlelib.php</span>:4440:4441:4457</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ALLOWOBJECTEMBED</h3>
<p><span style="font-weight: bold;">./lib/weblib.php</span>:6584:6590</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ALLOWTHEMECHANGEONURL</h3>
<p><span style="font-weight: bold;">./lib/setup.php</span>:599</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ALLOWUNENROL</h3>
<p><span style="font-weight: bold;">./lib/db/access.php</span>:383</p>
<h3 style="color: #5f5f5f;">$CFG-&gt;ALLOWUSERBLOCKHIDING</h3>
<p><span style="font-weight: bold;">./blocks/moodleblock.class.php</span>:376<br />
<span style="font-weight: bold;">./lib/weblib.php</span>:6479</p>
</div>
<p>The post <a href="http://gl.ib.ly/computing/2009/06/24/configuration-variables-moodle-code-part-two/">All configuration variables in Moodle code &#8211; Part two</a> appeared first on <a href="http://gl.ib.ly">GL.IB.LY</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gl.ib.ly/computing/2009/06/24/configuration-variables-moodle-code-part-two/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting specific emails from the postfix mail queue</title>
		<link>http://gl.ib.ly/stuff/2009/01/08/deleting-specific-emails-postfix-mail-queue/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=deleting-specific-emails-postfix-mail-queue</link>
		<comments>http://gl.ib.ly/stuff/2009/01/08/deleting-specific-emails-postfix-mail-queue/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 06:16:30 +0000</pubDate>
		<dc:creator><![CDATA[tariq]]></dc:creator>
				<category><![CDATA[Stuff]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mailq]]></category>
		<category><![CDATA[one liners]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[postsuper]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://gl.ib.ly/?p=32</guid>
		<description><![CDATA[<p>A week ago a development database server lost power, which is usually no big deal only that I have some reporting scripts that run every 5 minutes for each database. When these databases became unavailable they (the scripts) like to<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://gl.ib.ly/stuff/2009/01/08/deleting-specific-emails-postfix-mail-queue/">Read more &#8250;</a></div><!-- end of .read-more --></p><p>The post <a href="http://gl.ib.ly/stuff/2009/01/08/deleting-specific-emails-postfix-mail-queue/">Deleting specific emails from the postfix mail queue</a> appeared first on <a href="http://gl.ib.ly">GL.IB.LY</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>A week ago a development database server lost power, which is usually no big deal only that I have some reporting scripts that run every 5 minutes for each database. When these databases became unavailable they (the scripts) like to send me a quick mail telling me what went wrong. The network switch also was out of action so there was no route to the outside world from this small development network. The server lost power for three days and a massive amount of mail built up in the mail queue. When power was restored the SPAM started pouring in.</p>
<div>
<p>As I started to receive the first wave of mails I logged into the server a did the typical <code>sudo mailq | wc -l</code> which showed 13,000 emails waiting to make their way down the ether. Unfortunately I couldn&#8217;t just delete all mail on this server so I had to think up a quick way to delete only the stuff I needed to; however, luckily, all my outgoing mail was sent from a unique address <i>database-reporter@my.dev.box</i>. Using this information I came up with the following one liner (in all its unedited glory).</p>
<pre style="padding-left: 30px;"># Executed as root
mailq | grep "database-reporter@my.dev.box" | awk '{ system("/usr/sbin/postsuper -d "$1); }'</pre>
<p>Now there are about a gazillion ways to do this (many are better) but I needed something which would stop those mails flying about the place before I got blacklisted and it worked, so there.<i>mailq</i> gets me a list of emails in postfix&#8217;s mail queue; <i>grep</i> gets me only the mails I am interested in; <i>awk</i> pulls out the mailID and uses it to issue a command to delete mail from the mailqueue with that id; simple.One better way to do this line could be:</p>
<pre style="padding-left: 30px;"># Executed as root
 mailq | grep "database-reporter@my.dev.box" | awk '{ print($1); }' | /usr/sbin/postsuper -d -</pre>
<p>This should be a lot quicker, as <i>postsuper</i> will read all the piped IDs and delete them as they arrive at STDIN. There is some good info in the <a title="http://www.postfix.org/postsuper.1.html" href="http://web.archive.org/web/20090531000552/http://gl.ib.ly/exit.php?url_id=12&amp;entry_id=10">man postfix</a> pages under the <i>-d</i> option.</p>
<p>A quick GFI came up with <a title="http://www.ubuntudog.com/?article=19" href="http://web.archive.org/web/20090531000552/http://gl.ib.ly/exit.php?url_id=13&amp;entry_id=10">Deleting mail in postfix queue (mailq)</a> which was about all the reference I needed.</p>
</div>
<p>The post <a href="http://gl.ib.ly/stuff/2009/01/08/deleting-specific-emails-postfix-mail-queue/">Deleting specific emails from the postfix mail queue</a> appeared first on <a href="http://gl.ib.ly">GL.IB.LY</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gl.ib.ly/stuff/2009/01/08/deleting-specific-emails-postfix-mail-queue/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
