Ver código fonte

Ticket #1765, improvements

AlexeyUna 8 anos atrás
pai
commit
aa616e758e

+ 1 - 1
modules/boonex/dolphin_migration/classes/BxDolMBlogs.php

@@ -99,7 +99,7 @@ class BxDolMBlogs extends BxDolMData
 						
 			$this -> _oDb ->  query("UPDATE `{$this -> _sTableWithTransKey}` SET `allow_view_to` = :privacy, `comments` = :cmts WHERE `id` = :id", array('privacy' => $aValue['allowView'], 'id' => $iBlogId, 'cmts' => $iCmts));
 			
-			$this -> trasnferTags((int)$aValue['PostID'], $iBlogId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
+			$this -> transferTags((int)$aValue['PostID'], $iBlogId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
         }
 
         $this -> setResultStatus(_t('_bx_dolphin_migration_started_migration_blogs_finished', $this -> _iTransferred));

+ 10 - 0
modules/boonex/dolphin_migration/classes/BxDolMConfig.php

@@ -252,6 +252,16 @@ class BxDolMConfig extends BxBaseModGeneralConfig
 						'bx_persons'	=> 'Persons',
 						'bx_timeline'	=> 'Timeline'		
 			        ),
+                ),
+                'membership_levels' => array(
+                    'table_name'		=> 'sys_acl_levels',
+                    'migration_class'	=> 'BxDolMMemLevels',
+                    'dependencies' => array(
+                        'profiles',
+                    ),
+                    'plugins' => array(
+                        'bx_acl'	=> 'Paid Levels'
+                    ),
                 )
              );
 			 

+ 40 - 45
modules/boonex/dolphin_migration/classes/BxDolMData.php

@@ -118,7 +118,7 @@ class BxDolMData
 	* Set Migration Status
 	* @param string $sStatus message
 	*/         
-	protected function setResultStatus($sStatus, $sModule = '')
+	protected function setResultStatus($sStatus)
 	{
 	    $sQuery = $this -> _oDb -> prepare("UPDATE `{$this -> _sPrefix}transfers` SET `status_text` = ? WHERE `module` = ? ", $sStatus, $this -> _sModuleName);
 	    $this -> _oDb -> query($sQuery);
@@ -349,20 +349,7 @@ class BxDolMData
 										LEFT JOIN `sys_localization_languages` as `l` ON `s`.`IDLanguage` = `l`.`ID`
 										WHERE `k`.`Key` = :key", 'Name', 'String', array('key' => $LKey));
 	}
-	
-	/**
-	 *  Returns pre values field value of defined field, by Key and Value
-	 *  
-	 *  @param string $sKey Key name
-	 *  @param mixed $mixedValue Value 
-	 *  @param string $sField field name
-	 *  @return mixed value
-	 */
-	public function getPreValuesFieldBy($sKey, $mixedValue, $sField = 'Order')
-	{
-		return $this -> _mDb -> getOne("SELECT `{$sField}` FROM `sys_pre_values` WHERE `Key` = ? AND `Value` = ? LIMIT 1", $sName, $mixedValue);
-	}
-	
+
 	/**
 	 *  Transfer Tags from the module, to meta 
 	 *  
@@ -372,7 +359,7 @@ class BxDolMData
 	 *  @param int $sTableKeywords table name in UNA for tags migration
 	 *  @return void
 	 */
-	protected function trasnferTags($iObjectId, $iNewObjectId, $sType, $sTableKeywords)
+	protected function transferTags($iObjectId, $iNewObjectId, $sType, $sTableKeywords)
 	{
 		$aTags = $this -> _mDb -> getAll("SELECT `Tag` FROM `sys_tags` WHERE `ObjID`=:id AND `Type`=:type", array('id' => $iObjectId, 'type' => $sType));
 		if (empty($aTags))
@@ -490,26 +477,29 @@ class BxDolMData
 		return $iComments;
 	}
 
-	
-	
-	/**
-	* Create migration field in main table for transferring content from Dolphin to UNA and contains id of the object in Dolphin 
-	* @return mixed
-         */
-	protected function createMIDField()
-	{
-		if (!$this -> _sTableWithTransKey)
-			return false;
-		
-		if ($this -> _oDb -> isFieldExists($this -> _sTableWithTransKey, $this -> _sTransferFieldIdent))
-			return true;
-		
-		return $this -> _oDb -> query("ALTER TABLE `{$this -> _sTableWithTransKey}` ADD `{$this -> _sTransferFieldIdent}` int(11) unsigned NOT NULL default '0'");
-	}
-	
+    /**
+     * Create migration field in main table for transferring content from Dolphin to UNA and contains id of the object in Dolphin
+     * @param string $sTableName name of the table to add the index field
+     * @param string $sIdentFieldName
+     * @return mixed
+     */
+    protected function createMIDField($sTableName = '', $sIdentFieldName = '')
+    {
+        if (!$this -> _sTableWithTransKey)
+            return false;
+
+        $sIdentFieldName = $sIdentFieldName ? $sIdentFieldName : $this -> _sTransferFieldIdent;
+        $sTableName = $sTableName ? $sTableName : $this -> _sTableWithTransKey;
+
+        if ($this -> _oDb -> isFieldExists($sTableName, $sIdentFieldName))
+            return true;
+
+        return $this -> _oDb -> query("ALTER TABLE `{$sTableName}` ADD `{$sIdentFieldName}` int(11) unsigned NOT NULL default '0'");
+    }
+
 	/**
 	 *  Returns last migration field value
-	 *  
+	 *
 	 *  @return int
 	 */
 	protected function getLastMIDField()
