Esempio n. 1
0
 /**
  * Initialize the Search
  */
 public static function initialize()
 {
     if (self::$index === false) {
         // Initialize the ezc/Zend Search class
         if (titania::$config->search_backend == 'zend') {
             if (!is_writable(TITANIA_ROOT . self::store_path)) {
                 throw new exception(self::store_path . ' must be writable to use the Zend Lucene Search');
             }
             $handler = new ezcSearchZendLuceneHandler(TITANIA_ROOT . self::store_path);
         } else {
             if (titania::$config->search_backend == 'solr') {
                 $handler = new ezcSearchSolrHandler(titania::$config->search_backend_ip, titania::$config->search_backend_port);
                 // In case Solr would happen to go down..
                 if (!$handler->connection) {
                     // Log this as an error
                     titania::log(TITANIA_ERROR, 'Solr Server not responding');
                     self::$do_not_index = true;
                     return false;
                 }
             } else {
                 throw new exception('We need a proper search backend selected');
             }
         }
         $manager = new ezcSearchEmbeddedManager();
         self::$index = new ezcSearchSession($handler, $manager);
         return true;
     }
 }
// Hack for local
phpbb::$config['site_upload_dir'] = !isset(phpbb::$config['site_upload_dir']) ? '../phpBB3_titania/files/contribdb' : '../../' . phpbb::$config['site_upload_dir'];
$screenshots_dir = phpbb::$config['site_upload_dir'] . '/demo/';
// Table prefix
$ariel_prefix = 'community_site_';
$limit = 1000;
$mod_validation_trash_forum = 28;
$style_validation_trash_forum = 83;
$step = request_var('step', 0);
$start = request_var('start', 0);
// Populated later
$total = 0;
$display_message = '';
// We index later...
titania_search::initialize();
titania_search::$do_not_index = true;
$tags_to_cats = array(9 => 12, 10 => 13, 11 => 15, 12 => 14, 30 => 8, 31 => 3, 32 => 4, 33 => 6, 34 => 6, 35 => 5, 36 => 6, 37 => 7, 106 => 9, 107 => 4, 108 => 10, 155 => 12, 165 => 12, 175 => 12, 195 => 16, 235 => 16);
$queue_swap = array(1 => TITANIA_QUEUE_NEW, 2 => TITANIA_QUEUE_NEW, 3 => 19, 4 => 20, -1 => TITANIA_QUEUE_APPROVED, -2 => TITANIA_QUEUE_DENIED);
switch ($step) {
    case 0:
        trigger_error('Are you ready to begin the conversion?  All old data in Titania will be lost!<br /><br /><a href="' . append_sid(TITANIA_ROOT . 'ariel_convert.' . PHP_EXT, 'step=1') . '">Continue with the converter</a>');
        break;
    case 1:
        $truncate = array(TITANIA_AUTOMOD_QUEUE_TABLE, TITANIA_REVISIONS_PHPBB_TABLE, TITANIA_ATTENTION_TABLE, TITANIA_QUEUE_TABLE, TITANIA_ATTACHMENTS_TABLE, TITANIA_AUTHORS_TABLE, TITANIA_CONTRIBS_TABLE, TITANIA_CONTRIB_COAUTHORS_TABLE, TITANIA_CONTRIB_FAQ_TABLE, TITANIA_CONTRIB_IN_CATEGORIES_TABLE, TITANIA_POSTS_TABLE, TITANIA_RATINGS_TABLE, TITANIA_REVISIONS_TABLE, TITANIA_TOPICS_TABLE, TITANIA_TRACK_TABLE, TITANIA_WATCH_TABLE);
        foreach ($truncate as $table) {
            phpbb::$db->sql_query('TRUNCATE TABLE ' . $table);
        }
        // Truncate search index
        titania_search::truncate();
        // Clean up the files directory
        foreach (scandir(titania::$config->upload_path) as $item) {