コード例 #1
0
function dbem_install()
{
    // Creates the events table if necessary
    dbem_create_events_table();
    dbem_create_recurrence_table();
    dbem_create_locations_table();
    dbem_create_bookings_table();
    dbem_create_people_table();
    dbem_add_options();
    /* Marcus Begin Edit */
    dbem_create_categories_table();
    /* Marcus End Edit */
    // if ANY 1.0 option is there  AND the version options hasn't been set yet THEN launch the updat script
    if (get_option('dbem_events_page') && !get_option('dbem_version')) {
        dbem_migrate_old_events();
    }
    update_option('dbem_version', 2);
    // Create events page if necessary
    $events_page_id = get_option('dbem_events_page');
    if ($events_page_id != "") {
        query_posts("page_id={$events_page_id}");
        $count = 0;
        while (have_posts()) {
            the_post();
            $count++;
        }
        if ($count == 0) {
            dbem_create_events_page();
        }
    } else {
        dbem_create_events_page();
    }
    // wp-content must be chmodded 777. Maybe just wp-content.
    if (!file_exists("../" . IMAGE_UPLOAD_DIR)) {
        mkdir("../" . IMAGE_UPLOAD_DIR, 0777);
    }
}
コード例 #2
0
function dbem_install()
{
    // Creates the events table if necessary
    $opts = dbem_add_options();
    //echo " in install ";
    dbem_create_events_table();
    dbem_create_recurrence_table();
    dbem_create_locations_table();
    dbem_create_bookings_table();
    dbem_create_people_table();
    /* Marcus Begin Edit */
    dbem_create_categories_table();
    /* Marcus End Edit */
    // if ANY 1.0 option is there  AND the version options hasn't been set yet THEN launch the updat script
    if (isset($opts['events_page']) && !isset($opts['version'])) {
        dbem_migrate_old_events();
    }
    //update_option('dbem_version', 2);
    $opts['version'] = 2.2;
    // Create events page if necessary
    if (isset($opts['events_page']) && $opts['events_page'] > 0) {
        query_posts("page_id=" . $opts['events_page']);
        $count = 0;
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                $count++;
            }
        }
        if ($count == 0) {
            $opts['events_page'] = dbem_create_events_page();
        }
    } else {
        $opts['events_page'] = dbem_create_events_page();
    }
    // wp-content must be chmodded 777. Maybe just wp-content.
    if (!file_exists("../" . IMAGE_UPLOAD_DIR)) {
        mkdir("../" . IMAGE_UPLOAD_DIR, 0777);
    }
    update_option('dbem', $opts);
}