[pLog-svn] r4865 - plugins/branches/lifetype-1.1/sitemap

pwestbro at devel.lifetype.net pwestbro at devel.lifetype.net
Sat Feb 24 04:28:45 EST 2007


Author: pwestbro
Date: 2007-02-24 04:28:45 -0500 (Sat, 24 Feb 2007)
New Revision: 4865

Modified:
   plugins/branches/lifetype-1.1/sitemap/pluginsitemap.class.php
Log:
Use less memory when generated sitemaps


Modified: plugins/branches/lifetype-1.1/sitemap/pluginsitemap.class.php
===================================================================
--- plugins/branches/lifetype-1.1/sitemap/pluginsitemap.class.php	2007-02-23 21:37:52 UTC (rev 4864)
+++ plugins/branches/lifetype-1.1/sitemap/pluginsitemap.class.php	2007-02-24 09:28:45 UTC (rev 4865)
@@ -122,34 +122,34 @@
 
             $url = $this->blogInfo->getBlogRequestGenerator();
 
-            // Data from the xml file that needs to be there.
-            $xmlData =  "<?xml version='1.0' encoding='UTF-8'?>\n".
-                          "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
-                              
-             
-            // Iterate over the posts and create an entry for each.
-            foreach($list as $item)
-            {
-                $xmlData =  $xmlData . "<url>\n";
-                $xmlData =  $xmlData . "<loc>\n";
-                $xmlData =  $xmlData . htmlspecialchars( $url->postPermalink( $item ) ) . "\n";
-                $xmlData =  $xmlData . "</loc>\n";
-                $xmlData =  $xmlData . "</url>\n";
-            }
-            $xmlData =  $xmlData . "</urlset>\n";
-                
-                
+
             $compressedFile = $this->cacheFolder."/sitemap.gz";  
-
             
             // Save this to a compressed file.
             $gz = gzopen($compressedFile,'w9');
+
             if ( $gz )
             {
+
+                // Data from the xml file that needs to be there.
+                $xmlData =  "<?xml version='1.0' encoding='UTF-8'?>\n".
+                              "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
+                                  
                 gzwrite($gz, $xmlData);
+                 
+                // Iterate over the posts and create an entry for each.
+                foreach($list as $item)
+                {
+                    gzwrite($gz,  "<url>\n");
+                    gzwrite($gz, "<loc>\n");
+                    gzwrite($gz, htmlspecialchars( $url->postPermalink( $item ) ) . "\n");
+                    gzwrite($gz, "</loc>\n");
+                    gzwrite($gz, "</url>\n");
+                }
+                gzwrite($gz, "</urlset>\n");
                 gzclose($gz);
-            }
-            
+            }                
+                
             $blogSettings = $this->blogInfo->getSettings();
             if( $blogSettings->getValue( "plugin_sitemap_notify_google_enabled" ))
             {



More information about the pLog-svn mailing list