<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		
		<title>HowTos von foobar.lamp-solutions.de</title>
		<link>http://foobar.lamp-solutions.de/</link>
		<description>HowTos von foobar.lamp-solutions.de</description>
		<language>de</language>
		<image>
			<title>HowTos von foobar.lamp-solutions.de</title>
			<url>http://foobar.lamp-solutions.de/fileadmin/tt_news_article.gif</url>
			<link>http://foobar.lamp-solutions.de/</link>
			<description>HowTos von foobar.lamp-solutions.de</description>
		</image>
		<generator>TYPO3 - get.content.right</generator>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		
		
		
		<lastBuildDate>Wed, 28 Dec 2011 15:10:00 +0100</lastBuildDate>
		
		
		<item>
			<title>Problem mit wordpress-mu-domain-mapping und Wordpress 3.3  </title>
			<link>http://foobar.lamp-solutions.de/howtos/wordpress/plugins/plugins-einzelansicht/artikel/problem-mit-wordpress-mu-domain-mapping-und-wordpress-33.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/wordpress/plugins/plugins-einzelansicht/artikel/problem-mit-wordpress-mu-domain-mapping-und-wordpress-33.html</guid>
			<description>Das beliebte Plugin wordpress-mu-domain-mapping, das vor allem in Multiblogs eingesetzt wird, ...</description>
			<content:encoded><![CDATA[Vor einiger Zeit habe ich eine kurze Anleitung verfasst, wie ein&nbsp;<link http://foobar.lamp-solutions.de/howtos/wordpress/plugins/plugins-einzelansicht/archive/2011/may/artikel/mehrere-blogs-mit-einer-wordpress-installation-betreiben.html - external-link-new-window "Öffnet externen Link in neuem Fenster">Multiblog in Wordpress</link>&nbsp;eingerichtet wird.
Um die Blogs über Domainnamen aufzurufen ist, wie im Artikel beschrieben, das Wordpress-Plugin&nbsp;<link http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/ - external-link-new-window "Öffnet externen Link in neuem Fenster">wordpress-mu-domain-mapping</link>&nbsp;nötig. Die Version 0.5.4.1 funktioniert mit dem neu erschienen Wordpress 3.3 nicht mehr richtig.
Bei der Einrichtung des Plugins wird die vorgenommene Konfiguration unter &quot;Domain Mapping Configuration&quot; nicht gespeichert.
IP Adressen können gar nicht in &quot;Server IP Address: &quot; nachgetragen werden. Dazu musste das gesamte Plugin gelöscht und neu eingerichtet werden, denn nur bei der Erstkonfiguration konnte die entsprechende IP-Adresse eingegeben werden, über welche die eingerichteten Blogs funktionieren sollten.
Auch wurden alle anderen Einstellungen wurden nicht berücksichtigt, sondern alle Optionen eingetragen. Zum Beispiel &quot;Redirect administration pages to site's original domain&quot;, welches explizit nicht gewünscht war.
<h2>Lösung</h2>
Seit kurzer Zeit ist eine&nbsp;<link http://downloads.wordpress.org/plugin/wordpress-mu-domain-mapping.zip - external-link-new-window "Öffnet externen Link in neuem Fenster">Entwickler-Version</link>&nbsp;der Version 0.5.4.2 verfügbar, welche die oben beschriebenen Probleme nicht vorweist.
Es ist auch abzuwarten, dass es nicht mehr lange dauert bis auch eine stabile Version des Plugins erscheint, die die volle Kompatibilität mit Wordpress 3.3 mitbringt.]]></content:encoded>
			<category>Plugins</category>
			
			
			<pubDate>Wed, 28 Dec 2011 15:10:00 +0100</pubDate>
			
		</item>
		
		<item>
			<title>Mit Varnish-Proxy eigene Seiten günstig über mehrere Server verteilen </title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/mit-varnish-proxy-eigene-seiten-guenstig-ueber-mehrere-server-verteilen.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/mit-varnish-proxy-eigene-seiten-guenstig-ueber-mehrere-server-verteilen.html</guid>
			<description>Statt als Load Balancer die Anfragen an mehre Webserver durchzureichen, wollen wir ein Setup...</description>
			<content:encoded><![CDATA[Für Webseiten, die eine hohe Cache-Hitrate haben, also die meisten Anfragen direkt vom Caching-Proxy beantwortet werden, hat ein solches Setup mehrere Vorteile:<br /><br />
<ol><li>Die verfügbare Bandbreite erhöht sich linear mit der Anzahl der Caching-Server</li><li>Da der Varnish-Cache sehr geringe Hardwareanforderungen hat, können die Satellitensysteme auf kleine und preiswerte virtuelle Maschinen aufbauen</li><li>Die Satellitensysteme können regional verteilt werden, damit zum Beispiel eine englischsprachige Seite von einem Server in den USA ausgeliefert wird, um kurze Latenzen zu bekommen</li><li>Die Pflege der Inhalte findet auf einem einzelnen Server statt und ist damit besonders einfach</li><li>Für Seitennetzwerke kann es bei der Suchmaschinenoptimierung nützlich sein, viele IP-Adressen an unterschiedlichen Standorten und in unterschiedlichen Netzen zu besitzen</li></ol>
<br /><br />Auf dem zentralen Server kann eine Normale Webanwendung laufen. Es bieten sich CMS-Systeme an, die in einer Installation mehrere Webseiten verwalten können, zum Beispiel <link 159 - internal-link "Öffnet internen Link im aktuellen Fenster">TYPO3</link>, oder ein <link http://foobar.lamp-solutions.de/howtos/wordpress/plugins/plugins-einzelansicht/archive/2011/may/artikel/mehrere-blogs-mit-einer-wordpress-installation-betreiben.html>Multiblog mit Wordpress</link>.<br /><br /><br />Auf den Satellitensystemen wird nur ein Varnish-Cache benötigt. Eventuell kann es noch nützlich sein, darauf eine Statistiksoftware wie AWStats zu installieren, um die <link http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/zugriffsstatistiken-auf-varnish-fuer-einzelne-vhosts-mit-awstats-anlegen.html>Logfiles des Varnish-Caches</link> auszuwerten.<br /><br /><br />Die Konfiguration des Varnish auf den Satellitensystemen kann größtenteils der Standard-Installation entsprechen. Wichtig ist, dass bei einem Ausfall, oder bei Wartungsarbeiten auf dem zentralen System nicht auf allen Satelliten Fehlermeldungen ausgeliefert werden. Dazu verändern wir die Verweildauer der Datensätze im Cache für den Fall, dass der Webserver mal nicht erreichbar ist.<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend default <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> .host = <span style="color: #ff0000;">&quot;&lt;IP-des-Webservers&gt;&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> .port = <span style="color: #ff0000;">&quot;80&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .probe = <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        .url = <span style="color: #ff0000;">&quot;/index.html&quot;</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        .interval = 5s; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        .timeout = 10s; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        .window = <span style="color: #000000;">5</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        .threshold = <span style="color: #000000;">3</span>; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub vcl_recv <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">set</span> req.backend = default; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #666666; font-style: italic;">#Falls das Backen nicht erreichbar, liefern wir fuer eine Stunde alten Inhalt aus </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.backend.healthy<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">else</span><span style="color: #7a0874; font-weight: bold;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #000000; font-weight: bold;">set</span> req.grace = 1h; </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">...</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li></ol></pre></div></div><br /><br />Selbst über eine kleine virtuelle Maschine für 10 Euro/Monat, die über einen CPU-Kern und 512 MB RAM verfügt, konnten wir mehrere tausend Anfragen pro Minute an einen WordPress-Blog schieben, ohne dass die Last auf dem Satellitensystem oder dem zentralen Webserver nennenswert gestiegen wäre.]]></content:encoded>
			<category>Verschiedenes</category>
			
			
			<pubDate>Thu, 20 Oct 2011 12:22:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>Mit PHP XML-Antworten aus SOAP-Requests effektiv Cachen </title>
			<link>http://foobar.lamp-solutions.de/howtos/programmierung/php/einzelansicht-php/artikel/mit-php-xml-antworten-aus-soap-requests-effektiv-cachen.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/programmierung/php/einzelansicht-php/artikel/mit-php-xml-antworten-aus-soap-requests-effektiv-cachen.html</guid>
			<description>Ein intelligentes Caching kann die Geschwindigkeit einer Webseite um mehrere Größenordnungen ...</description>
			<content:encoded><![CDATA[Mit PHP XML-Antworten aus SOAP-Requests effektiv Cachen<br /><br />
<h2>1) statisches Dateicaching für XML-Requests</h2>
<br />Webservices auf Basis von SOAP die Informationen über XML-Dokumente übertragen sind eine häufig verwendete Schnittstelle für Webanwednungen.<br /><br />Für den Fall, dass viele, sehr individuelle Daten zwischen zwei Webseiten übertragen werden, kann die Schnittstelle zum Flaschenhals für die Performance werden.<br /><br />Besonders negativ wirkt sich ein solcher Flachenhals aus, wenn die Daten aus den XML Anfragen direkt für die Ausgabe der Seite an Besucher durchgereicht werden. Damit kann sich der Seitenaufbau massiv verzögern.<br /><br />
<h2>2) Der PHP-Code</h2>
<h3>a) wichtige Konstanten definieren</h3>
<div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//Daten eine Stunde cachen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$cachetime</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">3600</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//Verzeichnis festlegen und evtl. anlegen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$cache_dir</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;xml_cache&quot;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/opendir"><span style="color: #990000;">openDir</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <a href="http://www.php.net/mkdir"><span style="color: #990000;">mkdir</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div><br /><br />Natürlich benötigt die PHP-Anwendung Schreibrechte auf den Ordner in dem wir unsere Daten ablegen wollen.<br /><br />
<h3>b) Hash für Anfrageoptionen bilden.</h3>
Wichtig ist, dass wir Anfragen mit individuellen Parametern individuelle Cache-Dateien bilden. In der Regel werden die Optionen die ein SOAP-Client an einen Server übergibt in Form eines Arrays definiert.<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$options</span><span style="color: #339933;">=</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a>  <span style="color: #009900;">&#40;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">&quot;Art&quot;</span>            <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">&quot;Id&quot;</span>             <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">,</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">&quot;Anzahl&quot;</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">&quot;Preis&quot;</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3000</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li></ol></pre></div></div><br />Wenn wir in unserem Beispiel alle Optionen ganze Zahlen sind, bietet es sich an einen Hashwert für unsere Anfrage direkt aus den Zahlen zu bilden.<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$option</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #000088;">$hash</span><span style="color: #339933;">.=</span><a href="http://www.php.net/intval"><span style="color: #990000;">intval</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$option</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div><br />Falls auch Zeichenketten als Optionen übergeben werden, bietet es sich an den Hashwert zusätzlich mit sha1 zu codieren<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$option</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #000088;">$hash</span><span style="color: #339933;">.=</span><span style="color: #000088;">$option</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$hash</span><span style="color: #339933;">=</span><a href="http://www.php.net/sha1"><span style="color: #990000;">sha1</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hash</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li></ol></pre></div></div><br /><br />anschließend geben wir unserer Cache-Datei einen Namen:<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$file</span><span style="color: #339933;">=</span><span style="color: #000088;">$cache_dir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$hash</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.xml&quot;</span><span style="color: #339933;">;</span></div></li></ol></pre></div></div>
<h3>c)Prüfen ob die Daten aus dem Cache, oder Soap abgefragt werden sollen</h3>
Es gibt drei Fälle in denen wir die Informationen über SOAP neu einlesen müssen
<ol><li>Falls noch kein Cache existiert</li><li>Falls die Cache-Zeit abgelaufen ist</li><li>Falls wir unserem System (zum Beispiel zur Fehlersuche) einen entsprechenden get-Parameter mitgeben</li></ol>
<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//prüfen ob cache-Datei existiert </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/file_exists"><span style="color: #990000;">file_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #000088;">$filetime</span><span style="color: #339933;">=</span><a href="http://www.php.net/filemtime"><span style="color: #990000;">filemtime</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #000088;">$toggle</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//Regeln um vorhandenen Cache neu anzulegen </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/time"><span style="color: #990000;">time</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #000088;">$filetime</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$cachetime</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666; font-style: italic;">//Datei älter als einen Tag </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #000088;">$toggle</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;no_soap_cache&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666; font-style: italic;">//no_cache aktiviert </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #000088;">$toggle</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div>
<h3>d) Daten auswerten</h3>
Sobald wir bestimmt haben, ob wir die Daten aus dem Cache oder über SOAP abrufen, können wir uns ans Auswerten der Informationen machen.<br /><br />Auf die Details der eventuell durchgeführten SOAP abfrage wollen wir hierbei an dieser Stelle nicht eingehen:
<div class="indent"><div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$toggle</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #000088;">$xml</span><span style="color: #339933;">=</span><a href="http://www.php.net/simplexml_load_file"><span style="color: #990000;">simplexml_load_file</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666; font-style: italic;">//Erzeuge Soap-Client </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #000088;">$client</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SoapClient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;WSDL-Dokuement&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  try<span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000088;">$soap</span><span style="color: #339933;">=</span><span style="color: #000088;">$client</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$gateway</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  catch <span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #000088;">$xml</span><span style="color: #339933;">=</span><a href="http://www.php.net/simplexml_load_string"><span style="color: #990000;">simplexml_load_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$soap</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">any</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666; font-style: italic;">//Cache schreiben </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/file_exists"><span style="color: #990000;">file_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.php.net/unlink"><span style="color: #990000;">unlink</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #000088;">$fileh</span><span style="color: #339933;">=</span><a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   <a href="http://www.php.net/fwrite"><span style="color: #990000;">fwrite</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileh</span><span style="color: #339933;">,</span><a href="http://www.php.net/utf8_encode"><span style="color: #990000;">utf8_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">asXML</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   <a href="http://www.php.net/fclose"><span style="color: #990000;">fclose</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileh</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li></ol></pre></div></div><br />Selbst komplexe Anfragen dauern damit nur noch wenige Millisekunden. Alleine die eingesparten Latenzzeiten können, wenn mehrere Abfragen hintereinander durchgeführt werden, den Unterschied für ein positives oder negatives Surferlebnis der Besucher ausmachen.<br /><br /></div>]]></content:encoded>
			<category>PHP</category>
			
			
			<pubDate>Fri, 09 Sep 2011 15:51:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>Firefox Sync Server</title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/firefox-sync-server.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/firefox-sync-server.html</guid>
			<description>Firefox Sync Server unter Ubuntu installieren</description>
			<content:encoded><![CDATA[<br />In diesem Artikel geht es um die Installation des Synchronisierungsserver Firefox Sync mit Hilfe des HTTP Servers Apache2.<br />Firefox Sync ermöglicht einem Firefox Browser Benutzer unter verschiedenen Geräten die gleichen Lesezeichen, den Browserverlauf sowie die gespeicherten Loginnamen und vieles mehr zu nutzen.<br /><br />Zwar bietet Firefox Sync als Dienst an, wer aber lieber seine Daten nicht in fremde Hände geben will, kann auch die Serversoftware auf seinen eigenen Server installieren.<br /><br /><span style="font-weight: bold; ">1) Installation unter Ubuntu</span><br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> python-dev mercurial sqlite3 python-virtualenv libapache2-mod-wsgi</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">mv</span> server-full weave</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">cd</span> weave</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">make</span> build</div></li></ol></pre></div></div>
Das Kommando <span style="font-weight: bold; ">make build</span> wird einige Zeit dauern, da Weave seine eigene Python Umgebung erstellt.<br /><br /><br /><span style="font-weight: bold; ">2) Konfiguration</span><br /><br />Zwar bringt Firefox Sync seinen eigenen HTTP Server mit, dieser ist aber nicht für eine hohe Last konzipiert und somit nur zum Testen gedacht.<br />Aus diesem Grund benutzen wir den Apache2 als Server, welcher mit dem Packet libapache2-mod-wsgi erlernt Python Code auszuführen.<br /><br /><span style="font-weight: bold; ">2.1) Konfiguration Firefox Sync</span>
<br />In diesem Artikel nutzen wir die Datenbankengine SQLITE.<br /><br />Als erstes erstellen wir ein Verzeichniss für die Datenbank.<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span></div></li></ol></pre></div></div><br /><br />Und geben diesem Verzeichniss Rechte damit www-data schreiben kann.<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> www-data:www-data <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">770</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>data</div></li></ol></pre></div></div><br /><br />Zusätzlich geben wir www-data Rechte für das folgende Verzeichniss<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chown</span> www-data:www-data <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>deps<span style="color: #000000; font-weight: bold;">/</span>server-reg<span style="color: #000000; font-weight: bold;">/</span>syncreg<span style="color: #000000; font-weight: bold;">/</span>templates</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">770</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>deps<span style="color: #000000; font-weight: bold;">/</span>server-reg<span style="color: #000000; font-weight: bold;">/</span>syncreg<span style="color: #000000; font-weight: bold;">/</span>templates</div></li></ol></pre></div></div><br /><br /><br /><br />Wir öffnen die Datei /opt/weave/etc/sync.conf und ändern Folgende Dinge ab:<br /><br />Unter dem Punkt<span style="font-weight: bold; "> [storage]</span> und<span style="font-weight: bold; "> [auth]</span>:<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sqluri = sqlite:<span style="color: #000000; font-weight: bold;">////</span>tmp<span style="color: #000000; font-weight: bold;">/</span>test.db</div></li></ol></pre></div></div><br />zu<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sqluri = sqlite:<span style="color: #000000; font-weight: bold;">////</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>ffsync.db</div></li></ol></pre></div></div><br /><br />Außerdem muss noch die Fallbacknode unter [auth] gesetzt werden:<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">fallback_node = htlp:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">5000</span><span style="color: #000000; font-weight: bold;">/</span></div></li></ol></pre></div></div><br />zu<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">fallback_node = htlp:<span style="color: #000000; font-weight: bold;">//</span>weave.meinserver.lan</div></li></ol></pre></div></div><br /><br />Falls ein SMTP Server zur Verfügung steht konfigurieren wir diesen auch.<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>smtp<span style="color: #7a0874; font-weight: bold;">&#93;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">host = localhost</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">port = <span style="color: #000000;">25</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sender = admin<span style="color: #000000; font-weight: bold;">@</span>weave.meinserver.lan</div></li></ol></pre></div></div><br /><span style="font-weight: bold; ">2.2) Konfiguration Apache2</span><br /><br />Um den Apache2 zu konfigurieren, müssen wir einen neuen VHost erstellen.<br />Wie ein VHost aussehen kann zeigt folgendes Beispiel:<br /><br /><br />Datei: <br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>sites-available<span style="color: #000000; font-weight: bold;">/</span>weave.meinserver.lan</div></li></ol></pre></div></div><br /><br />Inhalt:<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;</span>VirtualHost <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  ServerName weave.meinserver.lan</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  DocumentRoot <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  WSGIProcessGroup <span style="color: #c20cb9; font-weight: bold;">sync</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  WSGIDaemonProcess <span style="color: #c20cb9; font-weight: bold;">sync</span> <span style="color: #007800;">user</span>=www-data <span style="color: #007800;">group</span>=www-data <span style="color: #007800;">processes</span>=<span style="color: #000000;">2</span> <span style="color: #007800;">threads</span>=<span style="color: #000000;">25</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  WSGIPassAuthorization On</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  WSGIScriptAlias <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">/</span>sync.wsgi</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  CustomLog <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>weave.meinserver.lan-access.log combined</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  ErrorLog  <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>weave.meinserver.lan-error.log</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;/</span>VirtualHost<span style="color: #000000; font-weight: bold;">&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;</span>Directory <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>weave<span style="color: #000000; font-weight: bold;">&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  Order deny,allow</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  Allow from all</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;/</span>Directory<span style="color: #000000; font-weight: bold;">&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li></ol></pre></div></div><br /><br /><span style="font-weight: bold; ">3) In Betrieb nehmen</span><br /><br />Sobald wir den Apache neu starten, sollte nun der FireFox Sync Server unter weave.meinserver.lan erreichbar sein.<br /><br /><span style="font-weight: bold; ">4) Fehlersuche</span><br /><br />Falls es Probleme gibt, sollte man in den Dateien /var/log/apache2/weave.meinserver.lan-error.log sowie /var/log/apache2/weave.meinserver.lan-access.log<br />genügend Auskunft erhalten um den Fehler zu beheben.<br /><br /><br /><span style="font-weight: bold; ">5.) Fazit</span><br /><br />Firefox Sync eignet sich besonders für Menschen die mehrere PCs besitzen, aber auch für Smartphonebesitzer die Mozillas mobile Browser Fennec einsetzen, denn dieser Browser unterstüzt auch Firefox Sync. (aw)<br /><br /><br /><br /><br />]]></content:encoded>
			<category>Verschiedenes</category>
			
			
			<pubDate>Wed, 17 Aug 2011 13:49:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>Mobile Weichen mit Varnish und GeoIP</title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/mobile-weichen-mit-varnish-und-geoip.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/verschiedenes/verschiedenes-einzelansicht/artikel/mobile-weichen-mit-varnish-und-geoip.html</guid>
			<description>Mobile Weichen mittels Varnish, GeoIP und HTTP Headers umleiten</description>
			<content:encoded><![CDATA[In diesem Artikel geht es um eine Mobile Weiche, welche mit dem <link http://de.wikipedia.org/wiki/Varnish _blank external-link-new-window "Öffnet externen Link in neuem Fenster">HTTP Beschleuniger Varnish</link> realisiert wird.<br /><br />Varnish entscheidet anhand des User Agents im Webbrowser und des Herkunftslands der IP, auf welche Seite der Besucher weitergeleitet wird. Um das Herkunftsland zu ermitteln verwenden wir GeoIP.<br /><br />Ein gewisses Grundwissen mit Varnish wird hierbei vorausgesetzt. Falls dies nicht der Fall ist, empfehle ich, folgende Seite zu besuchen: <link https://www.varnish-cache.org/docs/3.0/>https://www.varnish-cache.org/docs/3.0/</link>
<h2>1) Installation</h2>
Die Installation ist schnell erledigt, da fast alles bereits in den Paketquellen von Ubuntu enthalten ist.<br /><br />Varnish und GeoIP installieren
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">apt<span style="color: #000000;">-</span><span style="color: #25BB4D;">get</span> install varnish geoip<span style="color: #000000;">-</span><span style="color: #668080;">bin</span> libnet<span style="color: #000000;">-</span>ip<span style="color: #000000;">-</span>perl libgeo<span style="color: #000000;">-</span>ipfree<span style="color: #000000;">-</span>perl \</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">libgeo<span style="color: #000000;">-</span>ip<span style="color: #000000;">-</span>perl libgeoip<span style="color: #000000;">-</span>dev</div></li></ol></pre></div></div>
Quellcode von GeoIP Plugin herunterladen
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">wget https<span style="color: #000000;">://</span>www<span style="color: #000000;">.</span>varnish<span style="color: #000000;">-</span>cache<span style="color: #000000;">.</span>org<span style="color: #000000;">/</span>trac<span style="color: #000000;">/</span>raw<span style="color: #000000;">-</span>attachment<span style="color: #000000;">/</span>wiki<span style="color: #000000;">/</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">\GeoipUsingInlineC<span style="color: #000000;">/</span>GeoIP<span style="color: #000000;">-</span>plugin<span style="color: #000000;">-</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">.</span>tar<span style="color: #000000;">.</span>gz</div></li></ol></pre></div></div>
Entpacken
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">tar xf GeoIP<span style="color: #000000;">-</span>plugin<span style="color: #000000;">-</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">.</span>tar<span style="color: #000000;">.</span>gz</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #668080;">cd</span> GeoIP<span style="color: #000000;">-</span><span style="color: #25BB4D;">plugin</span><span style="color: #000000;">/</span>lib<span style="color: #000000;">/</span></div></li></ol></pre></div></div>Kompilieren&nbsp;&nbsp;&nbsp; <div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">make</div></li></ol></pre></div></div>
Falls das Plugin funktioniert sollte folgende Ausgabe von 
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">make test</div></li></ol></pre></div></div>
entstehen:
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">GeoIP <span style="color: #25BB4D;">plugin</span> loaded successfully<span style="color: #000000;">.</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Testing IPs<span style="color: #000000;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">195<span style="color: #000000;">.</span>110<span style="color: #000000;">.</span>128<span style="color: #000000;">.</span>11 =<span style="color: #000000;">&gt;</span> IT <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">157<span style="color: #000000;">.</span>166<span style="color: #000000;">.</span>224<span style="color: #000000;">.</span>25 =<span style="color: #000000;">&gt;</span> US <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">212<span style="color: #000000;">.</span>58<span style="color: #000000;">.</span>224<span style="color: #000000;">.</span>138 =<span style="color: #000000;">&gt;</span> GB <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">80<span style="color: #000000;">.</span>91<span style="color: #000000;">.</span>37<span style="color: #000000;">.</span>210 =<span style="color: #000000;">&gt;</span> NO <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">192<span style="color: #000000;">.</span>168<span style="color: #000000;">.</span>0<span style="color: #000000;">.</span>1 =<span style="color: #000000;">&gt;</span> Unknown <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#40;</span>null<span style="color: #000000;">&#41;</span> =<span style="color: #000000;">&gt;</span> Unknown <span style="color: #000000;">&#40;</span>OK<span style="color: #000000;">&#41;</span></div></li></ol></pre></div></div>
Das kompilierte Plugin in das Verzeichniss von Varnish kopieren
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #668080;">cp</span> geoip_plugin<span style="color: #000000;">.</span><span style="color: #668080;">so</span> <span style="color: #000000;">/</span>etc<span style="color: #000000;">/</span>varnish<span style="color: #000000;">/</span></div></li></ol></pre></div></div>
Ab nun sollten alle Voraussetzungen erfüllt sein und wir können uns der Konfiguration zuwenden.
<h2>2) Konfiguration</h2>
Varnish (siehe Bild, Station 1) überprüft, ob der HTTP User Agent einem mobilen Endgerät zugeordnet werden kann oder nicht. Dies geschieht in der Varnish-Konfiguration mit der Funktion detect_device.<br /><br />Falls es ein mobiler User ist, senden wir ihn zur Länderweiche (siehe Bild, Station 2), andernfalls senden wir ihn an das default Backend (siehe Bild, Station 3). Das GeoIP-Plugin setzt den HTTP Header X-Country-Code anhand der IP-Adresse mit dem jeweiligen Ländercode.<br /><br />Die Länderweiche (siehe Bild, Station 2) entscheidet mit Hilfe des HTTP Headers X-Country-Code welches Backend verwendet werden soll: Falls der Ländercode DE, AT oder CH ist, wird das deutsche Backend (Station 4) verwendet, andernfalls ist das mobile Backend&nbsp;nicht deutsch (Station 5).
<div id="tx_codehighlight_pi1"><div class="code"><pre class="c" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Mobile weiche mithilfe von Varnish und GeoIP</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Lade das Plugin /etc/varnish/geoip_plugin.so</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">C<span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;">#include &lt;dlfcn.h&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;">#include &lt;stdlib.h&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;">#include &lt;stdio.h&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #993333;">static</span> <span style="color: #993333;">const</span> <span style="color: #993333;">char</span><span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>get_country_code<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span><span style="color: #339933;">*</span> ip<span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    __attribute__<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>constructor<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #993333;">void</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    load_module<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #993333;">const</span> <span style="color: #993333;">char</span><span style="color: #339933;">*</span> symbol_name <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;get_country_code&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #808080; font-style: italic;">/* Lade unser kompiliertes Plugin*/</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #993333;">const</span> <span style="color: #993333;">char</span><span style="color: #339933;">*</span> plugin_name <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;/etc/varnish/geoip_plugin.so&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #993333;">void</span><span style="color: #339933;">*</span> handle <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span> <span style="color: #808080; font-style: italic;">/* Erstelle Dateihandle */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    handle <span style="color: #339933;">=</span> dlopen<span style="color: #009900;">&#40;</span> plugin_name<span style="color: #339933;">,</span> RTLD_NOW <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>handle <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #808080; font-style: italic;">/* Falls die Datei existiert */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        get_country_code <span style="color: #339933;">=</span> dlsym<span style="color: #009900;">&#40;</span> handle<span style="color: #339933;">,</span> symbol_name <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>get_country_code <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #808080; font-style: italic;">/*  Plugin funktioniert nicht*/</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        fprintf<span style="color: #009900;">&#40;</span> stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Error: Could not load GeoIP plugin:<span style="color: #000099; font-weight: bold;">\n</span>%s<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> dlerror<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">else</span> <span style="color: #808080; font-style: italic;">/*  Plugin funktioniert */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;GeoIP plugin loaded successfully.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">else</span> <span style="color: #808080; font-style: italic;">/* Falls die Datei nicht existiert */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        fprintf<span style="color: #009900;">&#40;</span> stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Error: Could not load GeoIP plugin:<span style="color: #000099; font-weight: bold;">\n</span>%s<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> dlerror<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span>C</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># PC Clients allgemein</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend <span style="color: #b1b100;">default</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">host</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">port</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;80&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Mobile Clients die keine Deutsche Sprache sprechen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend mobile_lang_en <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">host</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">port</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;81&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Mobile Clients, welche Deutsch sprechen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend mobile_lang_de <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">host</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    .<span style="color: #202020;">port</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;82&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub vcl_recv <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># GeoIP Herkunftsland ermitteln und HTTP Header X-Country-Code setzen. </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    C<span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    VRT_SetHdr<span style="color: #009900;">&#40;</span>sp<span style="color: #339933;">,</span> HDR_REQ<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;<span style="color: #006699; font-weight: bold;">\017</span>X-Country-Code:&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>get_country_code<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span> VRT_IP_string</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#40;</span>sp<span style="color: #339933;">,</span> VRT_r_client_ip<span style="color: #009900;">&#40;</span>sp<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> vrt_magic_string_end<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span>C</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;">#No-Cache nur verarbeiten wenn die Seite nicht über einen Proxy und nicht</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;">#vom MSN-Bot aufgerufen wird</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">Cache</span><span style="color: #339933;">-</span>Control ~ <span style="color: #ff0000;">&quot;no-cache&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">Via</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;bot|MSIE&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            purge_url<span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Herausfinden ob mobile oder pc User</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    call detect_device<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Das Backend anhand von HTTP Header X-Device sowie X-Country-Code bestimmen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    call routing<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Entscheidung welches Backend verwendet werden muss.</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub routing <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Falls ein nicht Mobile User verbindet, verwende default backend.</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;pc&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span>pass<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;mobile&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Falls Herkunftsland DE, CH oder AT, schicke Traffic auf Mobile Deutsche Weiche</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Country<span style="color: #339933;">-</span>Code <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;DE&quot;</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Country<span style="color: #339933;">-</span>Code <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;AT&quot;</span> <span style="color: #339933;">||</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Country<span style="color: #339933;">-</span>Code <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;CH&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">backend</span> <span style="color: #339933;">=</span> mobile_lang_de<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Fall nicht Herkunftsland DE oder AT, schicke Traffic auf Mobile Englische Weiche</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            set req.<span style="color: #202020;">backend</span> <span style="color: #339933;">=</span> mobile_lang_en<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Setze Header X-Device je nach Browseragent</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"># Der Browseragent verrät uns ob es sich um ein Mobile User handelt.</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub detect_device <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Gehe davon ersteinmal aus, dass es ein normaler PC User ist</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;pc&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># LG Handys enthalten LG- im Agentenstring</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;LG-&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;mobile&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Dies hier sind die populärsten Agentenstrings</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;iPhone&quot;</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;Android&quot;</span> <span style="color: #339933;">||</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;Symbian&quot;</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^BlackBerry&quot;</span> <span style="color: #339933;">||</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^SonyEricsson&quot;</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^Nokia&quot;</span> <span style="color: #339933;">||</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^SAMSUNG&quot;</span> <span style="color: #339933;">||</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^LG&quot;</span> <span style="color: #339933;">||</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;   webOS&quot;</span> <span style="color: #339933;">||</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;Windows Phone&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;mobile&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Palm Telefon Useragent string</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;^PalmSource&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;mobile&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Andere bekannte Handy Browseragenten</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> req.<span style="color: #202020;">http</span>.<span style="color: #202020;">user</span><span style="color: #339933;">-</span>agent ~</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">&quot;(.*Blackberry.*|.*BlackBerry.*|.*Blazer.*|.*Ericsson.*|.*htc.*|.*Huawei.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*iPhone.*|.*iPod.*|.*MobilePhone.*|.*Motorola.*|.*nokia.*|.*Novarra.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*O2.*|.*Palm.*|.*Samsung.*|.*Sanyo.*|.*Smartphone.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*SonyEricsson.*|.*Symbian.*|.*Toshiba.*|.*Treo.*|.*vodafone.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*Xda.*|^Alcatel.*|^Amoi.*|^ASUS.*|^Audiovox.*|^AU-MIC.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^BenQ.*|^Bird.*|^CDM.*|^DoCoMo.*|^dopod.*|^Fly.*|^Haier.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^HP.*iPAQ.*|^i-mobile.*|^KDDI.*|^KONKA.*|^KWC.*|^Lenovo.*|^LG.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^NEWGEN.*|^Panasonic.*|^PANTECH.*|^PG.*|^Philips.*|^portalmmm.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^PPC.*|^PT.*|^Qtek.*|^Sagem.*|^SCH.*|^SEC.*|^Sendo.*|^SGH.*|^Sharp.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^SIE.*|^SoftBank.*|^SPH.*|^UTS.*|^Vertu.*|.*Opera.Mobi.*|.*Windows.CE.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|^ZTE.*|.*LG.*|.*SAMSUNG.*|.*webOS|^Nokia*)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;mobile&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #339933;"># Falls es sich um Tablets handelt, verwende das normale Backend</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req.<span style="color: #202020;">http</span>.<span style="color: #202020;">User</span><span style="color: #339933;">-</span>Agent ~ <span style="color: #ff0000;">&quot;(.*GT-P1000M.*|.*Xoom.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*GT-P7100 Build/HRI83.*|.*A500 Build/HRI66.*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">|.*iPad.*|.*iPod.*)&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        set req.<span style="color: #202020;">http</span>.<span style="color: #202020;">X</span><span style="color: #339933;">-</span>Device <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;pc&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div>
Die Konfigurationsdatei kann <link fileadmin/user_upload/news/administration/varnish-mobileweiche.vcl - download "Leitet Herunterladen der Datei ein">hier</link> heruntergeladen werden.
<h2>3) Fazit</h2>
Varnish ist ein solider HTTP-Beschleuniger, welcher zu deutlich mehr imstande ist, als man denkt.<br /><br />Dank der Plugin-Funktionalität der eigenen Skriptsprache VCL, sowie C-Code Unterstützung innerhalb einer Konfigurationsdatei, ist es möglich, eine zuverlässige mobile Weiche in kurzer Zeit zu erstellen. 
In eigener Sache:<br />Funktionen mit Hilfe von C in den Varnish einzubauen ist nicht immer ganz trivial. Um Ziele für Mobiluser auf einzelnen Domains leichter verwalten zu können haben wir uns ein Webinterface geschrieben, dass viele Weiterleitungsmöglichkeiten abbildet. Auf unserer Hosting-Seite finden sich zum Beispiel fertige <link http://www.lamp-hosting.de/enterprise/webserver.html>Webserver mit Varnish</link> und Mobiluser Targeting
(aw)]]></content:encoded>
			<category>Verschiedenes</category>
			
			
			<pubDate>Mon, 08 Aug 2011 14:49:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>TYPO3-Geschwindigkeit optimieren Teil 4 </title>
			<link>http://foobar.lamp-solutions.de/howtos/typo3/tuning/tuning-einzelansicht/artikel/typo3-geschwindigkeit-optimieren-teil-4.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/typo3/tuning/tuning-einzelansicht/artikel/typo3-geschwindigkeit-optimieren-teil-4.html</guid>
			<description>Performance-Tuning durch optimale Einstellungen in der localconf.php und im Typorscript-Code</description>
			<content:encoded><![CDATA[Lange haben wir gezögert den vierten und vorerst letzten Teil unserer Serie über die Geschwindigkeit von TYPO3 und mögliche Maßnahmen zum Tuning der Performance fertig zu stellen.<br /><br />Der Grund dafür ist, dass wir in den Einstellungen von TYPO3 oder auch auch im Typoscript-Code vergleichsweise wenige Möglichkeiten gefunden haben durch klug gewählte Einstellungen die Geschwindigkeit zu erhöhen. Alleine das ist aber auch schon eine wichtige Erkenntnis.<br /><br />Drei Hebel haben wir am Ende doch gefunden, mit denen sich in den Einstellungen die TYPO3-Geschwindigkeiut positiv beeinflussen ließ:<br /><br />
<h2>1) Datenbank schlank halten.</h2>
<br />Mit folgenden Einstellungen in der localconf.php lässt sich TYPO3 im Alltag weniger gesprächig einstellen:
<div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$TYPO3_CONF_VARS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SYS'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'enableDeprecationLog'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$TYPO3_CONF_VARS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SYS'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'syslogErrorReporting'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$TYPO3_CONF_VARS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SYS'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'belogErrorReporting'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$TYPO3_CONF_VARS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'BE'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'versionNumberInFilename'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">;</span></div></li></ol></pre></div></div><br /><br />Nachdem die Einstellungen aktiviert sind, ändert sich an der Geschwindigkeit und am Ressourcenverbrauch wenig. Der Unterschied zeigt sich wenn wir eine Seite vergleichen in der die Logfiles und die Datenbank stark angestiegen sind. Auf größeren Webseiten kann das Syslog der Datenbank auf mehrere GB anwachsen. Räumen wir in einer solchen Installation die Daten auf, beschleunigt sich der Seitenaufbau. (Bild1 + Bild2)<br /><br />Die Einstellungen oben verhindern, dass überhaupt so viel Datenmüll in einem LIVE-System entsteht.<br /><br />
<h2>2. Graphicsmagick statt Imagemagick verwenden</h2>
<br />Graficsmagick ist ein weiterentwickelter Fork von Imagemagick. Um die beiden Programme zur Bildbearbeitung zu vergleichen, haben wir eine Seite mit sehr vielen Bildern genommen, und alle skalierten Bilder aus TYPO3temp gelöscht. <br />Anschließend haben wir ein kleines Script gestartet, dass alle Unterseiten einmal aufruft. Auf den 607-Seiten wurden dabei ca. 1000 Bilder generiert.<br /><br />Die Ausgabe unseres Scripts zeigte, dass Graficsmagick in unserem, etwas überspitztem, Szenario den Seitenaufbau um ca. 20% beschleunigt.
<span style="font-style: italic;">Beginn: Mi 13. Jul 16:31:40 CEST 2011 </span><br /><span style="font-style: italic;">Ende: Mi 13. Jul 16:37:10 CEST 2011 </span><br /><span style="font-style: italic;">Geholt: 607 Dateien</span><br /><span style="font-style: italic;">Laufzeit:&nbsp; 330.440699080 Sekunden</span><br /><br /><span style="font-style: italic;">Beginn: Mi 13. Jul 16:38:50 CEST 2011 </span><br /><span style="font-style: italic;">Ende: Mi 13. Jul 16:43:18 CEST 2011 </span><br /><span style="font-style: italic;">Geholt: 607 Dateien</span><br /><span style="font-style: italic;">Laufzeit:&nbsp; 268.020708521 Sekunden</span><br /><br />Die Verbesserungen sind natürlich nur dann ausschlaggebend, wenn neue Bilder generiert werden müssen. Im Alltag dürfte die Bildgenerierung in den wenigsten Fällen die Performance so stark beeinflussen.<br /><br />
<h3>3) USER-INT nur wenn nötig einsetzen</h3>
<br />In unserem Artikel zur Affiliate-Erweiterung <br />http://foobar.lamp-solutions.de/howtos/typo3/extensions/extensions-einzelansicht/artikel/affiliate-erweiterung-fuer-typo3.html<br />hatten wir eine Möglichkeit vorgestellt, Objekte abhängig von Parametern in der URL als USER_INT, oder USER zu deklarieren. Damit ist es möglich, Seiten zu cachen, auf denen nur unter bestimmten Bedingungen benutzerspezifische Inhalte erscheinen.<br /><br />Am Beispiel der Powermail-Erweiterung wollen wir das hier noch mal genauer erklären.<br /><br />Im ts-Setup definieren wir zuerst powermail als USER_INT. Das ist die normale Einstellung. Seiten die ein solches Formular enthalten, können damit nicht mehr effektiv gecached werden.<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">plugin<span style="color: #339933;">.</span>tx_powermail_pi1 <span style="color: #339933;">=</span> USER_INT</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">&#91;</span>globalVar <span style="color: #339933;">=</span> tx_powermail_pi1<span style="color: #009900;">&#91;</span>mailID<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span><span style="color: #009900;">&#93;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  plugin<span style="color: #339933;">.</span>tx_powermail_pi1 <span style="color: #339933;">=</span> USER</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#91;</span><span style="color: #000000; font-weight: bold;">global</span><span style="color: #009900;">&#93;</span></div></li></ol></pre></div></div><br />In vielen Fällen ist das aber völlig unnötig. Wenn wir darauf verzichten die Formulare mit Daten aus der Session zu vorauszufüllen, sieht jeder Besucher das gleiche Formular. Die Inhalte können also problemlos gecached werden.<br />Erst wenn ein Besucher das Formular abschickt und noch einmal seine Daten bestätigen soll, muss die Seite benutzerspezifisch aufgebaut werden. Das erreichen wir, indem wir abfragen, ob in der URL eine mailID übergeben wurde.<br /><br />Der Geschwindigkeitsgewinn einer solchen Lösung kann enorm sein. Vor allem im Zusammenhang mit Caching-Lösungen wie varnish, oder statischem Filecaching, kann sich der Seitenaufbau um Größenordnungen unterscheiden, wenn wir unnötige USER_INT-Einstellungen unterdrücken.
<br />In eigener Sache:<br />Auf unserer Hosting-Seite bieten wir fertige hochoptimierte Server für <link http://www.lamp-hosting.de/server-hosting/typo3-hosting.html>TYPO3-Hosting</link>. Die Optimierungen werden dort individuell nach den Bedürfnissen unserer Kunden durchgeführt.]]></content:encoded>
			<category>Tuning</category>
			
			
			<pubDate>Thu, 14 Jul 2011 09:08:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>Child Themes in Wordpress</title>
			<link>http://foobar.lamp-solutions.de/howtos/wordpress/plugins/plugins-einzelansicht/artikel/child-themes-in-wordpress.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/wordpress/plugins/plugins-einzelansicht/artikel/child-themes-in-wordpress.html</guid>
			<description>Child Themes in Wordpress einrichten und individuelle Anpassungen, wie Sprachpakete, auch nach...</description>
			<content:encoded><![CDATA[Seit der Wordpress Version 3.0 ist es möglich sogenannte Child-Themes anzulegen.
Ein Child Theme bietet die Möglichkeit individuelle Anpassungen vorzunehmen ohne eine einzige Zeile Code im originalen Theme zu verändern, so bleiben Anpassungen auch nach einem Update des Haupt-Themes erhalten.
Die Einstellungen des Child-Themes werden vom Theme sozusagen vererbt.
<h2>Child Theme erstellen</h2>
Zunächst wird im Verzeichnis wp-content/themes ein Verzeichnis erstellt, zum Beispiel &quot;suffusion-child&quot;.
Anhand dieses Beispiels am Suffusion-Theme kann die styles.css so aussehen:
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">/</span>wp<span style="color: #000000;">-</span>content</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">/</span>themes</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000;">/</span>suffusion<span style="color: #000000;">-</span>child</div></li></ol></pre></div></div>
Darin enthalten muss eine styles.css enthalten sein. Die originale styles.css wird hier eingebunden.
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">/*</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000;">*</span> Theme Name<span style="color: #000000;">:</span> suffusion<span style="color: #000000;">-</span>child</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000;">*</span> Template<span style="color: #000000;">:</span> suffusion</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000;">*</span> Description<span style="color: #000000;">:</span> Suffusion Child Theme</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000;">*</span> Theme URI<span style="color: #000000;">:</span> your<span style="color: #000000;">-</span>url<span style="color: #000000;">.</span>tld</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000;">*</span> Version<span style="color: #000000;">:</span> 0<span style="color: #000000;">.</span>0<span style="color: #000000;">.</span>1</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000;">*</span> Author<span style="color: #000000;">:</span> Name</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000;">*</span> Author URI<span style="color: #000000;">:</span> your<span style="color: #000000;">-</span>url<span style="color: #000000;">.</span>tld<span style="color: #000000;">/</span>blog</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000;">*/</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">@</span>import url<span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">&quot;../suffusion/style.css&quot;</span><span style="color: #000000;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">/*</span>ausgewähler Skin<span style="color: #000000;">*/</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">@</span>import url<span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">&quot;../suffusion/skins/light-theme-orange/skin.css&quot;</span><span style="color: #000000;">&#41;</span>;</div></li></ol></pre></div></div>
Wichtig sind folgende Einträge:
Theme Name: Der Name des Child Themes<br />Template: Name des originalen Theme-Verzeichnisses
<h2>Sprachpakete einbinden</h2>
Das Problem bei vielen Themes unter anderem auch bei Suffusion ist, dass eingebundene Sprachpakete nach einem Update wieder eingefügt werden müssen.
Diese kann man aber dauerhaft in das Child Theme einbinden. Hierzu wird im Verzeichnis des Child-Themes ein Verzeichnis &quot;translation&quot; erstellt.
<div id="tx_codehighlight_pi1"><div class="code"><pre class="vim" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">/</span>wp<span style="color: #000000;">-</span>content</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000;">/</span>themes</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000;">/</span>suffusion<span style="color: #000000;">-</span>child</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #000000;">/</span>translation</div></li></ol></pre></div></div>
Darin enthalten müssen die entsprechenden Sprachpakete sein. zum Beispiel:
de_DE.mo<br />de_DE.po<br />suffusion.po
Nun muss aber Wordpress diese Sprachpakete auch erkennen. Normalerweise werden die Sprachpakete in der functions.php abgerufen.
Bei Suffusion muss also noch die Datei functions.php im Child-Theme-Verzeichnis erstellt werden:
<div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$suffusion_locale</span> <span style="color: #339933;">=</span> get_locale<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">load_textdomain<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'suffusion-child'</span><span style="color: #339933;">,</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">locate_template<span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;translation/<span style="color: #006699; font-weight: bold;">{$suffusion_locale}</span>.mo&quot;</span><span style="color: #339933;">,</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">{$suffusion_locale}</span>.mo&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">?&gt;</span></div></li></ol></pre></div></div>
<h2>Fazit</h2>
Wie man am Beispiel der Sprachpakete im beliebten Wordpress Theme Suffusion sehen kann, sind individuelle Anpassungen am Theme durchaus ohne großen Aufwand machbar. <br />Beispielsweise können auch angepasste Templates oder Stylesheets auf diesem Wege im Child-Theme eingefügt werden. (ch)]]></content:encoded>
			<category>Plugins</category>
			
			
			<pubDate>Fri, 08 Jul 2011 15:09:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>Varnish3 unter Ubuntu 10.4 für Wordpress und TYPO3-Seiten </title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/varnish3-unter-ubuntu-104-fuer-wordpress-und-typo3-seiten.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/varnish3-unter-ubuntu-104-fuer-wordpress-und-typo3-seiten.html</guid>
			<description>Mit dem Varnish Cache lässt sich die Performance von TYPO3-Seiten und WordPress-Blogs enorm...</description>
			<content:encoded><![CDATA[Seit dem 16.6.2011 gibt es die neue Version 3.0 des <link https://www.varnish-cache.org/ - external-link-new-window "Öffnet externen Link in neuem Fenster">Vanish-Caches.</link> Wir haben ja schon in einigen anderen Artikeln gezeigt wie sich Webseiten mit dem Varnish beschleunigen lassen. Beim Update auf den Varnish3 mussten wir einige Änderungen an unserer Konfiguration vornehmen.
Die Installation von Varnish3 ist dank vorhandener Pakete für Ubuntu sehr einfach
http://www.varnish-cache.org/installation/ubuntu
Hier erst einmal das komplette VCL für einen Cache für mehrere TYPO3-Webseiten und einen größeren WordPress-Blog.
<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend default <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .host = <span style="color: #ff0000;">&quot;xxx.xxx.xxx.xxx&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .port = <span style="color: #ff0000;">&quot;80&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> backend default2 <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .host = <span style="color: #ff0000;">&quot;xxx.xxx.xxx.xxx&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .port = <span style="color: #ff0000;">&quot;80&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">backend <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .host = <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     .port = <span style="color: #ff0000;">&quot;8080&quot;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub vcl_recv <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">##No-Cache nur verarbeiten wenn die Seite nicht über einen Proxy und nicht </span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">#vom MSN-Bot aufgerufen wird</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Cache-Control ~ <span style="color: #ff0000;">&quot;no-cache&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Via <span style="color: #000000; font-weight: bold;">||</span> req.http.User-Agent ~ <span style="color: #ff0000;">&quot;bot|MSIE&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            ban <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.url<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">##TYPO3-Backend nicht cachen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.cookie ~ <span style="color: #ff0000;">&quot;be_typo_user&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>pass<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.host ~ <span style="color: #ff0000;">&quot;domain.tld&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">else</span><span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #666666; font-style: italic;">##Cookies von TYPO3-Seiten löschen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">unset</span> req.http.Cookie;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.x-forwarded-for<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">set</span> req.http.X-Forwarded-For =</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            req.http.X-Forwarded-For + <span style="color: #ff0000;">&quot;, &quot;</span> + client.ip;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">set</span> req.http.X-Forwarded-For = client.ip;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">##Richtiges Backend wählen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.host ~ <span style="color: #ff0000;">&quot;domain.tld&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <span style="color: #000000; font-weight: bold;">set</span> req.backend = default2;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.host ~ <span style="color: #ff0000;">&quot;lb1.lamp-solutions.de&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <span style="color: #000000; font-weight: bold;">set</span> req.backend = <span style="color: #7a0874; font-weight: bold;">local</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <span style="color: #000000; font-weight: bold;">set</span> req.backend = default;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;GET&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;HEAD&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;PUT&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;POST&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;TRACE&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;OPTIONS&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;DELETE&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#         /* Non-RFC2616 or CONNECT which is weird. */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>pipe<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;GET&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> req.request <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;HEAD&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#         /* We only deal with GET and HEAD by default */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>pass<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Authorization <span style="color: #000000; font-weight: bold;">||</span> req.http.Cookie<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#         /* Not cacheable by default */</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>pass<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>lookup<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#Wenn Seite vom Server geholt wird</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub vcl_fetch <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">##No-Cache vom Server auswerten damit Varnish kapiert wenn TYPO3-Cache geleert wird</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>beresp.http.Pragma ~ <span style="color: #ff0000;">&quot;nocache&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Via <span style="color: #000000; font-weight: bold;">||</span> req.http.User-Agent ~ <span style="color: #ff0000;">&quot;bot|MSIE&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>hit_for_pass<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"># Wenn Anfrage aus dem Cache geholt wird</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sub vcl_hit <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Cache-Control ~ <span style="color: #ff0000;">&quot;no-cache&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>req.http.Via <span style="color: #000000; font-weight: bold;">||</span> req.http.User-Agent ~ <span style="color: #ff0000;">&quot;bot|MSIE&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #000000; font-weight: bold;">set</span> obj.ttl = 0s;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #7a0874; font-weight: bold;">return</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>deliver<span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></li></ol></pre></div></div>
Vor allem ist zu beachten, dass es die Option <span style="font-weight: bold;">purge_url</span><span style="font-style: italic;"></span> nicht mehr gibt. Statt dessen gibt es die neue Option <span style="font-weight: bold;">ban</span> http://www.varnish-cache.org/docs/trunk/tutorial/purging.html
Im Abschnitt <span style="font-weight: bold;">vcl_fetch</span> ist seit der Version 3.0 die Rückgabe (pass) nicht mehr erlaubt, daher ist sie durch <span style="font-weight: bold;">hit_for_pass</span> ersetzt worden.
Unbedingt beachten sollten man auch, dass es bis zur Version 2.1 noch erlaubt war 
<div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.http.X-Forwarded-For  <span style="color: #ff0000;">&quot;, &quot;</span> client.ip;</div></li></ol></pre></div></div>
zu schreiben.
Ab der Version 3.0 ist die Syntax etwas strenger geworden:
<div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">req.http.X-Forwarded-For + <span style="color: #ff0000;">&quot;, &quot;</span> + client.ip;</div></li></ol></pre></div></div>]]></content:encoded>
			<category>Tuning</category>
			
			
			<pubDate>Tue, 21 Jun 2011 16:07:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>LSI Raid-Controller von Dell über Nagios überwachen</title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/monitoring/monitoring-einzelansicht/artikel/lsi-raid-controller-von-dell-ueber-nagios-ueberwachen.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/monitoring/monitoring-einzelansicht/artikel/lsi-raid-controller-von-dell-ueber-nagios-ueberwachen.html</guid>
			<description>In vielen Servern, zum Beispiel der Firma Dell, werden auch Raid-Controller von LSI verbaut. 
Bei...</description>
			<content:encoded><![CDATA[In vielen Servern, zum Beispiel der Firma Dell, werden auch Raid-Controller von LSI verbaut. 
Bei aktuellen Servern erkennt man anhand des Befehls &quot;lspci&quot; folgende Bezeichnungen für die Controller, wobei es sich um den gleichen Typ handelt:
02:0e.0 RAID bus controller: Dell PowerEdge Expandable RAID controller 5<br />01:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 1078
Ältere Server haben teilweise einen älteren Controller im Einsatz.
02:0e.0 RAID bus controller: Dell PowerEdge Expandable RAID controller 4
<h2></h2>
<h2>Das Tool megactl</h2>
Um die genannten Raid-Controller abzufragen gibt es das Tool <link http://sourceforge.net/projects/megactl/ - external-link-new-window "Öffnet externen Link in neuem Fenster">megactl</link>. Für aktuelle Ubuntu- und Debian-Systeme gibt es dafür auch ein fertiges DEB-Paket, welche über eine <link http://hwraid.le-vert.net/debian/pool-sid/ - external-link-new-window "Öffnet externen Link in neuem Fenster">Fremdquelle</link> bezogen werden kann.
Hier findet man neben einer 64 Bit auch eine 32 Bit Version.
<link http://hwraid.le-vert.net/debian/pool-sid/megactl_0.4.1+svn20090725.r6-1_amd64.deb>megactl_0.4.1+svn20090725.r6-1_amd64.deb<br /></link><link http://hwraid.le-vert.net/debian/pool-sid/megactl_0.4.1+svn20090725.r6-1_i386.deb>megactl_0.4.1+svn20090725.r6-1_i386.deb</link>
<h2></h2>
<h2>Installation von megactl</h2>
Auf einem Ubuntu- oder Debian-Server wird das davor heruntergeladene Paket wie folgt installiert:
dpkg -i megactl_0.4.1+svn20090725.r6-1_i386.deb
Auf einem 64 Bit System wird davor das Paket libc6-i386 benötigt.
apt-get install libc6-i386
<h2>Status des Raid-Controllers abfragen</h2>

Den Status eines LSI MegaRAID-Controllers erhält man nach erfolgreicher Installation von megactl je nach eingebautem Typ mit den Befehlen:
megasasctl&nbsp; (Dell PowerEdge Expandable RAID controller 5 oder MegaRAID SAS)
megactl (Dell PowerEdge Expandable RAID controller 4)
<h3></h3>
<h3>Bash-Skript zur automatischen Abfrage</h3>
Damit die Abfrage automatisch über Cron stattfindet oder um den Status des Controllers über Nagios prüfen zu lassen kann man ein entsprechendes Skript schreiben das zum Beispiel so aussehen kann:
<div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">IFS</span>=<span style="color: #ff0000;">&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;"> &quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"># Status fuer Nagios bereitstellen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">LOGFILE</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>raid.txt</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$LOGFILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$LOGFILE</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #007800;">$LOGFILE</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"># Abfrage des Status</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">CHECKRAID</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>megasasctl <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'DEGRADED\|failure'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;"># Status ok</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">$?</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOGFILE</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">else</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #666666; font-style: italic;"># Status Fehler - E-Mail senden</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(megasasctl)</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> mail admin<span style="color: #000000; font-weight: bold;">@</span>deinedom.tld <span style="color: #660033;">-s</span><span style="color: #ff0000;">&quot;<span style="color: #007800;">$(hostname)</span> RAID Fehler&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #666666; font-style: italic;"># Status Rebuild ?</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #007800;">RAIDDETAILS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>megasasctl <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> rebuild<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">$?</span> == <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOGFILE</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">else</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #666666; font-style: italic;"># Falls kein Rebuild - kritisch</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">         <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOGFILE</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li></ol></pre></div></div>
<h3></h3>
<h3>Einbindung in den Nagios</h3>
Den dadurch bereitgestellten Status kann nun auch von Nagios abgefragt werden. Es werden folgende drei Werte bereitgestellt:
0 -&gt; Status: ok<br />1 -&gt; Status: warning<br />2 -&gt; Status: critical
<br />Dazu kann folgendes Nagios-Plugin eingesetzt werden.
<div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">STATE_OK</span>=<span style="color: #000000;">0</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">STATE_WARNING</span>=<span style="color: #000000;">1</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">STATE_CRITICAL</span>=<span style="color: #000000;">2</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">host</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">hostname</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">LOGFILE</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>raid.txt</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #007800;">STATUS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$LOGFILE</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$STATUS</span> = <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;WARNING - <span style="color: #007800;">$host</span> - RAID rebuilding&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$STATE_WARNING</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$STATUS</span> = <span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;CRITICAL - <span style="color: #007800;">$host</span> - RAID critical&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$STATE_CRITICAL</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$STATUS</span> = <span style="color: #ff0000;">&quot;Null&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> CRITICAL - <span style="color: #007800;">$host</span> -  RAID unknown</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$STATE_UNKNOWN</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$STATUS</span> = <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">echo</span> OK - <span style="color: #007800;">$host</span> -  RAID OK</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$STATE_OK</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">fi</span></div></li></ol></pre></div></div>
<h2></h2>
<h2>Auf der sicheren Seite</h2>
Viele Hoster setzen Raid-Controller ein, die wie man sehen kann, mit einfachen mitteln abgefragt werden können. Leider bieten die wenigsten ein entsprechendes Monitoring um zu warnen, falls eine Festplatte doch mal aus den Verbund ausfällt.
Die Redundanz eines Raid-Systems kann nur dann etwas nutzen, wenn auch rechtzeitig ein Problem erkannt wird bevor es zum Desaster kommt. (ch)]]></content:encoded>
			<category>Monitoring</category>
			
			
			<pubDate>Thu, 16 Jun 2011 17:03:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>WordPress mittels Nagios überwachen</title>
			<link>http://foobar.lamp-solutions.de/howtos/wordpress/sicherheit/sicherheits-einzelansicht/artikel/wordpress-mit-nagios-ueberwachen.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/wordpress/sicherheit/sicherheits-einzelansicht/artikel/wordpress-mit-nagios-ueberwachen.html</guid>
			<description>In unserem Artikel &quot;Über Wordpress Updates informiert bleiben&quot; haben wir eine Methode...</description>
			<content:encoded><![CDATA[In unserem Artikel &quot;<link http://foobar.lamp-solutions.de/howtos/wordpress/sicherheit/sicherheits-einzelansicht/artikel/ueber-wordpress-updates-informiert-bleiben.html _blank external-link-new-window "Öffnet externen Link in neuem Fenster">Über Wordpress Updates informiert bleiben</link>&quot; haben wir eine Methode beschrieben, wie man über Updates von Wordpress informiert bleibt. Diese gibt Meldungen aus, falls ein Update vorhanden ist. Wir haben uns daher dazu entschlossen, aufgrund von vermehrter Nachfrage das Skript soweit umzugestalten, dass es auch direkt von Nagios genutzt werden kann. <br /><br />Zudem ist es mit unserem Skript auch möglich Wordpress Installationen, auf welchen das Multisite-Feature genutzt wird zu überwachen, da es dort zu Problemen kommen kann. <br /><br />Nagios funktioniert mit dem Ampelprinzip, daher sind folgende Zustände möglich:<br /><br />Alles in Ordnung zeigt Status &quot;grün&quot;. Entweder Core, Plugin, oder Theme Updates stehen bereit zeigt Status &quot;gelb&quot;. Status Rot wird ausglöst, wenn sowohl Core, als auch Plugin und Theme Update stehen bereitstehen, die WordPress Version einfach zu alt ist, oder ein unbekannter Fehler beim Skriptaufruf ausgeführt wird.<br /><br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">#!/usr/bin/php</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Wechsel in Verzeichnis der Domain</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://www.php.net/chdir"><span style="color: #990000;">chdir</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Domainname ist HTTP_HOST. Benötigt für Multisite Installationen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Zentraler include wichtiger Files - erst ab neueren Versionen vorhanden</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/file_exists"><span style="color: #990000;">file_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./wp-load.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./wp-load.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">// Version zu alt, keine wp-load.php vorhanden</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Version zu alt. Unverzueglich Update durchfuehren!&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Variablen</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_version</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$core_updates</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$plugin_updates</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$theme_updates</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">wp_version_check<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">wp_update_plugins<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">wp_update_themes<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//Funktionsnamen haben sich bei v2.9 geändert, daher Abfrage.</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_version</span> <span style="color: #339933;">&gt;</span> <span style="color:#800080;">2.9</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000088;">$core</span> <span style="color: #339933;">=</span> get_site_transient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'update_core'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000088;">$plugins</span> <span style="color: #339933;">=</span> get_site_transient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'update_plugins'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000088;">$themes</span> <span style="color: #339933;">=</span> get_site_transient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'update_themes'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000088;">$core</span> <span style="color: #339933;">=</span> get_transient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'update_core'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000088;">$plugins</span> <span style="color: #339933;">=</span> get_transient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'update_plugins'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000088;">$themes</span> <span style="color: #339933;">=</span> get_transient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'update_themes'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//Core Updates verfügbar?</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$core</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">updates</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$core</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">updates</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$core</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">updates</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$update</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$update</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$wp_version</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000088;">$core_new</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$update</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">current</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #000088;">$core_updates</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//Plugin Updates verfügbar?</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$plugins</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">response</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$plugins</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">response</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$plugins</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">response</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$plgupd</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000088;">$plugin_updates</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//Theme Updates verfügbar?</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$themes</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">response</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$themes</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">response</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$themes</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">response</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$theupd</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #000088;">$theme_updates</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$core_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$plugin_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$theme_updates</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;OK - Keine Updates verfuegbar.&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$core_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$plugin_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$theme_updates</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;WARNING - Theme Updates verfuegbar &quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$core_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$plugin_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$theme_updates</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;WARNING - Plugin Updates verfuegbar&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$core_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$plugin_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$theme_updates</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;WARNING - Plugin und Theme Updates verfuegbar &quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$core_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$plugin_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$theme_updates</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;WARNING - Core Updates verfuegbar &quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$core_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$plugin_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$theme_updates</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;WARNING - Core und Theme Updates verfuegbar&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$core_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$plugin_updates</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$theme_updates</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;WARNING - Core und Plugin Updates verfuegbar&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;CRITICAL - Core, Plugin und Theme Updates verfuegbar&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;CRITICAL - Unbekannter Fehler!&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">?&gt;</span></div></li></ol></pre></div></div><br /><br />Eine Auflistung der ausstehenden Updates ist auch möglich, jedoch würden wir davon abraten. In durchgeführten Tests konnten wir bei der gleichzeitigen Abfrage mehrerer Domains feststellen, dass dadurch zum einen die Abfragezeit länger dauert und zu einem Timout bei der Überwachung führen kann (vor allem bei weit entfernten Server), als auch die Tatsache, dass mehr Ressourcen benötigt werden. <br /><br />Sollten viele kleine Blogs zum Einsatz kommen lohnt sich auch ein Blick auf den Artikel &quot;<link http://foobar.lamp-solutions.de/howtos/wordpress/plugins/plugins-einzelansicht/artikel/mehrere-blogs-mit-einer-wordpress-installation-betreiben.html _blank external-link-new-window "Öffnet externen Link in neuem Fenster">Mehrere Blogs mit einer Wordpress Installation betreiben</link>&quot; werfen. Die Überwachung funktioniert auch bei Multisite-Blogs. Der administrative Aufwand und die zu überwachenden Installationen halten sich damit in Grenzen. (fr)]]></content:encoded>
			<category>Sicherheit</category>
			
			
			<pubDate>Fri, 03 Jun 2011 13:35:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>Comments mit Honeypot statt mit Capture vor SPAM schützen </title>
			<link>http://foobar.lamp-solutions.de/howtos/typo3/extensions/extensions-einzelansicht/artikel/comments-mit-honeypot-statt-mit-capture-vor-spam-schuetzen.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/typo3/extensions/extensions-einzelansicht/artikel/comments-mit-honeypot-statt-mit-capture-vor-spam-schuetzen.html</guid>
			<description>Die Comments-Erweiterung TYPO3 lässt sich mit verschiedenen Captures gegen SPAM schützen. Captures...</description>
			<content:encoded><![CDATA[Ein Honeypot ist in unserem Fall ein Input-Feld, das wir mit Hilfe von CSS außerhalb des sichtbaren Bereichs der Webseite platzieren.<br />Im php-Code prüfen wir, ob dieses Feld beim Absenden ausgefüllt wurde. Da die meisten SPAM-Versender ohne zu prüfen alle Felder ausfüllen, können wir so recht einfach erhrliche Besucher von Bots unterscheiden.<br /><br />
<h2>1) class.tx_comments_pi1.php anpassen</h2>
Zuerst legen wir eine zusätzliche Funktion an:<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> check_honeypot<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>t3lib_div<span style="color: #339933;">::</span><span style="color: #004000;">GPvar</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'honeypot'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #009900;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #009900;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div><br />in Zeile 967 fügen wir eine kleine Abfrage hinzu<br /><div id="tx_codehighlight_pi1"><div class="code"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">conf</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'honeypot'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">check_honeypot</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">formValidationErrors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'honeypot'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pi_getLL</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error.dont.fill.honeypot'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">&#125;</span> </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div>
<h2>2) Template ergänzen</h2>
Im Template, zum Beispiel dem mitgelieferten unter res/pi1_template.html fügen wir einfach die Zeile <br />&lt;input type=&quot;input&quot; name=&quot;honeypot&quot; style=&quot;position: absolute; margin: 0 0 0 -9999px;&quot; value=&quot;&quot; /&gt;<br />im Formular ein.<br /><br />
<h2>3) TYPOscript anpassen</h2>
Um die Funktion zu aktivieren, ergänzen wir das TS-Setup unserer Seite um die Zeile<br />plugin.tx_comments_pi1.honeypot=1<br /><br />
<h2>4) Fazit:</h2>
Im Vergleich zu einem Capture ist die Lösung mit dem Honeypot für die erhlichen Besucher wenig störend. Wenn der SPAM überhand nimmt, lässt sich der Honeypot ja wieder jederzeit durch ein Capture ersetzten.]]></content:encoded>
			<category>Extensions</category>
			
			
			<pubDate>Mon, 23 May 2011 16:38:00 +0200</pubDate>
			<enclosure url="http://foobar.lamp-solutions.de/uploads/media/comments.tgz" length ="706560" type="application/x-gzip" />
		</item>
		
		<item>
			<title>Zugriffsstatistiken auf varnish für einzelne Vhosts  mit awstats anlegen</title>
			<link>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/zugriffsstatistiken-auf-varnish-fuer-einzelne-vhosts-mit-awstats-anlegen.html</link>
            <guid>http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/artikel/zugriffsstatistiken-auf-varnish-fuer-einzelne-vhosts-mit-awstats-anlegen.html</guid>
			<description>Mit einigen Anpassungen lässt sich der Varnishnca-Deamon dazu bringen Logfiles zu erstellen, die...</description>
			<content:encoded><![CDATA[Wird ein Webserver durch einen Cache wie den http-accelerator varnish erfolgreich getunt, gelangen nur noch wenige Anfragen auf den Webserver. Für aussagekräftige Statistiken reichen die Anfragen auf dem Webserver nicht mehr aus. Die Statistiken lassen sich dann besser direkt aus den Zugriffen auf dem Loadbalancer erstellen.<br /><br />
<h2>1) varnishncsa anpassen</h2>
Joenio Costa hat unter http://gitorious.org/varnisnncsa-vhost einen Patch für den Logdeamon von varnish veröffentlicht, mit der das Logformat der bei Ubuntu 10.4 beiliegenden Varnish-Version so abgeändert wird, dass der Domainname an den die Anfrage geht mit ins Logfile geschrieben wird. <br />Für den Patch gibt es fertige Debian Pakete. Damit der geänderte Logdeamon unter Ubuntu 10.4 funktioniert, muss das init-Script leicht angepasst werden. Der user muss von varnishlog in root geändert werden.<br />Unter dem Artiekel bieten wir ein angepasstes Archiv zum Download an.<br />Mit dem Archiv ist der angepasste Logdeamon schnell eingerichtet<br />&nbsp;&nbsp;&nbsp; <div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">wget</span> foobar.lamp-solutions.de<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>varnishncsa-vhost_0.1-<span style="color: #000000;">1</span>_ubuntu.deb</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> varnishncsa-vhost_0.1-<span style="color: #000000;">1</span>_ubuntu.deb</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>varnishncsa-vhost</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">VARNISHNCSA_ENABLED</span>=<span style="color: #000000;">1</span> setzen</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>varnishncsa </div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">VARNISHNCSA_ENABLED</span>=<span style="color: #000000;">0</span> setzen</div></li></ol></pre></div></div>
<h2>2) awstats anpassen</h2>
Jeder Vhost bekommt jetzt eine eigene Konfigurationsdatei. Diese muss drei wichtige Einstellungen enthalten
<div class="indent"><br />&nbsp;&nbsp;&nbsp; <div id="tx_codehighlight_pi1"><div class="code"><pre class="bash" style="font-family:monospace;"><ol><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">LogFile</span>=<span style="color: #ff0000;">&quot;/var/log/varnish/varnishncsa-vhost.log&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">LogFormat = <span style="color: #ff0000;">&quot;%virtualname %host %other %logname %time1 <span style="color: #000099; font-weight: bold;">\</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">%methodurl %code %bytesd %refererquot %uaquot&quot;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">SiteDomain</span>=<span style="color: #ff0000;">&quot;&lt;Domainname&gt;&quot;</span></div></li></ol></pre></div></div><br /><br />Alle weiteren Einstellungen können wie gewohnt vorgenommen werden.<br /><br />
<h2>3) Fazit</h2>
Mit dem Erscheinen von Varnish 3.0, das zur Zeit als beta-Version vorliegt, wird der Logdeamon von Hause aus individuelle Logformate unterstützen. Die Anpassungen werden dann nicht mehr nötig sein. Da mit der LTS-Version von Ubuntu 10.04 und anderen großen Distributionen noch einige Zeit der Vernish 2.1.x Standard sein wird, ist die hier beschriebene Lösung eine recht einfache Möglichkeit Zugriffsstatistiken für einen Varnish-Cache oder Loadbalancer pro Vhost zu führen.</div>]]></content:encoded>
			<category>Tuning</category>
			
			
			<pubDate>Mon, 23 May 2011 12:02:00 +0200</pubDate>
			<enclosure url="http://foobar.lamp-solutions.de/uploads/media/varnishncsa-vhost_0.1-1_ubuntu.deb" length ="7398" type="application/x-debian-package" />
		</item>
		
	</channel>
</rss>
