[Customisation Database Commits] r678 - /trunk/titania/ariel_convert.php

Nathan Guse exreaction at phpbb.com
Fri Mar 5 01:57:42 GMT 2010


Author: exreaction
Date: Fri Mar  5 01:57:42 2010
New Revision: 678

Log:
Try to convert the queue discussion topics over as well

Modified:
    trunk/titania/ariel_convert.php

Modified: trunk/titania/ariel_convert.php
==============================================================================
*** trunk/titania/ariel_convert.php (original)
--- trunk/titania/ariel_convert.php Fri Mar  5 01:57:42 2010
***************
*** 453,497 ****
  				continue;
  			}
  
  			$topic = new titania_topic;
  			$topic->parent_id = $row['queue_id'];
  			$topic->topic_url = 'manage/queue/q_' . $row['queue_id'];
! 			$post = false;
  
! 			// Convert the topics over from the phpBB forums
! 			$sql = 'SELECT * FROM ' . POSTS_TABLE . '
! 				WHERE topic_id = ' . (int) $row['topic_id'] . '
! 				ORDER BY post_id ASC';
! 			$post_result = phpbb::$db->sql_query($sql);
! 			while ($post_row = phpbb::$db->sql_fetchrow($post_result))
! 			{
! 				$post = new titania_post(TITANIA_QUEUE, $topic);
! 				$post->__set_array(array(
! 					'post_access'			=> TITANIA_ACCESS_TEAMS,
! 					'post_user_id'			=> $post_row['poster_id'],
! 					'post_ip'				=> $post_row['poster_ip'],
! 					'post_time'				=> $post_row['post_time'],
! 					'post_subject'			=> $post_row['post_subject'],
! 					'post_text'				=> $post_row['post_text'],
! 					'post_text_bitfield'	=> $post_row['bbcode_bitfield'],
! 					'post_text_uid'			=> $post_row['bbcode_uid'],
! 					'post_text_options'		=> (($post_row['enable_bbcode']) ? OPTION_FLAG_BBCODE : 0) + (($post_row['enable_smilies']) ? OPTION_FLAG_SMILIES : 0) + (($post_row['enable_magic_url']) ? OPTION_FLAG_LINKS : 0),
! 				));
! 				$post->message_parsed_for_storage = true;
! 				$post->submit();
! 			}
! 			phpbb::$db->sql_freeresult($post_result);
  
! 			// We didn't convert any posts?  (Local install perhaps?)
! 			if ($post === false)
  			{
! 				$post = new titania_post(TITANIA_QUEUE, $topic);
! 				$post->__set_array(array(
! 					'post_access'			=> TITANIA_ACCESS_TEAMS,
! 					'post_subject'			=> phpbb::$user->lang['VALIDATION'] . ' - ' . $row['contrib_name'] . ' - ' . $row['revision_version'],
! 					'post_text'				=> 'Converted from Ariel',
! 				));
! 				$post->submit();
  			}
  
  			// Now insert to the queue table
--- 453,488 ----
  				continue;
  			}
  
+ 			// Move the queue topics to our own side
+ 			$sql = 'SELECT topic_id FROM ' . $ariel_prefix . 'contrib_topics
+ 				WHERE contrib_id = ' . $row['contrib_id'] . '
+ 					AND topic_type = 4';
+ 			phpbb::$db->sql_query($sql);
+ 			$topic_id = phpbb::$db->sql_fetchfield('topic_id');
+ 			phpbb::$db->sql_freeresult();
+ 
  			$topic = new titania_topic;
  			$topic->parent_id = $row['queue_id'];
  			$topic->topic_url = 'manage/queue/q_' . $row['queue_id'];
! 			titania_move_topic($topic_id, $topic, $row['contrib_name'], $row['revision_version']);
! 			$queue_topic_id = $topic->topic_id;
! 			unset($topic);
  
! 			// Move the queue discussion topics to our own side
! 			$sql = 'SELECT topic_id FROM ' . $ariel_prefix . 'contrib_topics
! 				WHERE contrib_id = ' . $row['contrib_id'] . '
! 					AND topic_type = 5';
! 			phpbb::$db->sql_query($sql);
! 			$topic_id = phpbb::$db->sql_fetchfield('topic_id');
! 			phpbb::$db->sql_freeresult();
  
