function run_tool() { $section = request_var('section', 0); $start = request_var('start', 0); $limit = titania::$config->search_backend == 'solr' ? 1000 : 100; $total = 0; $sync = new titania_sync(); switch ($section) { case 0: titania_search::truncate(); $display_message = 'Truncating Search'; break; case 1: $sql = 'SELECT COUNT(contrib_id) AS cnt FROM ' . TITANIA_CONTRIBS_TABLE; phpbb::$db->sql_query($sql); $total = phpbb::$db->sql_fetchfield('cnt'); phpbb::$db->sql_freeresult(); $sync->contribs('index', false, $start, $limit); $display_message = 'Indexing Contributions'; break; case 2: $sql = 'SELECT COUNT(post_id) AS cnt FROM ' . TITANIA_POSTS_TABLE; phpbb::$db->sql_query($sql); $total = phpbb::$db->sql_fetchfield('cnt'); phpbb::$db->sql_freeresult(); $sync->posts('index', $start, $limit); $display_message = 'Indexing Posts'; break; case 3: $sql = 'SELECT COUNT(faq_id) AS cnt FROM ' . TITANIA_CONTRIB_FAQ_TABLE; phpbb::$db->sql_query($sql); $total = phpbb::$db->sql_fetchfield('cnt'); phpbb::$db->sql_freeresult(); $sync->faqs('index', $start, $limit); $display_message = 'Indexing FAQ'; break; case 4: trigger_back('Done!'); break; } if ($start + $limit >= $total) { // Move to the next step meta_refresh(0, titania_url::build_url('manage/administration', array('t' => 'reindex', 'section' => $section + 1, 'submit' => 1, 'hash' => generate_link_hash('manage')))); } else { // Move to the next step meta_refresh(0, titania_url::build_url('manage/administration', array('t' => 'reindex', 'section' => $section, 'start' => $start + $limit, 'submit' => 1, 'hash' => generate_link_hash('manage')))); } trigger_error($display_message . ' - section ' . $section . ' of 3 - ' . ($start + $limit < $total ? 'part ' . ($start + $limit) . ' of ' . $total : 'Done')); }
/** * Remove complete category */ public function delete($sync = true) { // This should be the correct diff value each time $diff = 2; // Resync tree $sql = 'UPDATE ' . $this->sql_table . "\n\t\t\tSET right_id = right_id - {$diff}\n\t\t\tWHERE left_id < {$this->right_id} AND right_id > {$this->right_id}"; phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . $this->sql_table . "\n\t\t\tSET left_id = left_id - {$diff}, right_id = right_id - {$diff}\n\t\t\tWHERE left_id > {$this->right_id}"; phpbb::$db->sql_query($sql); // Delete content $sql = 'DELETE FROM ' . TITANIA_CONTRIB_IN_CATEGORIES_TABLE . ' WHERE category_id = ' . $this->category_id; phpbb::$db->sql_query($sql); // Delete self parent::delete(); // Resync counters if ($sync) { $sync = new titania_sync(); $sync->categories('count'); } // Destroy category cache $this->destroy_cache(); }
while ($row = phpbb::$db->sql_fetchrow($result)) { foreach ($versions as $data) { $sql_ary[] = array('contrib_id' => $row['contrib_id'], 'revision_id' => $row['revision_id'], 'phpbb_version_branch' => $data[0], 'phpbb_version_revision' => get_real_revision_version($data[1]), 'revision_validated' => $row['revision_validated']); } } phpbb::$db->sql_freeresult($result); phpbb::$db->sql_multi_insert(TITANIA_REVISIONS_PHPBB_TABLE, $sql_ary); $display_message = 'Smilies, Avatars, Ranks, Styles Misc support the latest phpBB'; break; case 7: $sync = new titania_sync(); $sync->authors('count'); $display_message = 'Authors'; break; case 8: $sync = new titania_sync(); $sync->contribs('validated'); $sync->categories('count'); $display_message = 'Syncing'; break; case 9: phpbb::$cache->purge(); trigger_error('Ariel Conversion Finished!'); break; } if ($start + $limit >= $total) { // Move to the next step $next = append_sid(TITANIA_ROOT . 'ariel_convert.' . PHP_EXT, 'step=' . ++$step); $display_message .= '...done!'; } else { // Still more to do
function titania_custom($action, $version) { switch ($action) { case 'install': switch ($version) { case '0.1.40': titania_tags(); titania_categories(); break; } break; case 'update': switch ($version) { case '0.1.34': $sync = new titania_sync(); $sync->topics('post_count'); break; case '0.1.37': $sync = new titania_sync(); $sync->queue('revision_queue_id'); break; case '0.1.47': $sync = new titania_sync(); $sync->topics('queue_discussion_category'); break; case '0.1.49': $sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . ' SET topic_sticky = 1 WHERE topic_type = ' . TITANIA_QUEUE_DISCUSSION; phpbb::$db->sql_query($sql); break; case '0.1.53': $sql_ary = array(); $sql = 'SELECT contrib_id, revision_id, phpbb_version FROM ' . TITANIA_REVISIONS_TABLE; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { $sql_ary[] = array('revision_id' => $row['revision_id'], 'contrib_id' => $row['contrib_id'], 'phpbb_version_branch' => $row['phpbb_version'][0] . $row['phpbb_version'][2], 'phpbb_version_revision' => get_real_revision_version(substr($row['phpbb_version'], 4))); } phpbb::$db->sql_freeresult($result); phpbb::$db->sql_multi_insert(TITANIA_REVISIONS_PHPBB_TABLE, $sql_ary); break; case '0.1.55': $validated = array(); $sql = 'SELECT revision_id FROM ' . TITANIA_REVISIONS_TABLE . ' WHERE revision_validated = 1'; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { $validated[] = $row['revision_id']; } phpbb::$db->sql_freeresult($result); if (sizeof($validated)) { $sql = 'UPDATE ' . TITANIA_REVISIONS_PHPBB_TABLE . ' SET revision_validated = 1 WHERE ' . phpbb::$db->sql_in_set('revision_id', $validated); phpbb::$db->sql_query($sql); } break; case '0.3.2': $update = array(); // Reset the status $sql = 'UPDATE ' . TITANIA_REVISIONS_TABLE . ' SET revision_status = 0'; phpbb::$db->sql_query($sql); $sql = 'SELECT r.revision_id, q.queue_status FROM ' . TITANIA_REVISIONS_TABLE . ' r, ' . TITANIA_QUEUE_TABLE . ' q WHERE q.revision_id = r.revision_id'; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { switch ($row['queue_status']) { case TITANIA_QUEUE_DENIED: $update[TITANIA_REVISION_DENIED][] = $row['revision_id']; break; case TITANIA_QUEUE_APPROVED: $update[TITANIA_REVISION_APPROVED][] = $row['revision_id']; break; case TITANIA_QUEUE_NEW: $update[TITANIA_REVISION_NEW][] = $row['revision_id']; break; } } phpbb::$db->sql_freeresult($result); foreach ($update as $status => $revision_ids) { $sql = 'UPDATE ' . TITANIA_REVISIONS_TABLE . ' SET revision_status = ' . (int) $status . ' WHERE ' . phpbb::$db->sql_in_set('revision_id', $revision_ids); phpbb::$db->sql_query($sql); } // Any that are left should be repacked $sql = 'UPDATE ' . TITANIA_REVISIONS_TABLE . ' SET revision_status = ' . TITANIA_REVISION_REPACKED . ' WHERE revision_status = 0'; phpbb::$db->sql_query($sql); break; case '0.3.3': titania_sync::contribs('faq_count'); break; } break; case 'uninstall': // Uninstall the types (prevent errors) foreach (titania_types::$types as $class) { $class->uninstall(); } titania_search::truncate(); break; } }