<?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>Stefan&#039;s Blog</title>
	<atom:link href="http://blog.suncrescent.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.suncrescent.net</link>
	<description>PHP, MySQL, Web Design, CSS, Ajax, JavaScript</description>
	<lastBuildDate>Sun, 13 May 2012 22:33:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Disable mouse acceleration on Mac OS X</title>
		<link>http://blog.suncrescent.net/2012/05/disable-mouse-acceleration-on-mac-os-x/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=disable-mouse-acceleration-on-mac-os-x</link>
		<comments>http://blog.suncrescent.net/2012/05/disable-mouse-acceleration-on-mac-os-x/#comments</comments>
		<pubDate>Sat, 12 May 2012 23:58:00 +0000</pubDate>
		<dc:creator>sgraf</dc:creator>
				<category><![CDATA[Blog News]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[mouse acceleration]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[pointer]]></category>

		<guid isPermaLink="false">http://blog.suncrescent.net/?p=160</guid>
		<description><![CDATA[The most annoying thing I encounter when occasionnaly working on a Mac is the mouse acceleration. I found a command line that will disable it but you need to relog after executing it: defaults write -g com.apple.mouse.scaling -1 Note: Don&#8217;t touch &#8230; <a href="http://blog.suncrescent.net/2012/05/disable-mouse-acceleration-on-mac-os-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The most annoying thing I encounter when occasionnaly working on a Mac is the mouse acceleration. I found a command line that will disable it but <strong>you need to relog after executing it</strong>:</p>
<pre>defaults write -g com.apple.mouse.scaling -1</pre>
<p>Note: Don&#8217;t touch the mouse settings in Preferences or it will override the above change.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.suncrescent.net/2012/05/disable-mouse-acceleration-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating Magento code to be compatible with PHP 5.3</title>
		<link>http://blog.suncrescent.net/2012/05/updating-magento-code-to-be-compatible-with-php-5-3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=updating-magento-code-to-be-compatible-with-php-5-3</link>
		<comments>http://blog.suncrescent.net/2012/05/updating-magento-code-to-be-compatible-with-php-5-3/#comments</comments>
		<pubDate>Wed, 09 May 2012 11:35:08 +0000</pubDate>
		<dc:creator>sgraf</dc:creator>
				<category><![CDATA[Blog News]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.suncrescent.net/?p=109</guid>
		<description><![CDATA[Even tough PHP 5.3 has been out for quite a while, there is still lots of old code out there that will not run correctly when moved from 5.2 to 5.3. In my case I had to move a 2 &#8230; <a href="http://blog.suncrescent.net/2012/05/updating-magento-code-to-be-compatible-with-php-5-3/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Even tough PHP 5.3 has been out for quite a while, there is still lots of old code out there that will not run correctly when moved from 5.2 to 5.3. In my case I had to move a 2 year old Magento website to a new server and ran into problems as the default version of PHP on the new server was setup as PHP 5.3. Altough PHP 5.3 is a &#8220;minor&#8221; version, there is quite a few &#8220;deprecated&#8221; core functions and severak little things that just dont work the same anymore. So in this post I will explain specifically what functions I had to update and a couple of examples of how I did it in each case.</p>
<p><span id="more-109"></span></p>
<h2>split()</h2>
<p>The split function is deprecated, it might still work for now but will output a warning. The split function can be &#8220;converted&#8221; in two different ways.</p>
<p>If the split is defined by using a character or simple strings like &#8216;:&#8217; or &#8220;\r\n&#8221; it can be converted to explode(). The advantage of explode() being that it is slightly faster then using a regex based function.</p>
<p>If the split is defined by using a regex we have to convert it to using the regex comaptible preg_split() function.</p>
<p>To find occurrences you can use the regex search on <strong>[^\._\w]split\( </strong></p>
<h3>single character =&gt; split to explode (when  regex &#8217;\|&#8217; convert to character &#8216;|&#8217;)</h3>
<pre>split(':', $value)  =&gt;  explode(':', $value)</pre>
<pre>split(self::MULTI_DELIMITER, $value);  =&gt;  
explode(self::MULTI_DELIMITER, $value);</pre>
<h3>character class or full regex =&gt; split to preg_split</h3>
<pre>split('[[:space:]]+', trim($uname))  =&gt;
preg_split('/[[:space:]]+/', trim($uname))</pre>
<pre>split("\r?\n", $headers);  =&gt;  preg_split("/\r?\n/", $headers);</pre>
<pre>split('(, *)|,', $keywordsString);  =&gt;  
preg_split('/(, *)|,/', $keywordsString);</pre>
<p>&nbsp;</p>
<h2>magic_quotes</h2>
<p>Magic Quotes is mostly deprecated as of 5.3 and should be disabled by default on any serious PHP installation. Remove all lines containing to avoid warnings:</p>
<pre>get_magic_quotes_runtime</pre>
<pre>set_magic_quotes_runtime</pre>
<p>&nbsp;</p>
<h2>eregi()</h2>
<p>Change eregi to preg_match and change the existing regex expression. Add slashes to the begining and the end of the existing regex and add the i option at the end to make it case-insensitive. Example: <strong>/existing regex</strong>/<strong>i</strong></p>
<p><strong>Make sure any existing forward slashes / in the existing regex are escaped with a backslash \ (ie: &#8216;x/y&#8217; becomes &#8216;/x\/y/i&#8217;)</strong></p>
<p>There is many changes to do but here is some examples:</p>
<pre>eregi('Windows 9', php_uname())

=&gt;

preg_match('/Windows 9/i', php_uname())</pre>
<pre>$reg = '^' . str_replace(array('*', '?', '/'), array('.*', '.', '\\/'), $fragment) . '$';
 return eregi($reg, $value);

=&gt;

$reg = '/^' . str_replace(array('*', '?', '/'), array('.*', '.', '\\/'), $fragment) . '$/i';
return preg_match($reg, $value);</pre>
<pre>eregi('^(http|ftp)://', substr($file, 0, 10))
=&gt;
preg_match('/^(http|ftp):\/\//i', substr($file, 0, 10))</pre>
<p>&nbsp;</p>
<h2>ereg()</h2>
<p>Same principle as eregi(). Change to preg_match and add slashes at the begining and the end of the existing regex. Don&#8217;t add the i option, ereg is <strong>not</strong> case sensitive.</p>
<pre>ereg('^libc-(.*)\.so$', basename(readlink('/lib/libc.so.6')), $matches)
=&gt;
preg_match('/^libc-(.*)\.so$/', basename(readlink('/lib/libc.so.6')), $matches)</pre>
<p>&nbsp;</p>
<h2>gd_info() &#8220;JPG Support&#8221;</h2>
<p>Look for calls to gd_info(); The &#8220;JPG Support&#8221; array key was changed to JPEG Support in PHP 5.3.</p>
<p>$gd_options = gd_info();<br />
if (!$gd_options['JPG Support'] ) {</p>
<p>to</p>
<p>if ((!isset($gd_options['JPG Support']) || $gd_options['JPG Support'] != true) &amp;&amp;<br />
(!isset($gd_options['JPEG Support']) || $gd_options['JPEG Support'] != true)) {</p>
<p>&nbsp;</p>
<h2>__toString()</h2>
<p>In PHP 5.3 the __toString() magic method does not accept any parameters. Old code such as the one below will trigger a fatal error.</p>
<pre><code>Fatal error: Method __tostring() cannot take arguments</code></pre>
<p>Try a regex search for <strong>function[\s]+__toString\([^\)]+\)</strong> to find problematic code.</p>
<p>Changing</p>
<pre>public function __toString(array $arrAttributes = array(), $valueSeparator=',') {
    $arrData = $this-&gt;toArray($arrAttributes);
    return implode($valueSeparator, $arrData);
}</pre>
<p>to</p>
<pre>public function __toString() {
    if(func_num_args() == 2) {
        return $this-&gt;__invoke(func_get_arg(0), func_get_arg(1));
    } elseif(func_num_args() == 1) {
        return $this-&gt;__invoke(func_get_arg(0));
    } else {
        return $this-&gt;__invoke();
    }
}

/**
 * Convert object attributes to string
 *
 * @param array $arrAttributes array of required attributes
 * @param string $valueSeparator
 * @return string
 */
public function __invoke(array $arrAttributes = array(), $valueSeparator=',') {
    $arrData = $this-&gt;toArray($arrAttributes);
    return implode($valueSeparator, $arrData);
}</pre>
<p>&nbsp;</p>
<h2>dl()</h2>
<p>Do a regex search for <strong>[^_\.\w]dl\( </strong>which should only match one or two files in the PEAR folder.</p>
<p>Replace</p>
<pre>return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);</pre>
<p>with</p>
<pre>// return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
// dl() is deprecated in php 5.3
return false;</pre>
<p>&nbsp;</p>
<h2>PEAR</h2>
<p>Some changes inside the PEAR folders to fix potential issues when it tries to install PEAR packages. However, in general I don&#8217;t think the PEAR that shipped with older Magento versions is quite ready for php 5.3. Most likely Magento Connect will not work as expected anymore once the website is moved to a server using php 5.3. This should not be a big problem since you can install your Magento extensions manually.</p>
<pre>error_reporting(E_ALL &amp; ~E_NOTICE);</pre>
<p>to</p>
<pre>error_reporting(E_ALL &amp; ~E_NOTICE &amp; ~E_DEPRECATED);</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.suncrescent.net/2012/05/updating-magento-code-to-be-compatible-with-php-5-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix Mantis Captcha Image open_basedir Error</title>
		<link>http://blog.suncrescent.net/2012/05/mantis-captcha-open_basedir-error/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mantis-captcha-open_basedir-error</link>
		<comments>http://blog.suncrescent.net/2012/05/mantis-captcha-open_basedir-error/#comments</comments>
		<pubDate>Wed, 09 May 2012 03:30:01 +0000</pubDate>
		<dc:creator>sgraf</dc:creator>
				<category><![CDATA[Blog News]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[captcha]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[mantis]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.suncrescent.net/?p=135</guid>
		<description><![CDATA[I recently installed the lastest version of Mantis Bug Tracker. Sadly when I tried to signup for the first time, the captcha used in the signup form didn&#8217;t show up. Opening the generated jpeg file reveals several errors related to &#8230; <a href="http://blog.suncrescent.net/2012/05/mantis-captcha-open_basedir-error/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently installed the lastest version of Mantis Bug Tracker. Sadly when I tried to signup for the first time, the captcha used in the signup form didn&#8217;t show up. Opening the generated jpeg file reveals several errors related to my server&#8217;s PHP security settings.</p>
<p>SYSTEM WARNING: &#8216;file_exists(): open_basedir restriction in effect. File(/usr/share/fonts/corefonts/) is not within the allowed path(s)</p>
<p>mantis/core/utility_api.phpin utility_api.php&#8217; line 253<br />
mantis/core/utility_api.phputility_api.php&#8217; line 255<br />
mantis/core/utility_api.php line 257<br />
mantis/make_captcha_img.php line 124</p>
<p>To fix the problem I added a <strong>fonts</strong> folder within my Mantis installation root, added the ARIAL.TTF font file inside that folder and then added a $g_system_font_folder variable to the mantis configuration file config_inc.php to point to the fonts folder.</p>
<h2>Step by step guide</h2>
<p><span id="more-135"></span></p>
<div id="attachment_138" class="wp-caption alignnone" style="width: 545px"><a href="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard03.jpg"><img class="size-full wp-image-138" title="Open the Windows Fonts folder in your Control Panel" src="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard03.jpg" alt="" width="535" height="463" /></a><p class="wp-caption-text">Open the Windows Fonts folder in your Control Panel</p></div>
<div id="attachment_139" class="wp-caption alignnone" style="width: 545px"><a href="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard04.jpg"><img class="size-full wp-image-139" title="Click on Arial" src="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard04.jpg" alt="" width="535" height="463" /></a><p class="wp-caption-text">Double-click on Arial to open the contents</p></div>
<div id="attachment_140" class="wp-caption alignnone" style="width: 545px"><a href="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard05.jpg"><img class="size-full wp-image-140" title="Select Arial Regular" src="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard05.jpg" alt="" width="535" height="494" /></a><p class="wp-caption-text">Select Arial Regular and right-click &gt; Copy (or Ctrl+C)</p></div>
<div id="attachment_142" class="wp-caption alignnone" style="width: 680px"><a href="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard06.jpg"><img class="size-full wp-image-142" title="Add Fonts Folder" src="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard06.jpg" alt="" width="670" height="485" /></a><p class="wp-caption-text">Add a folder named fonts in the Mantis folder</p></div>
<div id="attachment_137" class="wp-caption alignnone" style="width: 679px"><a href="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard07.jpg"><img class=" wp-image-137 " title="Rename arial.ttf file to upper case" src="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard07.jpg" alt="" width="669" height="485" /></a><p class="wp-caption-text">Paste the Arial file into the fonts folder and rename arial.ttf file to upper case ARIAL.TTF</p></div>
<p>&nbsp;</p>
<div id="attachment_136" class="wp-caption alignnone" style="width: 625px"><a href="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard02.jpg"><img class=" wp-image-136" title="Change config_inc.php" src="http://blog.suncrescent.net/wp-content/uploads/2012/05/Clipboard02.jpg" alt="" width="615" height="417" /></a><p class="wp-caption-text">Add $g_system_font_folder = __DIR__ . &#39;/fonts&#39;; to config_inc.php</p></div>
<p>Last step is to upload config_inc.php and the fonts folder to your web hosting.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.suncrescent.net/2012/05/mantis-captcha-open_basedir-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento Notice: Undefined index: 0</title>
		<link>http://blog.suncrescent.net/2012/03/magento-notice-undefined-index-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=magento-notice-undefined-index-0</link>
		<comments>http://blog.suncrescent.net/2012/03/magento-notice-undefined-index-0/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 16:07:11 +0000</pubDate>
		<dc:creator>sgraf</dc:creator>
				<category><![CDATA[Blog News]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[error]]></category>

		<guid isPermaLink="false">http://blog.suncrescent.net/?p=131</guid>
		<description><![CDATA[Today I got this mysterious error message after moving a Magento website to a new server. Magento Notice: Undefined index: 0  in .../htdocs/app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92 Turns out this was due to a faulty import of the database. Apparently there &#8230; <a href="http://blog.suncrescent.net/2012/03/magento-notice-undefined-index-0/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I got this mysterious error message after moving a Magento website to a new server.</p>
<pre>Magento Notice: Undefined index: 0  in .../htdocs/app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92</pre>
<p>Turns out this was due to a faulty import of the database. Apparently there are a few tables where using an id of 0 in the auto_increment column has a particular meaning and is intended. When restoring the MySQL dump through Navicat it replaced id values of 0 in auto_increment columns with new auto-incremented ids instead of 0 which broke Magento.</p>
<p>To fix this I simply dropped the whole database and reimported the dump using the official MySQL command line client (mysql -u username -p db_name &lt; scrip.sql) and everything worked fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.suncrescent.net/2012/03/magento-notice-undefined-index-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netbeans Preparing Commit</title>
		<link>http://blog.suncrescent.net/2012/03/netbeans-preparing-commit/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netbeans-preparing-commit</link>
		<comments>http://blog.suncrescent.net/2012/03/netbeans-preparing-commit/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 15:55:05 +0000</pubDate>
		<dc:creator>sgraf</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Netbeans]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://blog.suncrescent.net/?p=101</guid>
		<description><![CDATA[If you ever tried to SVN commit a big project using Netbeans (Magento?) you have most likely seen that &#8220;Preparing Commit&#8221; message doing seemingly absolutely nothing for several minutes. Apparently the commit takes forever because Netbeans is scanning the entire &#8230; <a href="http://blog.suncrescent.net/2012/03/netbeans-preparing-commit/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you ever tried to SVN commit a big project using Netbeans (Magento?) you have most likely seen that &#8220;Preparing Commit&#8221; message doing seemingly absolutely nothing for several minutes. Apparently the commit takes forever because Netbeans is scanning the entire projet to localize any changes done by external applications before committing. This is not really an issue in 99% of my usual work days thus I had to find a way to disable this.</p>
<p>Seems that adding</p>
<pre>-J-Dnetbeans.subversion.commit.deepStatusRefresh=false</pre>
<p>To he netbeans configuration file will disable the automatic scan during the commit preparation phase. If for whatever reason  you end up changing a file outside Netbeans (external text editor, adding new pictures&#8230;) you cam simply go to the &#8220;Files&#8221; tab and right-click your projet and hit &#8220;Refresh Folder&#8221; to let it scan everything.</p>
<p>See <span style="text-decoration: underline;"><a title="http://wiki.netbeans.org/FaqNetbeansConf" href="http://wiki.netbeans.org/FaqNetbeansConf" target="_blank">http://wiki.netbeans.org/FaqNetbeansConf</a></span> for information on how to change the netbeans configuration file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.suncrescent.net/2012/03/netbeans-preparing-commit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento: Ultimate cache clear script</title>
		<link>http://blog.suncrescent.net/2009/06/magento-ultimate-cache-clear-script/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=magento-ultimate-cache-clear-script</link>
		<comments>http://blog.suncrescent.net/2009/06/magento-ultimate-cache-clear-script/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 13:42:35 +0000</pubDate>
		<dc:creator>sgraf</dc:creator>
				<category><![CDATA[Blog News]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[catalog rewrites]]></category>
		<category><![CDATA[clear]]></category>
		<category><![CDATA[image cache]]></category>
		<category><![CDATA[layered navigation]]></category>
		<category><![CDATA[search index]]></category>
		<category><![CDATA[stock status]]></category>

		<guid isPermaLink="false">http://mystic-one.com/?p=67</guid>
		<description><![CDATA[If you have been using Magento with a BIG database of products you will soon realize that the built-in &#8220;cache management&#8221; is quite limited due to the server&#8217;s usual time limit on requests. You just can&#8217;t refresh your catalog rewrites &#8230; <a href="http://blog.suncrescent.net/2009/06/magento-ultimate-cache-clear-script/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you have been using Magento with a BIG database of products you will soon realize that the built-in &#8220;cache management&#8221; is quite limited due to the server&#8217;s usual time limit on requests. You just can&#8217;t refresh your catalog rewrites on 5000 products in less then a good 5 minutes and the other functions might give you the same problems as well.</p>
<p>By extracting the code from the cache management controller I was able to build a custom script that can be called via command line on the server and that will allow you to do a full cache refresh without any kind of time limit or connection timeout issues. The only requirement is shell access to your website files by SSH, Telnet or a terminal of some sort.</p>
<p><span id="more-67"></span>Put this file inside /app/ right next to the Mage.php file. To use it, you can simply navigate to the /app folder with your SSH client (or terminal if you run the website on your local PC) do <strong>php -f clearcache.php</strong> or for fastcgi adepts <strong>php-cgi -f clearcache.php</strong></p>
<h6><strong>Call the file clearcache.php and you can comment out the parts you don&#8217;t need if you only want to refresh one kind of resource (ie: comment out the stock status try/catch block if you don&#8217;t want to refresh product stocks).<br />
</strong></h6>
<pre>&lt;?php

ini_set('memory_limit', '512M');

require './Mage.php';

Mage::app('admin');
Mage::setIsDeveloperMode(true);

if (!Mage::app()-&gt;isInstalled()) {
    echo "Application is not installed yet, please complete install wizard first.";
    exit(1);
}

// Only for urls
// Don't remove this
$_SERVER['SCRIPT_FILENAME'] = 'index.php';

try
{
    // CLEAN CACHE
    Mage::app()-&gt;cleanCache();
    echo 'Cleared all caches' . "\n";

    // CATALOG REWRITES
    try {
        Mage::getSingleton('catalog/url')-&gt;refreshRewrites();
        echo 'Catalog Rewrites were refreshed successfully' . "\n";
    }
    catch (Mage_Core_Exception $e) {
        echo $e-&gt;getMessage() . "\n";
    }
    catch (Exception $e) {
        echo 'Error while refreshed Catalog Rewrites. Please try again later' . "\n";
    }

    // IMAGE CACHE
    try {
        Mage::getModel('catalog/product_image')-&gt;clearCache();
        echo 'Image cache was cleared succesfuly' . "\n";
    }
    catch (Mage_Core_Exception $e) {
        echo $e-&gt;getMessage() . "\n";
    }
    catch (Exception $e) {
        echo 'Error while cleared Image cache. Please try again later' . "\n";
    }

    // LAYERED NAV
    try {
        $flag = Mage::getModel('catalogindex/catalog_index_flag')-&gt;loadSelf();
        if ($flag-&gt;getState() == Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_RUNNING) {
            $kill = Mage::getModel('catalogindex/catalog_index_kill_flag')-&gt;loadSelf();
            $kill-&gt;setFlagData($flag-&gt;getFlagData())-&gt;save();
        }

        $flag-&gt;setState(Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_QUEUED)-&gt;save();
        Mage::getSingleton('catalogindex/indexer')-&gt;plainReindex();
        echo 'Layered Navigation Indices were refreshed successfully' . "\n";
    }
    catch (Mage_Core_Exception $e) {
        echo $e-&gt;getMessage() . "\n";
    }
    catch (Exception $e) {
        echo 'Error while refreshed Layered Navigation Indices. Please try again later' . "\n";
    }

    // SEARCH INDEX
    try {
        Mage::getSingleton('catalogsearch/fulltext')-&gt;rebuildIndex();
        echo 'Search Index was rebuilded successfully' . "\n";
    }
    catch (Mage_Core_Exception $e) {
        echo $e-&gt;getMessage() . "\n";
    }
    catch (Exception $e) {
        echo 'Error while rebuilded Search Index. Please try again later' . "\n";
    }

    // STOCK STATUS
    try {
        Mage::getSingleton('cataloginventory/stock_status')-&gt;rebuild();
        echo 'CatalogInventory Stock Status was rebuilded successfully' . "\n";
    }
    catch (Mage_Core_Exception $e) {
        echo $e-&gt;getMessage() . "\n";
    }
    catch (Exception $e) {
        echo 'Error while rebuilded CatalogInventory Stock Status. Please try again later' . "\n";
    }

    // CLEAN CACHE
    Mage::app()-&gt;cleanCache();
    echo 'Cleared all caches' . "\n";    

    echo  "\n" . 'Cache clear complete!' . "\n";

    exit(0);
}
catch (Exception $e) {
    Mage::printException($e);
}

exit(1);</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.suncrescent.net/2009/06/magento-ultimate-cache-clear-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Magento: How to change the admin theme</title>
		<link>http://blog.suncrescent.net/2009/03/magento-how-to-change-the-admin-theme/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=magento-how-to-change-the-admin-theme</link>
		<comments>http://blog.suncrescent.net/2009/03/magento-how-to-change-the-admin-theme/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 21:54:47 +0000</pubDate>
		<dc:creator>sgraf</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[admin theme]]></category>
		<category><![CDATA[administration default theme]]></category>
		<category><![CDATA[customize]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://mystic-one.com/?p=47</guid>
		<description><![CDATA[So you want to use Magento for your company and now you have to change the look of the backend. Of course you don&#8217;t want to change the default Magento adminhtml theme and kill any chances of upgrading your templates &#8230; <a href="http://blog.suncrescent.net/2009/03/magento-how-to-change-the-admin-theme/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">So you want to use Magento for your company and now you have to change the look of the backend. Of course you don&#8217;t want to change the default Magento adminhtml theme and kill any chances of upgrading your templates later on. So thats where this post comes into play. ;)</p>
<p style="text-align: justify;">Theres an easy way to add your own theme folder and use it to customize the look of your admin control panel. All files that aren&#8217;t included in your theme will fall back to the default Magento theme, thus avoiding any problems with missing templates and making it a lot easier to change only a few files.</p>
<h3>Add a new adminhtml theme</h3>
<p>Start by adding a new folder inside the <strong>app/design/adminhtml/default</strong> folder. To start out, the folder should also contain one sub-folders called <strong>template</strong>.</p>
<p>So, for example, you add a folder called <strong>mytheme</strong>, and inside it you add another folder called <strong>template</strong>.</p>
<h3>Overriding Magento configuration</h3>
<p>All you have to do is add a new <strong>config.xml</strong> file inside <strong>app/code/local/MyCompany/Adminhtml/etc</strong>. Add the following code inside the file:</p>
<h6><strong><strong>Note: if you created this file by following one of my earlier guides you don&#8217;t have to create it again and you would simply add the &lt;stores&gt; section at the appropriate location inside the existing file.</strong></strong></h6>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config&gt;
    &lt;modules&gt;
        &lt;MyCompany_Adminhtml&gt;
            &lt;version&gt;0.1.1&lt;/version&gt;
        &lt;/MyCompany_Adminhtml&gt;
    &lt;/modules&gt;
    &lt;stores&gt;
        &lt;admin&gt;
            &lt;!-- override default admin design package and theme --&gt;
            &lt;design&gt;
                &lt;package&gt;
                    &lt;name&gt;default&lt;/name&gt;
                &lt;/package&gt;
                &lt;theme&gt;
                    &lt;default&gt;mytheme&lt;/default&gt;
                &lt;/theme&gt;
            &lt;/design&gt;
        &lt;/admin&gt;
    &lt;/stores&gt;
&lt;/config&gt;</pre>
<p>You will also have to tell Magento about this new module in an XML file placed inside /<strong>app/etc/modules. </strong>This file could be called <strong>MyCompany.xml </strong>and inside you would copy/paste:</p>
<h6><strong>Note: if you created this file by following one of my earlier guides you don&#8217;t have to create it again.<br />
</strong></h6>
<pre style="text-align: left;">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config&gt;
    &lt;modules&gt;
        &lt;MyCompany_Adminhtml&gt;
	    &lt;active&gt;true&lt;/active&gt;
            &lt;codePool&gt;local&lt;/codePool&gt;
            &lt;depends&gt;
                &lt;Mage_Adminhtml /&gt;
            &lt;/depends&gt;
        &lt;/MyCompany_Adminhtml&gt;
    &lt;/modules&gt;
&lt;/config&gt;</pre>
<h3>Changing template files</h3>
<p>Now to change the default Magento templates you basically copy the .phtml files from the <strong>app/design/adminhtml/default/default/template</strong> folder into your own template folder and change the contents of the .phtml file to suit your needs.</p>
<p>For example, if you want to change the login box and remove the Magento copyright message:</p>
<p>Copy <strong>app/design/adminhtml/default/default/template/login.phml</strong> into the <strong>app/design/adminhtml/default/mytheme/template</strong> folder and then change the &lt;p class=&#8221;legal&#8221;&gt;&lt;/p&gt; to put your own legal note.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.suncrescent.net/2009/03/magento-how-to-change-the-admin-theme/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Magento: How to disable update notifications</title>
		<link>http://blog.suncrescent.net/2009/03/magento-how-to-disable-update-notifications/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=magento-how-to-disable-update-notifications</link>
		<comments>http://blog.suncrescent.net/2009/03/magento-how-to-disable-update-notifications/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 18:38:04 +0000</pubDate>
		<dc:creator>sgraf</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://mystic-one.com/?p=43</guid>
		<description><![CDATA[A short tutorial on how to block the &#8220;New Magento Version&#8221; notifications in the Magento admin without modifying the core packages. Create a new package under app/code/local , for this example lets make a &#8220;MyCompany&#8221; package. If you already have &#8230; <a href="http://blog.suncrescent.net/2009/03/magento-how-to-disable-update-notifications/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A short tutorial on how to block the &#8220;New Magento Version&#8221; notifications in the Magento admin without modifying the core packages.</p>
<p>Create a new package under app/code/local , for this example lets make a &#8220;MyCompany&#8221; package. If you already have an existing package for your magento mods you can use that one but you will have to change all references to MyCompany in the following code.</p>
<pre style="text-align: left;">Create folder app/code/local/MyCompany</pre>
<p style="text-align: left;">Create a new module called &#8220;Adminhtml&#8221; containing a &#8220;Block&#8221; folder and a &#8220;etc&#8221; folder.</p>
<pre>Create folder app/code/local/MyCompany/Adminhtml</pre>
<pre>Create folder app/code/local/MyCompany/Adminhtml/Block</pre>
<pre style="text-align: left;">Create folder app/code/local/MyCompany/Adminhtml/etc</pre>
<p>Add a &#8220;Notification&#8221; folder inside the Block folder.</p>
<pre>Create folder app/code/local/MyCompany/Adminhtml/Block/Notification</pre>
<p>Create Toolbar.php inside the MyCompany/Block/Notification folder.</p>
<pre style="text-align: left;">&lt;?php
/**
 * Block all notifications
 */
class MyCompany_Adminhtml_Block_Notification_Toolbar extends Mage_Adminhtml_Block_Template
{
    public function isShow()
    {
	return false;
    }

    public function isMessageWindowAvailable()
    {
        return false;
    }
}</pre>
<p>Create Window.php inside the MyCompany/Adminhtml/Block/Notification folder.</p>
<pre style="text-align: left;">&lt;?php
/**
 * Prevent popup window
 */
class MyCompany_Adminhtml_Block_Notification_Window extends Mage_Adminhtml_Block_Notification_Window
{
    public function canShow()
    {
        return false;
    }
}</pre>
<p>Create config.xml file inside the MyCompany/Adminhtml/etc folder</p>
<pre style="text-align: left;">&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;config&gt;

    &lt;modules&gt;
        &lt;MyCompany_Adminhtml&gt;
            &lt;version&gt;0.1.0&lt;/version&gt;
        &lt;/MyCompany_Adminhtml&gt;
    &lt;/modules&gt;

    &lt;global&gt;

        &lt;blocks&gt;
          &lt;adminhtml&gt;
              &lt;rewrite&gt;
             	  &lt;notification_window&gt;MyCompany_Adminhtml_Block_Notification_Window&lt;/notification_window&gt;
		  &lt;notification_toolbar&gt;MyCompany_Adminhtml_Block_Notification_Toolbar&lt;/notification_toolbar&gt;
              &lt;/rewrite&gt;
          &lt;/adminhtml&gt;
        &lt;/blocks&gt;

    &lt;/global&gt;

&lt;/config&gt;</pre>
<p>Last but not least, you have to create a new Modules XML file to load your module. Create MyCompany.xml inside the app/etc/modules folder.</p>
<pre style="text-align: left;">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config&gt;
    &lt;modules&gt;
        &lt;MyCompany_Adminhtml&gt;
	    &lt;active&gt;true&lt;/active&gt;
            &lt;codePool&gt;local&lt;/codePool&gt;
            &lt;depends&gt;
                &lt;Mage_Adminhtml /&gt;
            &lt;/depends&gt;
        &lt;/MyCompany_Adminhtml&gt;
    &lt;/modules&gt;
&lt;/config&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.suncrescent.net/2009/03/magento-how-to-disable-update-notifications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Enable Ant For Zend Studio</title>
		<link>http://blog.suncrescent.net/2008/12/how-to-enable-ant-for-zend-studio/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-enable-ant-for-zend-studio</link>
		<comments>http://blog.suncrescent.net/2008/12/how-to-enable-ant-for-zend-studio/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 14:02:29 +0000</pubDate>
		<dc:creator>sgraf</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[studio]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://mystic-one.com/?p=37</guid>
		<description><![CDATA[This week I found out that Zend Studio has Ant disabled by default (no idea why). Then I tried find a way to reactivate it by installing plugins or opening the workspace in a standard eclipse. Finally I found a &#8230; <a href="http://blog.suncrescent.net/2008/12/how-to-enable-ant-for-zend-studio/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This week I found out that Zend Studio has Ant disabled by default (no idea why). Then I tried find a way to reactivate it by installing plugins or opening the workspace in a standard eclipse. Finally I found a nice post on the internet that explains how to have Zend reactivate the Ant plugins which are actually already installed and ready to be used.</p>
<p>1. Click File-&gt;New&#8230;-&gt;Other&#8230;</p>
<p>2. Click on the Java folder and select Existing project using Ant buildfile&#8230;.</p>
<p>3. Click next</p>
<p>4. A message should popup asking you if you want to enable Ant, click OK</p>
<p>5. Close the new project wizard, you don&#8217;t have to actually create a project.</p>
<p>Go to Window-&gt;Show View-&gt;Other&#8230;, the Ant view should now be in the list.</p>
<p>Enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.suncrescent.net/2008/12/how-to-enable-ant-for-zend-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running MySQL Proxy as a daemon</title>
		<link>http://blog.suncrescent.net/2008/08/running-mysql-proxy-as-a-daemon/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=running-mysql-proxy-as-a-daemon</link>
		<comments>http://blog.suncrescent.net/2008/08/running-mysql-proxy-as-a-daemon/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 21:36:59 +0000</pubDate>
		<dc:creator>sgraf</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySQL-Proxy]]></category>

		<guid isPermaLink="false">http://mystic-one.com/?p=24</guid>
		<description><![CDATA[I had to figure out how to setup mySQL Proxy to run as a daemon (system service). The original information came from this page and has been slightly modified. It is assumed that mySQL Proxy has been installed and the &#8230; <a href="http://blog.suncrescent.net/2008/08/running-mysql-proxy-as-a-daemon/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div>I had to figure out how to setup mySQL Proxy to run as a daemon (system service).</div>
<div>The original information came from <a href="http://www.google.com/url?q=http%3A%2F%2Fforge.mysql.com%2Fwiki%2FMySQL_Proxy_init&amp;sa=D&amp;sntz=1&amp;usg=AFrqEzfnz7U8Ru3tuhtsZgq3u15rC97jJA">this page</a> and has been slightly modified.</div>
<div>It is assumed that mySQL Proxy has been installed and the mysql-proxy executable is located at /usr/local/sbin/mysql-proxy.</div>
<div>The first file is the init.d launch script:</div>
<div>
<div class="goog-ws-dash-box goog-ws-dash-text">
<h4>/etc/init.d/mysql-proxy</h4>
<div class="goog-ws-dash-box-inside">
<pre style="font-family: courier new,monospace;">#!/bin/sh
#
# mysql-proxy This script starts and stops the mysql-proxy daemon
#
# chkconfig: - 78 30
# processname: mysql-proxy
# description: mysql-proxy is a proxy daemon to mysql

# Source function library.
. /etc/rc.d/init.d/functions

PROXY_PATH="/usr/local/sbin"

prog="mysql-proxy"

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] &amp;&amp; exit 0

# Set default mysql-proxy configuration.
PROXY_OPTIONS="--daemon"
PROXY_PID=/var/run/mysql-proxy.pid

# Source mysql-proxy configuration.
if [ -f /etc/sysconfig/mysql-proxy ] ; then
        . /etc/sysconfig/mysql-proxy
fi

PATH=$PATH:/usr/bin:/usr/local/bin:$PROXY_PATH

# By default it's all good
RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start daemon.
        echo -n $"Starting $prog: "
        daemon $NICELEVEL $PROXY_PATH/mysql-proxy $PROXY_OPTIONS --pid-file $PROXY_PID
        RETVAL=$?
        echo
        if [ $RETVAL = 0 ]; then
                touch /var/lock/subsys/mysql-proxy
        fi
        ;;
  stop)
        # Stop daemons.
        echo -n $"Stopping $prog: "
        killproc $prog
        RETVAL=$?
        echo
        if [ $RETVAL = 0 ]; then
                rm -f /var/lock/subsys/mysql-proxy
                rm -f $PROXY_PID
        fi
        ;;
  restart)
        $0 stop
        sleep 3
        $0 start
        ;;
  condrestart)
       [ -e /var/lock/subsys/mysql-proxy ] &amp;&amp; $0 restart
       ;;
  status)
        status mysql-proxy
        RETVAL=$?
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|status|condrestart}"
        RETVAL=1
        ;;
esac

exit $RETVAL</pre>
</div>
</div>
</div>
<div>The launch script will either use the default configuration or read it from the file /etc/sysconfig/mysql-proxy if it exists.</div>
<div>To set mysql-proxy parameters create:</div>
<div class="goog-ws-dash-box goog-ws-dash-text">
<h4>/etc/sysconfig/mysql-proxy</h4>
<pre># Options to mysql-proxy
# do not remove --daemon
PROXY_OPTIONS="
<span> </span>--daemon
<span> </span>--proxy-backend-addresses=127.0.0.1:3306
<span> </span>--proxy-backend-addresses=127.0.0.1:3307
<span> </span>--proxy-lua-script=load-balancing.lua"</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.suncrescent.net/2008/08/running-mysql-proxy-as-a-daemon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

