Skip to:
Content

bbPress.org

Changeset 1127


Ignore:
Timestamp:
02/28/2008 12:44:14 AM (18 years ago)
Author:
sambauers
Message:

Merge exporter improvements into 0.8 branch, small nomenclature change in install log output.

Location:
branches/0.8/bb-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/0.8/bb-admin/class-install.php

    r1078 r1127  
    13631363        $installation_log[] = '>>> ' . __('Site address (URL):') . ' ' . $data3['uri']['value'];
    13641364        bb_update_option('from_email', $data3['keymaster_user_email']['value']);
    1365         $installation_log[] = '>>> ' . __('Admin email address:') . ' ' . $data3['keymaster_user_email']['value'];
     1365        $installation_log[] = '>>> ' . __('From email address:') . ' ' . $data3['keymaster_user_email']['value'];
    13661366       
    13671367        // Create the key master
  • branches/0.8/bb-admin/export.php

    r1078 r1127  
    11<?php
    2 die('No thieving allowed.');
    32
    43require_once('../bb-load.php');
    54require_once('admin-functions.php');
    65
    7 if ( !bb_current_user_can( 'use_keys' ) )
     6define('BB_EXPORT_USERS', 1);
     7define('BB_EXPORT_FORUMS', 2);
     8define('BB_EXPORT_TOPICS', 4);
     9
     10// Some example usage of the bitwise export levels (can be defined in bb-config.php)
     11//define('BB_EXPORT_LEVEL', BB_EXPORT_USERS);
     12//define('BB_EXPORT_LEVEL', BB_EXPORT_USERS + BB_EXPORT_FORUMS);
     13//define('BB_EXPORT_LEVEL', BB_EXPORT_USERS + BB_EXPORT_FORUMS + BB_EXPORT_TOPICS);
     14
     15if ( !defined('BB_EXPORT_LEVEL') )
     16    define('BB_EXPORT_LEVEL', 0);
     17
     18if ( !BB_EXPORT_LEVEL || !bb_current_user_can( 'use_keys' ) )
    819    bb_die( __('No thieving allowed.') );
    920
     
    5566    $r = array();
    5667    foreach ( $translate as $prop => $export ) {
    57         if ( '?' == $export{0} && !$data[$prop] || false === $export ) {
     68        if ( '?' == $export{0} ) {
     69            $export = substr($export, 1);
     70            if ( !$data[$prop] ) {
     71                unset($data[$prop]);
     72                continue;
     73            }
     74        }
     75        if ( false === $export ) {
    5876            unset($data[$prop]);
    59             $export = substr($export, 1);
    6077            continue;
    6178        }
     
    116133
    117134    $translate = array(
    118         'forum_name' => '!title',
    119         'forum_desc' => '?!content'
     135        'forum_name'   => '!title',
     136        'forum_desc'   => '?!content',
     137        'forum_parent' => '?parent'
    120138    );
    121139
     
    247265    echo "<forums-data version='0.75'>\n";
    248266
    249     $page = 1;
    250     while ( ( $users = bb_user_search( array('page' => $page++) ) ) && !is_wp_error( $users ) ) {
    251         foreach ( $users as $user )
    252             echo bb_export_user( $user->ID );
    253         $bb_user_cache = array(); // For the sake of memory
    254     }
    255     unset($users, $user_ids, $user_id);
    256 
    257     $forums = get_forums();
    258     foreach ( $forums as $forum )
    259         echo bb_export_forum( $forum->forum_id );
    260     unset($forums, $forum);
    261 
    262     $page = 1;
    263     while ( false && $topics = get_latest_topics( 0, $page++ ) ) {
    264         foreach ( $topics as $topic )
    265             echo bb_export_topic( $topic->topic_id );
    266         $bb_topic_cache = array();
    267     }
    268     unset($topics, $topic, $page);
     267    if (BB_EXPORT_LEVEL & BB_EXPORT_USERS) {
     268        $page = 1;
     269        while ( ( $users = bb_user_search( array('page' => $page++) ) ) && !is_wp_error( $users ) ) {
     270            foreach ( $users as $user )
     271                echo bb_export_user( $user->ID );
     272            $bb_user_cache = array(); // For the sake of memory
     273        }
     274        unset($users, $user_ids, $user_id, $page);
     275    }
     276
     277    if (BB_EXPORT_LEVEL & BB_EXPORT_FORUMS) {
     278        $forums = get_forums();
     279        foreach ( $forums as $forum )
     280            echo bb_export_forum( $forum->forum_id );
     281        unset($forums, $forum);
     282    }
     283
     284    if (BB_EXPORT_LEVEL & BB_EXPORT_TOPICS) {
     285        $page = 1;
     286        while ( $topics = get_latest_topics( 0, $page++ ) ) {
     287            foreach ( $topics as $topic )
     288                echo bb_export_topic( $topic->topic_id );
     289            $bb_topic_cache = array();
     290        }
     291        unset($topics, $topic, $page);
     292    }
    269293
    270294    do_action( 'bb_export' );
Note: See TracChangeset for help on using the changeset viewer.