コード例 #1
0
ファイル: Permissions.php プロジェクト: Grummfy/Flyspray2PP
	public function convert()
	{
		// get data from database
		$query = 'SELECT GROUP_CONCAT( ug.user_id SEPARATOR \',\' ) AS group_members, g.* FROM ' .
			$this->getDB()->getSourcePrefix() . 'groups g LEFT JOIN ' .
			$this->getDB()->getSourcePrefix() . 'users_in_groups ug ON ug.group_id = g.group_id GROUP BY group_id';
		$stmt = $this->getDB()->getSource()->query($query);

		$pp_permissions = array();

		while($row = $stmt->fetch(PDO::FETCH_ASSOC))
		{
			$pp_project = new PP_Projects($this->getDB());
			$pp_project->setOldId($row['project_id']);
			
			// set values for each fields
			$pp_project->setName($row['project_title']);
			// $pp_project->setPriority();
			$pp_project->setDescription($row['intro_message']);
			$pp_project->setCreated_on(time2SqlDateTime($row['last_updated']));
			$pp_project->setCreated_by_id($config['default_user_id']);
			$pp_project->setUpdated_on(time2SqlDateTime($row['last_updated']));
			$pp_project->setUpdated_by_id($config['default_user_id']);

			$pp_permissions[ $row['project_id'] ] = $pp_project;
		}
		$stmt->closeCursor();
				
		// insert in db
		$this->setNewIds($pp_permissions[ array_rand($pp_permissions) ]->writes2DB($pp_permissions));
		
		// clean memory
		unset($pp_permissions);
	}
コード例 #2
0
ファイル: Projects.php プロジェクト: Grummfy/Flyspray2PP
	private function _convertProjects()
	{
		// get data from database
		$query = 'SELECT * FROM ' . $this->getDB()->getSourcePrefix() . 'projects';
		$stmt = $this->getDB()->getSource()->query($query);

		// create array of PP_Projects
		$pp_projects = array();
		
		$config = $this->getConfig();
		$config = $config['projectpier'];

		while($row = $stmt->fetch(PDO::FETCH_ASSOC))
		{
			$pp_project = new PP_Projects($this->getDB());
			$pp_project->setOldId($row['project_id']);
			
			// set values for each fields
			$pp_project->setName($row['project_title']);
			// $pp_project->setPriority();
			$pp_project->setDescription($row['intro_message']);
			$pp_project->setCreated_on(time2SqlDateTime($row['last_updated']));
			$pp_project->setCreated_by_id($config['default_user_id']);
			$pp_project->setUpdated_on(time2SqlDateTime($row['last_updated']));
			$pp_project->setUpdated_by_id($config['default_user_id']);

			$pp_projects[ $row['project_id'] ] = $pp_project;
		}
		$stmt->closeCursor();
				
		// insert in db
		$this->setNewIds($pp_projects[ array_rand($pp_projects) ]->writes2DB($pp_projects));
		
		// clean memory
		unset($pp_projects);
	}