[pLog-svn] r3965 - in plog/branches/lifetype-1.1.1/class: dao gallery/dao

mark at devel.lifetype.net mark at devel.lifetype.net
Thu Sep 14 05:27:46 GMT 2006


Author: mark
Date: 2006-09-14 05:27:45 +0000 (Thu, 14 Sep 2006)
New Revision: 3965

Modified:
   plog/branches/lifetype-1.1.1/class/dao/articlecategory.class.php
   plog/branches/lifetype-1.1.1/class/dao/articles.class.php
   plog/branches/lifetype-1.1.1/class/dao/blogcategory.class.php
   plog/branches/lifetype-1.1.1/class/gallery/dao/galleryalbum.class.php
Log:
Refer to http://bugs.lifetype.net/view.php?id=863

Fixed all MySQL 5 incompatibility when we run wizard.php.

1. we should set an initial value for parentId in article category, even we don't use it in 1.1

2. We have to set an initial value of mangled_topic in article_text

3. We should set initial value for numBlogs and numActiveBlogs

4. Add 4 motheds to manupliate gallery album normalized_name and normalized_description. Even we don't use the mysql fulltext search in 1.1. But we still need them to pass the database integrity check.


Modified: plog/branches/lifetype-1.1.1/class/dao/articlecategory.class.php
===================================================================
--- plog/branches/lifetype-1.1.1/class/dao/articlecategory.class.php	2006-09-13 16:44:10 UTC (rev 3964)
+++ plog/branches/lifetype-1.1.1/class/dao/articlecategory.class.php	2006-09-14 05:27:45 UTC (rev 3965)
@@ -38,7 +38,7 @@
 		 * @param lastModification Date when this category was last modified.
 		 * @param parentId Id of the parent category, not used as of LifeType 1.1.
 		 */
-		function ArticleCategory( $name, $url, $blogId, $inMainPage, $description = "", $numArticles = 0, $properties = Array(), $id = -1, $lastModification=null, $parentId = null)
+		function ArticleCategory( $name, $url, $blogId, $inMainPage, $description = "", $numArticles = 0, $properties = Array(), $id = -1, $lastModification=null, $parentId = 0)
 		{
 	        include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
 

Modified: plog/branches/lifetype-1.1.1/class/dao/articles.class.php
===================================================================
--- plog/branches/lifetype-1.1.1/class/dao/articles.class.php	2006-09-13 16:44:10 UTC (rev 3964)
+++ plog/branches/lifetype-1.1.1/class/dao/articles.class.php	2006-09-14 05:27:45 UTC (rev 3965)
@@ -849,6 +849,7 @@
             $valuesToInsert['text']             = $newArticle->getText(false);
             $valuesToInsert['normalized_text']  = $filter->normalizeText( $newArticle->getText(false) );
             $valuesToInsert['normalized_topic'] = $filter->normalizeText( $newArticle->getTopic() );
+            $valuesToInsert['mangled_topic']    = '';
 
             $query = Db::buildInsertQuery( ARTICLETEXTS_TABLENAME,
                                            $valuesToInsert );

Modified: plog/branches/lifetype-1.1.1/class/dao/blogcategory.class.php
===================================================================
--- plog/branches/lifetype-1.1.1/class/dao/blogcategory.class.php	2006-09-13 16:44:10 UTC (rev 3964)
+++ plog/branches/lifetype-1.1.1/class/dao/blogcategory.class.php	2006-09-14 05:27:45 UTC (rev 3965)
@@ -27,6 +27,8 @@
 			$this->_name = $name;
 			$this->_description = $description;
 			$this->_properties = $properties;
+			$this->_numBlogs = 0;
+			$this->_numActiveBlogs = 0;
 			
 			$this->_pk = "id";
 			$this->_fields = Array( "id" => "getId",

Modified: plog/branches/lifetype-1.1.1/class/gallery/dao/galleryalbum.class.php
===================================================================
--- plog/branches/lifetype-1.1.1/class/gallery/dao/galleryalbum.class.php	2006-09-13 16:44:10 UTC (rev 3964)
+++ plog/branches/lifetype-1.1.1/class/gallery/dao/galleryalbum.class.php	2006-09-14 05:27:45 UTC (rev 3965)
@@ -29,6 +29,8 @@
         var $_properties;
         var $_showAlbum;
 		var $_mangledName;
+		var $_normalizedName;
+		var $_normalizedDescription;
 		
 		/**
 		 * Constructor of the class.
@@ -45,7 +47,7 @@
 		 * @param showAlbum Whether to show this album in the main page or not.
 		 * @param id An identifier for this album. It is recommended not to set it.
 		 */
-    	function GalleryAlbum( $ownerId, $name, $description, $flags, $parentId, $date, $properties, $showAlbum, $id = -1 )
+    	function GalleryAlbum( $ownerId, $name, $description = '', $flags, $parentId, $date, $properties, $showAlbum, $id = -1 )
         {
             $this->DbObject();
         	$this->_ownerId = $ownerId;
@@ -63,6 +65,8 @@
             $this->_children = null;
             $this->_resources = null;
 			$this->_mangledName = "";
+			$this->_normalizedName = "";
+			$this->_normalizedDescription = "";
             
             $this->_pk = "id";
             $this->_fields = Array(
@@ -76,7 +80,9 @@
                 "show_album" => "getShowAlbum",
                 "mangled_name" => "getMangledName",
                 "num_resources" => "getNumResources",
-                "num_children" => "getNumChildren"
+                "num_children" => "getNumChildren",
+                "normalized_name" => "getNormalizedName",
+                "normalized_description" => "getNormalizedDescription"
             );
         }
         
@@ -166,7 +172,6 @@
         	
         	return( $this->_parent );
         }
-        
 
 		/**
 		 * Sets the parent id of the album. It is important that it is a valid 
@@ -390,6 +395,56 @@
 		function setMangledName( $mangledName )
 		{
 			$this->_mangledName = $mangledName;
-		}	
+		}
+
+		/**
+		 * Returns the normailzied name for full text search
+		 *
+		 * @return A normailzied name
+		 */
+        function getNormalizedName()
+        {
+			if( $this->_normalizedName == "" ) {
+				include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+				$this->_normalizedName = Textfilter::normalizeText( $this->getName());
+			}
+			
+			return( $this->_normalizedName );
+        }
+
+		/**
+		 * Sets the normailzied name of the album.
+		 *
+		 * @param normalized name
+		 */
+        function setNormalizedName( $normalizedName )
+        {
+			$this->_normalizedName = $normalizedName;
+        }
+
+		/**
+		 * Returns the normailzied description for full text search
+		 *
+		 * @return A normailzied description
+		 */
+        function getNormalizedDescription()
+        {
+			if( $this->_normalizedDescription == "" ) {
+				include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+				$this->_normalizedDescription = Textfilter::normalizeText( $this->getDescription());
+			}
+			
+			return( $this->_normalizedDescription );
+        }
+
+		/**
+		 * Sets the normailzied description of the album.
+		 *
+		 * @param normalized description
+		 */
+        function setNormalizedDescription( $normalizedDescription )
+        {
+			$this->_normalizedDescription = $normalizedDescription;
+        }
     }
 ?>
\ No newline at end of file



More information about the pLog-svn mailing list