@@ -550,18 +540,23 @@ class BxDolMData
 
 		return (int)$this -> _oDb -> query("UPDATE `{$this -> _sTableWithTransKey}` SET `{$this -> _sTransferFieldIdent}` = :item WHERE `{$sField}` = :id", array('id' => $iId, 'item' => $iItemId));
 	}
-	/**
-	 *  Drop migration field from the table
-	 *  
-	 *  @return int affected rows
-	 */
-	public function dropMID()
-	{
-		if (!$this -> _sTableWithTransKey || !$this -> _oDb -> isFieldExists($this -> _sTableWithTransKey, $this -> _sTransferFieldIdent))
-			return false;
 
-		return (int)$this -> _oDb -> query("ALTER TABLE `{$this -> _sTableWithTransKey}` DROP `{$this -> _sTransferFieldIdent}`");
-	}
+    /**
+     *  Drop migration field from the table
+     *  @param string $sIdentFieldName field name to store id from original table (in case if you don't want to use default field)
+     *  @param string $sTableName table name in which to create the field
+     *  @return int affected rows
+     */
+    public function dropMID($sTableName = '', $sIdentFieldName = '')
+    {
+        $sIdentFieldName = $sIdentFieldName ? $sIdentFieldName : $this -> _sTransferFieldIdent;
+        $sTableName = $sTableName ? $sTableName : $this -> _sTableWithTransKey;
+
+        if (!$sTableName || !$this -> _oDb -> isFieldExists($sTableName, $sIdentFieldName))
+            return false;
+
+        return (int)$this -> _oDb -> query("ALTER TABLE `{$sTableName}` DROP `{$sIdentFieldName}`");
+    }
 	
 	/**
 	 *  Removes all transferred content from UNA

+ 1 - 2
modules/boonex/dolphin_migration/classes/BxDolMEvents.php

@@ -35,7 +35,6 @@ class BxDolMEvents extends BxDolMData
 		}	
 		
 		$this -> setResultStatus(_t('_bx_dolphin_migration_started_migration_events'));
-		
 			
 		$this -> createMIdField();
 		$iEventId = $this -> getLastMIDField();						
@@ -112,7 +111,7 @@ class BxDolMEvents extends BxDolMData
 											`comments` = :cmts 
 									WHERE `id` = :id", array('pic' => $iPic, 'id' => $iEventId, 'cmts' => $iCmts));
 			
-			$this -> trasnferTags((int)$aValue['ID'], $iEventId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
+			$this -> transferTags((int)$aValue['ID'], $iEventId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
         }      	
         
 		// set as finished;

+ 1 - 1
modules/boonex/dolphin_migration/classes/BxDolMFiles.php

@@ -108,7 +108,7 @@ class BxDolMFiles extends BxDolMData
 											`comments` = :cmts 
 									WHERE `id` = :id", array('id' => $iFileId, 'cmts' => $iCmts));
 			
-			$this -> trasnferTags((int)$aValue['ID'], $iFileId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
+			$this -> transferTags((int)$aValue['ID'], $iFileId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
         }      	
 
         // set as finished;

+ 1 - 1
modules/boonex/dolphin_migration/classes/BxDolMGroups.php

@@ -108,7 +108,7 @@ class BxDolMGroups extends BxDolMData
 											`comments` = :cmts 
 									WHERE `id` = :id", array('pic' => $iPic, 'id' => $iGroupId, 'cmts' => $iCmts));
 			
-			$this -> trasnferTags((int)$aValue['id'], $iGroupId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
+			$this -> transferTags((int)$aValue['id'], $iGroupId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
         }      	
 
         // set as finished;

+ 1 - 1
modules/boonex/dolphin_migration/classes/BxDolMMarket.php

@@ -111,7 +111,7 @@ class BxDolMMarket extends BxDolMData
 											`package`		= :file_id
 									WHERE `id` = :id", array('thumb' => $iPic, 'id' => $iProductId, 'cmts' => $iCmts, 'price' => $aInfo['price'], 'file_id' => $aInfo['file_id']));
 			
-			$this -> trasnferTags($aValue['id'], $iProductId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
+			$this -> transferTags($aValue['id'], $iProductId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
 		}      	
 
         // set as finished;

+ 1 - 1
modules/boonex/dolphin_migration/classes/BxDolMPhotoAlbums.php

@@ -145,7 +145,7 @@ class BxDolMPhotoAlbums extends BxDolMData
 						$this -> _iTransferred++;
 						$iTransferred++;
 						
-						$this -> trasnferTags((int)$aValue['ID'], $iId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
+						$this -> transferTags((int)$aValue['ID'], $iId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
 					}
 				}
 			}	

+ 1 - 1
modules/boonex/dolphin_migration/classes/BxDolMPolls.php

@@ -101,7 +101,7 @@ class BxDolMPolls extends BxDolMData
 			
 			$this -> _iTransferred++;
 			
-			$this -> trasnferTags($aValue['id_poll'], $iPollId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
+			$this -> transferTags($aValue['id_poll'], $iPollId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
         }      	
 
 

+ 4 - 4
modules/boonex/dolphin_migration/classes/BxDolMProfiles.php

@@ -17,9 +17,9 @@ require_once('BxDolMData.php');
 	
 class BxDolMProfiles extends BxDolMData
 {
-    public function __construct(&$oMigrationModule, &$seDb)
+    public function __construct(&$oMigrationModule, &$mDb)
     {
-		parent::__construct($oMigrationModule, $seDb);
+		parent::__construct($oMigrationModule, $mDb);
 		$this -> _sModuleName = 'profiles';
 		$this -> _sTableWithTransKey = 'sys_accounts';
     }
@@ -81,7 +81,7 @@ class BxDolMProfiles extends BxDolMData
 			else 
 				$this -> addPreValues('Sex', true, 2); // transfer all sex values more then 2 value
 
-			$aResult = $this -> _mDb -> getAll("SELECT * FROM `"  . $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['table_name'] . "` {$sStart} ORDER BY `ID` ASC LIMIT 10");
+			$aResult = $this -> _mDb -> getAll("SELECT * FROM `"  . $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['table_name'] . "` {$sStart} ORDER BY `ID` ASC");
 			$aSex = $this -> getPreValuesBy('Sex', 'Value', 'Order');
 
 			foreach($aResult as $iKey => $aValue)
@@ -353,6 +353,7 @@ class BxDolMProfiles extends BxDolMData
 		}	
 		
 		parent::removeContent();
+
 		return $iNumber;
 	}
 	/**
@@ -380,7 +381,6 @@ class BxDolMProfiles extends BxDolMData
 
 		return $this -> transferPreValues($sName, $sName, $aValues, true);	
 	}
-	
 }
 
 	

+ 2 - 2
modules/boonex/dolphin_migration/classes/BxDolMProfilesFields.php

@@ -34,9 +34,9 @@ class BxDolMProfilesFields extends BxDolMData
 	 */	
 	private $_oAssocFields = null;
 