! 			if ($topic_id)
  			{
! 				$topic = new titania_topic;
! 				$topic->parent_id = $row['queue_id'];
! 				$topic->topic_url = titania_types::$types[$row['contrib_type']]->url . '/' . $row['contrib_name_clean'] . '/support/';
! 				titania_move_topic($topic_id, $topic);
! 				unset($topic);
  			}
  
  			// Now insert to the queue table
***************
*** 500,506 ****
  				'revision_id'			=> $row['revision_id'],
  				'contrib_id'			=> $row['contrib_id'],
  				'submitter_user_id'		=> $row['user_id'],
! 				'queue_topic_id'		=> $topic->topic_id,
  
  				'queue_type'			=> $row['contrib_type'],
  				'queue_status'			=> $queue_swap[$row['queue_status']],
--- 491,497 ----
  				'revision_id'			=> $row['revision_id'],
  				'contrib_id'			=> $row['contrib_id'],
  				'submitter_user_id'		=> $row['user_id'],
! 				'queue_topic_id'		=> $queue_topic_id,
  
  				'queue_type'			=> $row['contrib_type'],
  				'queue_status'			=> $queue_swap[$row['queue_status']],
***************
*** 586,591 ****
--- 577,624 ----
  
  trigger_error($display_message);
  
+ // Move a topic from phpBB ($topic_id) to Titania ($topic; object)
+ function titania_move_topic($topic_id, $topic, $contrib_name = '', $revision_version = '')
+ {
+ 	$post = false;
+ 
+ 	// Convert the topics over from the phpBB forums
+ 	$sql = 'SELECT * FROM ' . POSTS_TABLE . '
+ 		WHERE topic_id = ' . (int) $topic_id . '
+ 		ORDER BY post_id ASC';
+ 	$post_result = phpbb::$db->sql_query($sql);
+ 	while ($post_row = phpbb::$db->sql_fetchrow($post_result))
+ 	{
+ 		$post = new titania_post(TITANIA_QUEUE, $topic);
+ 		$post->__set_array(array(
+ 			'post_access'			=> TITANIA_ACCESS_TEAMS,
+ 			'post_user_id'			=> $post_row['poster_id'],
+ 			'post_ip'				=> $post_row['poster_ip'],
+ 			'post_time'				=> $post_row['post_time'],
+ 			'post_subject'			=> $post_row['post_subject'],
+ 			'post_text'				=> $post_row['post_text'],
+ 			'post_text_bitfield'	=> $post_row['bbcode_bitfield'],
+ 			'post_text_uid'			=> $post_row['bbcode_uid'],
+ 			'post_text_options'		=> (($post_row['enable_bbcode']) ? OPTION_FLAG_BBCODE : 0) + (($post_row['enable_smilies']) ? OPTION_FLAG_SMILIES : 0) + (($post_row['enable_magic_url']) ? OPTION_FLAG_LINKS : 0),
+ 		));
+ 		$post->message_parsed_for_storage = true;
+ 		$post->submit();
+ 	}
+ 	phpbb::$db->sql_freeresult($post_result);
+ 
+ 	// We didn't convert any posts?  (Local install perhaps?)
+ 	if ($post === false)
+ 	{
+ 		$post = new titania_post(TITANIA_QUEUE, $topic);
+ 		$post->__set_array(array(
+ 			'post_access'			=> TITANIA_ACCESS_TEAMS,
+ 			'post_subject'			=> phpbb::$user->lang['VALIDATION'] . ' - ' . $contrib_name . ' - ' . $revision_version,
+ 			'post_text'				=> 'Converted from Ariel',
+ 		));
+ 		$post->submit();
+ 	}
+ }
+ 
  function titania_insert($table, $sql_ary)
  {
  	$sql = 'INSERT INTO ' . $table . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary);
***************
*** 630,633 ****
      }
  
  	return @rmdir($target_filename);
! }
\ No newline at end of file
--- 663,666 ----
      }
  
  	return @rmdir($target_filename);
! }




More information about the customisationdb-commits mailing list