-    public function __construct($oMigrationModule, &$seDb)
+    public function __construct($oMigrationModule, &$mDb)
     {
-        parent::__construct($oMigrationModule, $seDb);  
+        parent::__construct($oMigrationModule, $mDb);
 		$this -> _sModuleName = 'profile_fields';
 		$this -> _sTableWithTransKey = 'sys_form_inputs';	
     }

+ 1 - 1
modules/boonex/dolphin_migration/classes/BxDolMVideoAlbums.php

@@ -148,7 +148,7 @@ class BxDolMVideoAlbums extends BxDolMData {
 						$this -> _iTransferred++;
 						$iTransferred++;
 						
-						$this -> trasnferTags((int)$aValue['ID'], $iId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
+						$this -> transferTags((int)$aValue['ID'], $iId, $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['type'], $this -> _oConfig -> _aMigrationModules[$this -> _sModuleName]['keywords']);
 					}
 				}
 			}	

+ 4 - 0
modules/boonex/dolphin_migration/install/langs/en.xml

@@ -98,6 +98,10 @@
 	<string name="_bx_dolphin_migration_started_migration_timeline"><![CDATA[Wall Migration was started]]></string>
 	<string name="_bx_dolphin_migration_started_migration_timeline_finished"><![CDATA[{0} wall posts with comments were transferred]]></string>
 	<string name="_bx_dolphin_migration_started_migration_timeline_error"><![CDATA[Error occurred. Record Id is {0}]]></string>
+	<string name="_bx_dolphin_migration_data_membership_levels"><![CDATA[Paid Memberships levels, Members info]]></string>
+	<string name="_bx_dolphin_migration_started_migration_membership_levels"><![CDATA[Membership levels migration was started]]></string>
+	<string name="_bx_dolphin_migration_started_migration_membership_levels_finished"><![CDATA[{0} membership levels and {1} members' info were transferred]]></string>
+	<string name="_bx_dolphin_migration_started_migration_membership_levels_error"><![CDATA[Error occurred. Record Id is {0}]]></string>
 	<string name="_bx_dolphin_migration_define_total_method"><![CDATA[Please define how to calculate total records number for this Data]]></string>
 	<string name="_bx_dolphin_migration_salt"><![CDATA[Dolphin Secret]]></string>
 	<string name="_bx_dolphin_migration_installation_problem"><![CDATA[Seems like module was installed not correct. Please reinstall it.]]></string>