当前位置: 首页>>代码示例>>PHP>>正文


PHP populate_options函数代码示例

本文整理汇总了PHP中populate_options函数的典型用法代码示例。如果您正苦于以下问题:PHP populate_options函数的具体用法?PHP populate_options怎么用?PHP populate_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了populate_options函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upgrade_all

function upgrade_all()
{
    global $wp_current_db_version, $wp_db_version, $wp_rewrite;
    $wp_current_db_version = __get_option('db_version');
    // We are up-to-date.  Nothing to do.
    if ($wp_db_version == $wp_current_db_version) {
        return;
    }
    // If the version is not set in the DB, try to guess the version.
    if (empty($wp_current_db_version)) {
        $wp_current_db_version = 0;
        // If the template option exists, we have 1.5.
        $template = __get_option('template');
        if (!empty($template)) {
            $wp_current_db_version = 2541;
        }
    }
    populate_options();
    if ($wp_current_db_version < 2541) {
        upgrade_100();
        upgrade_101();
        upgrade_110();
        upgrade_130();
    }
    if ($wp_current_db_version < 3308) {
        upgrade_160();
    }
    $wp_rewrite->flush_rules();
    update_option('db_version', $wp_db_version);
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:30,代码来源:upgrade-functions.php

示例2: wp_install

function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '')
{
    global $wpdb;
    $base = '/';
    $domain = JQUERY_STAGING_PREFIX . 'jquery.com';
    wp_check_mysql_version();
    wp_cache_flush();
    make_db_current_silent();
    populate_options();
    populate_roles();
    $user_id = wp_create_user($user_name, trim($user_password), $user_email);
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    $guess_url = wp_guess_url();
    foreach ($wpdb->tables('ms_global') as $table => $prefixed_table) {
        $wpdb->{$table} = $prefixed_table;
    }
    install_network();
    populate_network(1, $domain, $user_email, 'jQuery Network', $base, false);
    update_site_option('site_admins', array($user->user_login));
    update_site_option('allowedthemes', array());
    $wpdb->insert($wpdb->blogs, array('site_id' => 1, 'domain' => $domain, 'path' => $base, 'registered' => current_time('mysql')));
    $blog_id = $wpdb->insert_id;
    update_user_meta($user_id, 'source_domain', $domain);
    update_user_meta($user_id, 'primary_blog', $blog_id);
    if (!($upload_path = get_option('upload_path'))) {
        $upload_path = substr(WP_CONTENT_DIR, strlen(ABSPATH)) . '/uploads';
        update_option('upload_path', $upload_path);
    }
    update_option('fileupload_url', get_option('siteurl') . '/' . $upload_path);
    jquery_install_remaining_sites($user);
    wp_new_blog_notification($blog_title, $guess_url, $user_id, $message = __('The password you chose during the install.'));
    wp_cache_flush();
    return array('url' => $guess_url, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
}
开发者ID:ravasthi,项目名称:web-base-template,代码行数:35,代码来源:install.php

示例3: upgrade_all

function upgrade_all() {
	populate_options();
	upgrade_100();
	upgrade_101();
	upgrade_110();
	upgrade_130();
	save_mod_rewrite_rules();
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:8,代码来源:upgrade-functions.php

示例4: db_reset_install

/**
 * Installs the site.
 *
 * This is a copied and pasted version from /wp-admin/includes/upgrade.php.
 * Why am I doing this? Because there's no way of hooking into the WP install
 * method to stop the 'new blog' email from firing.
 *
 * Also, through the command line, the call to wp_guess_url() doesn't work
 * and returns an empty value. We must pass the siteurl option to this
 * function in order to be able to reset the options table without it
 * completely breaking the site.
 *
 * @since 2.1.0
 *
 * @param string $blog_title    Blog title.
 * @param string $user_name     User's username.
 * @param string $user_email    User's email.
 * @param bool   $public        Whether blog is public.
 * @param string $deprecated    Optional. Not used.
 * @param string $user_password Optional. User's chosen password. Default empty (random password).
 * @param string $language      Optional. Language chosen. Default empty.
 * @return array Array keys 'url', 'user_id', 'password', and 'password_message'.
 */
function db_reset_install($blog_title, $user_name, $user_email, $public, $site_url, $deprecated = '', $user_password = '', $language = '')
{
    if (!empty($deprecated)) {
        _deprecated_argument(__FUNCTION__, '2.6');
    }
    wp_check_mysql_version();
    wp_cache_flush();
    make_db_current_silent();
    populate_options();
    populate_roles();
    update_option('blogname', $blog_title);
    update_option('admin_email', $user_email);
    update_option('blog_public', $public);
    if ($language) {
        update_option('WPLANG', $language);
    }
    $guessurl = wp_guess_url() !== 'http:' ? wp_guess_url() : $site_url;
    update_option('siteurl', $guessurl);
    update_option('home', $guessurl);
    // If not a public blog, don't ping.
    if (!$public) {
        update_option('default_pingback_flag', 0);
    }
    /*
     * Create default user. If the user already exists, the user tables are
     * being shared among blogs. Just set the role in that case.
     */
    $user_id = username_exists($user_name);
    $user_password = trim($user_password);
    $email_password = false;
    if (!$user_id && empty($user_password)) {
        $user_password = wp_generate_password(12, false);
        $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
        $user_id = wp_create_user($user_name, $user_password, $user_email);
        $email_password = true;
    } elseif (!$user_id) {
        // Password has been provided
        $message = '<em>' . __('Your chosen password.') . '</em>';
        $user_id = wp_create_user($user_name, $user_password, $user_email);
    } else {
        $message = __('User already exists. Password inherited.');
    }
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    wp_install_defaults($user_id);
    wp_install_maybe_enable_pretty_permalinks();
    flush_rewrite_rules();
    wp_cache_flush();
    /**
     * Fires after a site is fully installed.
     *
     * @since 3.9.0
     *
     * @param WP_User $user The site owner.
     */
    do_action('wp_install', $user);
    return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
}
开发者ID:brianjking,项目名称:wordpress-database-reset,代码行数:81,代码来源:helpers.php

示例5: upgrade_all

function upgrade_all()
{
    populate_options();
    //在admin-schema.php中
    upgrade_100();
    upgrade_101();
    upgrade_110();
    upgrade_130();
    save_mod_rewrite_rules();
}
开发者ID:johnwonder,项目名称:WordPressLearn,代码行数:10,代码来源:upgrade-functions.php

示例6: wp_install

/**
 * This function overrides wp_install() in wp-admin/includes/upgrade.php
 */
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '')
{
    if (!empty($deprecated)) {
        _deprecated_argument(__FUNCTION__, '2.6');
    }
    wp_check_mysql_version();
    wp_cache_flush();
    /* changes */
    require_once PDODIR . 'schema.php';
    make_db_sqlite();
    /* changes */
    populate_options();
    populate_roles();
    update_option('blogname', $blog_title);
    update_option('admin_email', $user_email);
    update_option('blog_public', $public);
    $guessurl = wp_guess_url();
    update_option('siteurl', $guessurl);
    if (!$public) {
        update_option('default_pingback_flag', 0);
    }
    $user_id = username_exists($user_name);
    $user_password = trim($user_password);
    $email_password = false;
    if (!$user_id && empty($user_password)) {
        $user_password = wp_generate_password(12, false);
        $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
        $user_id = wp_create_user($user_name, $user_password, $user_email);
        update_user_option($user_id, 'default_password_nag', true, true);
        $email_password = true;
    } else {
        if (!$user_id) {
            $message = '<em>' . __('Your chosen password.') . '</em>';
            $user_id = wp_create_user($user_name, $user_password, $user_email);
        }
    }
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    wp_install_defaults($user_id);
    flush_rewrite_rules();
    wp_new_blog_notification($blog_title, $guessurl, $user_id, $email_password ? $user_password : __('The password you chose during the install.'));
    wp_cache_flush();
    if (isset($_SERVER['SERVER_SOFTWARE']) && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false || isset($_SERVER['SERVER_SIGNATURE']) && stripos($_SERVER['SERVER_SIGNATURE'], 'apache') !== false) {
        // Your server is Apache. Nothing to do more.
    } else {
        $server_message = sprintf('Your webserver doesn\'t seem to be Apache. So the database directory access restriction by the .htaccess file may not function. We strongly recommend that you should restrict the access to the directory %s in some other way.', FQDBDIR);
        echo '<div style="position: absolute; margin-top: 350px; width: 700px; border: .5px dashed rgb(0, 0, 0);"><p style="margin: 10px;">';
        echo $server_message;
        echo '</p></div>';
    }
    return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
}
开发者ID:pthiep,项目名称:pthiepwordpress,代码行数:55,代码来源:install.php

示例7: wp_install

/**
 * this function overrides the built in wordpress  variant
 * 
 * @param object $blog_title
 * @param object $user_name
 * @param object $user_email
 * @param object $public
 * @param object $deprecated [optional]
 * @return 
 */
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '')
{
    global $wp_rewrite, $wpdb;
    //wp_check_mysql_version();
    wp_cache_flush();
    /**** changes start here ***/
    switch (DB_TYPE) {
        case 'sqlite':
            require PDODIR . '/driver_sqlite/schema.php';
            installdb();
            break;
        case 'mysql':
            make_db_current_silent();
            break;
    }
    /**** changes end ***/
    $wpdb->suppress_errors();
    populate_options();
    populate_roles();
    update_option('blogname', $blog_title);
    update_option('admin_email', $user_email);
    update_option('blog_public', $public);
    $guessurl = wp_guess_url();
    update_option('siteurl', $guessurl);
    // If not a public blog, don't ping.
    if (!$public) {
        update_option('default_pingback_flag', 0);
    }
    // Create default user.  If the user already exists, the user tables are
    // being shared among blogs.  Just set the role in that case.
    $user_id = username_exists($user_name);
    if (!$user_id) {
        $random_password = wp_generate_password();
        $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.<br><br>���' . $random_password);
        $user_id = wp_create_user($user_name, $random_password, $user_email);
        update_usermeta($user_id, 'default_password_nag', true);
    } else {
        $random_password = '';
        $message = __('User already exists.  Password inherited.');
    }
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    wp_install_defaults($user_id);
    $wp_rewrite->flush_rules();
    wp_new_blog_notification($blog_title, $guessurl, $user_id, $random_password);
    wp_cache_flush();
    return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $random_password, 'password_message' => $message);
}
开发者ID:nottrobin,项目名称:blog.robinwinslow.co.uk,代码行数:58,代码来源:wp_install.php

示例8: wp_install

/**
 * This function overrides wp_install() in wp-admin/includes/upgrade.php
 */
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '')
{
    if (!empty($deprecated)) {
        _deprecated_argument(__FUNCTION__, '2.6');
    }
    wp_check_mysql_version();
    wp_cache_flush();
    /* changes */
    require_once PDODIR . 'schema.php';
    make_db_sqlite();
    /* changes */
    populate_options();
    populate_roles();
    update_option('blogname', $blog_title);
    update_option('admin_email', $user_email);
    update_option('blog_public', $public);
    $guessurl = wp_guess_url();
    update_option('siteurl', $guessurl);
    if (!$public) {
        update_option('default_pingback_flag', 0);
    }
    $user_id = username_exists($user_name);
    $user_password = trim($user_password);
    $email_password = false;
    if (!$user_id && empty($user_password)) {
        $user_password = wp_generate_password(12, false);
        $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
        $user_id = wp_create_user($user_name, $user_password, $user_email);
        update_user_option($user_id, 'default_password_nag', true, true);
        $email_password = true;
    } else {
        if (!$user_id) {
            $message = '<em>' . __('Your chosen password.') . '</em>';
            $user_id = wp_create_user($user_name, $user_password, $user_email);
        }
    }
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    wp_install_defaults($user_id);
    flush_rewrite_rules();
    wp_new_blog_notification($blog_title, $guessurl, $user_id, $email_password ? $user_password : __('The password you chose during the install.'));
    wp_cache_flush();
    if (isset($_SERVER['SERVER_SOFTWARE']) && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false || isset($_SERVER['SERVER_SIGNATURE']) && stripos($_SERVER['SERVER_SIGNATURE'], 'apache') !== false) {
        // Your server is Apache. Nothing to do more.
    }
    return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
}
开发者ID:daniel-marklund,项目名称:sqlite-plugin-wordpress,代码行数:50,代码来源:install.php

示例9: upgrade_all

/**
 * Functions to be called in install and upgrade scripts.
 *
 * Contains conditional checks to determine which upgrade scripts to run,
 * based on database version and WP version being updated-to.
 *
 * @since 1.0.1
 *
 * @return null If no update is necessary, null.
 */
function upgrade_all()
{
    global $wp_current_db_version, $wp_db_version;
    $wp_current_db_version = __get_option('db_version');
    // We are up-to-date. Nothing to do.
    if ($wp_db_version == $wp_current_db_version) {
        return;
    }
    // If the version is not set in the DB, try to guess the version.
    if (empty($wp_current_db_version)) {
        $wp_current_db_version = 0;
        // If the template option exists, we have 1.5.
        $template = __get_option('template');
        if (!empty($template)) {
            $wp_current_db_version = 2541;
        }
    }
    if ($wp_current_db_version < 6039) {
        upgrade_230_options_table();
    }
    populate_options();
    if ($wp_current_db_version < 2541) {
        upgrade_100();
        upgrade_101();
        upgrade_110();
        upgrade_130();
    }
    if ($wp_current_db_version < 3308) {
        upgrade_160();
    }
    if ($wp_current_db_version < 4772) {
        upgrade_210();
    }
    if ($wp_current_db_version < 4351) {
        upgrade_old_slugs();
    }
    if ($wp_current_db_version < 5539) {
        upgrade_230();
    }
    if ($wp_current_db_version < 6124) {
        upgrade_230_old_tables();
    }
    if ($wp_current_db_version < 7499) {
        upgrade_250();
    }
    if ($wp_current_db_version < 7935) {
        upgrade_252();
    }
    if ($wp_current_db_version < 8201) {
        upgrade_260();
    }
    if ($wp_current_db_version < 8989) {
        upgrade_270();
    }
    if ($wp_current_db_version < 10360) {
        upgrade_280();
    }
    if ($wp_current_db_version < 11958) {
        upgrade_290();
    }
    if ($wp_current_db_version < 15260) {
        upgrade_300();
    }
    if ($wp_current_db_version < 19389) {
        upgrade_330();
    }
    if ($wp_current_db_version < 20080) {
        upgrade_340();
    }
    if ($wp_current_db_version < 22422) {
        upgrade_350();
    }
    if ($wp_current_db_version < 25824) {
        upgrade_370();
    }
    if ($wp_current_db_version < 26148) {
        upgrade_372();
    }
    if ($wp_current_db_version < 26691) {
        upgrade_380();
    }
    if ($wp_current_db_version < 29630) {
        upgrade_400();
    }
    // Don't harsh my mellow. upgrade_422() must be called before
    // upgrade_420() to catch bad comments prior to any auto-expansion of
    // MySQL column widths.
    if ($wp_current_db_version < 31534) {
        upgrade_422();
    }
//.........这里部分代码省略.........
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:101,代码来源:upgrade.php

示例10: xpress_oninstall_base

 function xpress_oninstall_base($module, $mydirname)
 {
     // transations on module install
     global $ret;
     // TODO :-D
     // for Cube 2.1
     if (defined('XOOPS_CUBE_LEGACY')) {
         $root =& XCube_Root::getSingleton();
         $root->mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.' . ucfirst($mydirname) . '.Success', 'xpress_message_append_oninstall');
         $root->mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.' . ucfirst($mydirname) . '.Fail', 'xpress_message_append_oninstall_err');
         $ret = array();
     } else {
         if (!is_array($ret)) {
             $ret = array();
         }
     }
     $db =& Database::getInstance();
     $mid = $module->getVar('mid');
     if (defined('XOOPS_CUBE_LEGACY')) {
         $ret[] = "********************************* Install Log ********************************<br />";
     } else {
         $ret[] = '<h4 style="border-bottom: 1px dashed rgb(0, 0, 0); text-align: left; margin-bottom: 0px;">Install Log</h4>';
     }
     //xpress
     global $wpdb, $wp_rewrite, $wp_queries, $table_prefix, $wp_db_version, $wp_roles, $wp_query, $wp_embed;
     global $xoops_config;
     define("WP_INSTALLING", true);
     define('WP_FIRST_INSTALL', true);
     // For WPMU2.8
     $site_url = XOOPS_URL . "/modules/" . $mydirname;
     $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
     $path = $mydirpath . '/';
     $site_name = ucfirst($mydirname) . ' ' . _MI_XP2_NAME;
     // permission and wordpress files check
     require_once $path . 'include/pre_check.php';
     if (!xp_permission_check($mydirname, $mydirpath)) {
         if (!defined('XOOPS_CUBE_LEGACY')) {
             $ret = $GLOBALS["err_log"];
             $ret[] = "<br /><span style=\"color:#ff0000;\">The uninstallation of the module is executed now. </span><br />";
             $ret[] = xoops_module_uninstall($mydirname);
         }
         return false;
     }
     // install WordPress
     if (file_exists($path . 'wp-load.php')) {
         require_once $path . 'wp-load.php';
     } else {
         require_once $path . 'wp-config.php';
     }
     include_once $mydirpath . '/wp-admin/upgrade-functions.php';
     wp_cache_flush();
     make_db_current_silent();
     $ret[] = "The data base of wordpress was made by prefix {$table_prefix}.<br />";
     $option_desc = __('WordPress web address');
     $wpdb->query("INSERT INTO {$wpdb->options} (blog_id, option_name,option_value, autoload) VALUES ('0', 'siteurl','{$site_url}', 'yes')");
     $wpdb->query("INSERT INTO {$wpdb->options} (blog_id, option_name,option_value, autoload) VALUES ('0', 'home','{$site_url}', 'yes')");
     populate_options();
     populate_roles();
     // create XPressME table
     $xp_prefix = preg_replace('/wordpress/', 'wp', $mydirname);
     $views_table = XOOPS_DB_PREFIX . '_' . $xp_prefix . '_views';
     $charset_collate = '';
     if (version_compare(mysql_get_server_info(), '4.1.0', '>=')) {
         if (!empty($wpdb->charset)) {
             $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
         }
         if (!empty($wpdb->collate)) {
             $charset_collate .= " COLLATE {$wpdb->collate}";
         }
     }
     $views_queries = "CREATE TABLE {$views_table} (\n  \t\tblog_id bigint(20) unsigned NOT NULL default '0',\n  \t\tpost_id bigint(20) unsigned NOT NULL default '0',\n  \t\tpost_views bigint(20) unsigned NOT NULL default '0',\n  \t\tKEY post_id (post_id)\n\t\t){$charset_collate};";
     dbDelta($views_queries);
     $ret[] = "{$views_table} table of XPressME was made.<br />";
     $d3forum_link = XOOPS_DB_PREFIX . '_' . $xp_prefix . '_d3forum_link';
     $views_queries = "CREATE TABLE {$d3forum_link} (\n  \t\tcomment_ID bigint(20) unsigned NOT NULL default '0',\n  \t\tpost_id int(10) unsigned NOT NULL default '0' ,\n  \t\twp_post_ID bigint(20) unsigned NOT NULL default '0',\n  \t\tforum_id bigint(20) unsigned NOT NULL default '0',\n  \t\tblog_id bigint(20) unsigned NOT NULL default '0',\n  \t\tKEY post_id (post_id)\n\t\t){$charset_collate};";
     dbDelta($views_queries);
     $ret[] = "{$d3forum_link} table of XPressME was made.<br />";
     $group_role = XOOPS_DB_PREFIX . '_' . $xp_prefix . '_group_role';
     $views_queries = "CREATE TABLE {$group_role} (\n  \t\tgroupid smallint(5) unsigned NOT NULL default '0',\n  \t\tblog_id bigint(20) unsigned NOT NULL default '0',\n  \t\tname varchar(50)  NOT NULL default '' ,\n  \t\tdescription text  NOT NULL default '',\n  \t\tgroup_type varchar(50)  NOT NULL default '' ,\n\t\trole varchar(20)  NOT NULL default '' ,\n\t\tlogin_all smallint(5) unsigned NOT NULL default '0' ,\n  \t\tKEY groupid (groupid)\n\t\t){$charset_collate};";
     dbDelta($views_queries);
     $ret[] = "{$group_role} table of XPressME was made.<br />";
     $notify_reserve = XOOPS_DB_PREFIX . '_' . $xp_prefix . '_notify_reserve';
     $queries = "CREATE TABLE {$notify_reserve} (\n  \t\tnotify_reserve_id bigint(20) NOT NULL AUTO_INCREMENT ,\n  \t\tnotify_reserve_status varchar(20)  NOT NULL default '' ,\n  \t\tcategory text  NOT NULL default '',\n  \t\titem_id bigint(20) unsigned NOT NULL default '0',\n\t\tevent varchar(20) NOT NULL default '',\n\t\textra_tags_arry longtext NOT NULL default '' ,\n\t\tuser_list_arry longtext NOT NULL default '' ,\n  \t\tmodule_id smallint(5) unsigned NOT NULL default '0' ,\n  \t\tomit_user_id varchar(20) NOT NULL default '' ,\n  \t\tKEY notify_reserve_id (notify_reserve_id)\n\t\t)ENGINE=MyISAM";
     dbDelta($queries);
     $ret[] = "{$notify_reserve} table of XPressME was made.<br />";
     $sql = "INSERT INTO {$group_role} (groupid, role) VALUES (1, 'administrator')";
     $wpdb->query($sql);
     // make templates
     include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/xpress_templates_make.php';
     $t_mess = xpress_templates_make($mid, $mydirname);
     // Admin User Data write
     // Change uid field
     $wpdb->query("ALTER TABLE {$wpdb->posts} CHANGE `post_author` `post_author` mediumint(8) NOT NULL DEFAULT '0'");
     $user_name = is_object($GLOBALS["xoopsUser"]) ? $GLOBALS["xoopsUser"]->getVar("uname") : 'admin';
     $email = is_object($GLOBALS["xoopsUser"]) ? $GLOBALS["xoopsUser"]->getVar("email") : 'foo@exsample.com';
     $pass_md5 = is_object($GLOBALS["xoopsUser"]) ? $GLOBALS["xoopsUser"]->getVar("pass") : '';
     add_filter('sanitize_user', "sanitize_user_multibyte", 10, 3);
     if (!function_exists('username_exists')) {
         require_once $mydirpath . '/wp-includes/registration-functions.php';
     }
//.........这里部分代码省略.........
开发者ID:nouphet,项目名称:rata,代码行数:101,代码来源:oninstall.php

示例11: install_blog

/**
 * Install an empty blog.
 *
 * Creates the new blog tables and options. If calling this function
 * directly, be sure to use switch_to_blog() first, so that $wpdb
 * points to the new blog.
 *
 * @since MU
 *
 * @global wpdb     $wpdb
 * @global WP_Roles $wp_roles
 *
 * @param int    $blog_id    The value returned by insert_blog().
 * @param string $blog_title The title of the new site.
 */
function install_blog($blog_id, $blog_title = '')
{
    global $wpdb, $wp_roles, $current_site;
    // Cast for security
    $blog_id = (int) $blog_id;
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    $suppress = $wpdb->suppress_errors();
    if ($wpdb->get_results("DESCRIBE {$wpdb->posts}")) {
        die('<h1>' . __('Already Installed') . '</h1><p>' . __('You appear to have already installed WordPress. To reinstall please clear your old database tables first.') . '</p></body></html>');
    }
    $wpdb->suppress_errors($suppress);
    $url = get_blogaddress_by_id($blog_id);
    // Set everything up
    make_db_current_silent('blog');
    populate_options();
    populate_roles();
    // populate_roles() clears previous role definitions so we start over.
    $wp_roles = new WP_Roles();
    $siteurl = $home = untrailingslashit($url);
    if (!is_subdomain_install()) {
        if ('https' === parse_url(get_network_option('siteurl'), PHP_URL_SCHEME)) {
            $siteurl = set_url_scheme($siteurl, 'https');
        }
        if ('https' === parse_url(get_home_url($current_site->blog_id), PHP_URL_SCHEME)) {
            $home = set_url_scheme($home, 'https');
        }
    }
    update_option('siteurl', $siteurl);
    update_option('home', $home);
    if (get_site_option('ms_files_rewriting')) {
        update_option('upload_path', UPLOADBLOGSDIR . "/{$blog_id}/files");
    } else {
        update_option('upload_path', get_blog_option(get_current_site()->blog_id, 'upload_path'));
    }
    update_option('blogname', wp_unslash($blog_title));
    update_option('admin_email', '');
    // remove all perms
    $table_prefix = $wpdb->get_blog_prefix();
    delete_metadata('user', 0, $table_prefix . 'user_level', null, true);
    // delete all
    delete_metadata('user', 0, $table_prefix . 'capabilities', null, true);
    // delete all
}
开发者ID:Jitsufreak,项目名称:PJ,代码行数:58,代码来源:ms-functions.php

示例12: flush

</form>

<?php
	break;
	case 2:
?>
<h1>Second Step</h1>
<p>Now we&#8217;re going to create the database tables and fill them with some default data.</p>


<?php
flush();

// Set everything up
make_db_current_silent();
populate_options();

// Fill in the data we gathered
$weblog_title = addslashes(stripslashes(stripslashes($_POST['weblog_title'])));
$admin_email = addslashes(stripslashes(stripslashes($_POST['admin_email'])));

$wpdb->query("UPDATE $wpdb->options SET option_value = '$weblog_title' WHERE option_name = 'blogname'");
$wpdb->query("UPDATE $wpdb->options SET option_value = '$admin_email' WHERE option_name = 'admin_email'");

// Now drop in some default links
$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'Blogroll')");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://blog.carthik.net/index.php', 'Carthik', 1, 'http://blog.carthik.net/feed/');");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://blogs.linux.ie/xeer/', 'Donncha', 1, 'http://blogs.linux.ie/xeer/feed/');");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://zengun.org/weblog/', 'Michel', 1, 'http://zengun.org/weblog/feed/');");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://boren.nu/', 'Ryan', 1, 'http://boren.nu/feed/');");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://photomatt.net/', 'Matt', 1, 'http://xml.photomatt.net/feed/');");
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:install.php

示例13: upgrade_all

/**
 * Functions to be called in install and upgrade scripts.
 *
 * Contains conditional checks to determine which upgrade scripts to run,
 * based on database version and WP version being updated-to.
 *
 * @ignore
 * @since 1.0.1
 *
 * @global int $wp_current_db_version
 * @global int $wp_db_version
 */
function upgrade_all()
{
    global $wp_current_db_version, $wp_db_version;
    $wp_current_db_version = __get_option('db_version');
    // We are up-to-date. Nothing to do.
    if ($wp_db_version == $wp_current_db_version) {
        return;
    }
    // If the version is not set in the DB, try to guess the version.
    if (empty($wp_current_db_version)) {
        $wp_current_db_version = 0;
        // If the template option exists, we have 1.5.
        $template = __get_option('template');
        if (!empty($template)) {
            $wp_current_db_version = 2541;
        }
    }
    if ($wp_current_db_version < 6039) {
        upgrade_230_options_table();
    }
    populate_options();
    if ($wp_current_db_version < 2541) {
        upgrade_100();
        upgrade_101();
        upgrade_110();
        upgrade_130();
    }
    if ($wp_current_db_version < 3308) {
        upgrade_160();
    }
    if ($wp_current_db_version < 4772) {
        upgrade_210();
    }
    if ($wp_current_db_version < 4351) {
        upgrade_old_slugs();
    }
    if ($wp_current_db_version < 5539) {
        upgrade_230();
    }
    if ($wp_current_db_version < 6124) {
        upgrade_230_old_tables();
    }
    if ($wp_current_db_version < 7499) {
        upgrade_250();
    }
    if ($wp_current_db_version < 7935) {
        upgrade_252();
    }
    if ($wp_current_db_version < 8201) {
        upgrade_260();
    }
    if ($wp_current_db_version < 8989) {
        upgrade_270();
    }
    if ($wp_current_db_version < 10360) {
        upgrade_280();
    }
    if ($wp_current_db_version < 11958) {
        upgrade_290();
    }
    if ($wp_current_db_version < 15260) {
        upgrade_300();
    }
    if ($wp_current_db_version < 19389) {
        upgrade_330();
    }
    if ($wp_current_db_version < 20080) {
        upgrade_340();
    }
    if ($wp_current_db_version < 22422) {
        upgrade_350();
    }
    if ($wp_current_db_version < 25824) {
        upgrade_370();
    }
    if ($wp_current_db_version < 26148) {
        upgrade_372();
    }
    if ($wp_current_db_version < 26691) {
        upgrade_380();
    }
    if ($wp_current_db_version < 29630) {
        upgrade_400();
    }
    if ($wp_current_db_version < 33055) {
        upgrade_430();
    }
    if ($wp_current_db_version < 33056) {
//.........这里部分代码省略.........
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:101,代码来源:upgrade.php

示例14: install_blog

function install_blog($blog_id, $blog_title = '')
{
    global $wpdb, $table_prefix, $wp_roles;
    $wpdb->suppress_errors();
    // Cast for security
    $blog_id = (int) $blog_id;
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    if ($wpdb->get_results("SELECT ID FROM {$wpdb->posts}")) {
        die(__('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>') . '</body></html>');
    }
    $wpdb->suppress_errors(false);
    $url = get_blogaddress_by_id($blog_id);
    // Set everything up
    make_db_current_silent();
    populate_options();
    populate_roles();
    $wp_roles->_init();
    // fix url.
    update_option('siteurl', $url);
    update_option('home', $url);
    update_option('fileupload_url', $url . "files");
    update_option('upload_path', "wp-content/blogs.dir/" . $blog_id . "/files");
    update_option('blogname', $blog_title);
    update_option('admin_email', '');
    $wpdb->update($wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email'));
    // Default category
    $wpdb->insert($wpdb->terms, array('term_id' => 1, 'name' => __('Uncategorized'), 'slug' => sanitize_title(__('Uncategorized')), 'term_group' => 0));
    $wpdb->insert($wpdb->term_taxonomy, array('term_id' => 1, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
    // Default link category
    $cat_name = __('Blogroll');
    $cat_slug = sanitize_title($cat_name);
    $blogroll_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug));
    if ($blogroll_id == null) {
        $wpdb->insert($wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)));
        $blogroll_id = $wpdb->insert_id;
    }
    $wpdb->insert($wpdb->terms, array('term_id' => $blogroll_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0));
    $wpdb->insert($wpdb->term_taxonomy, array('term_id' => $blogroll_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 2));
    update_option('default_link_category', $blogroll_id);
    // remove all perms
    $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->usermeta} WHERE meta_key = %s", $table_prefix . 'user_level'));
    $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->usermeta} WHERE meta_key = %s", $table_prefix . 'capabilities'));
    $wpdb->suppress_errors(false);
}
开发者ID:joelglennwright,项目名称:agencypress,代码行数:44,代码来源:wpmu-functions.php

示例15: upgrade_all

/**
 * Functions to be called in install and upgrade scripts.
 *
 * Contains conditional checks to determine which upgrade scripts to run,
 * based on database version and WP version being updated-to.
 *
 * @since 1.0.1
 *
 * @global int $wp_current_db_version
 * @global int $wp_db_version
 */
function upgrade_all()
{
    global $wp_current_db_version, $wp_db_version;
    $wp_current_db_version = __get_option('db_version');
    // We are up-to-date. Nothing to do.
    if ($wp_db_version == $wp_current_db_version) {
        return;
    }
    if (empty($wp_current_db_version)) {
        $wp_current_db_version = 0;
    }
    populate_options();
    if ($wp_current_db_version < 25824) {
        upgrade_370();
    }
    if ($wp_current_db_version < 26148) {
        upgrade_372();
    }
    if ($wp_current_db_version < 26691) {
        upgrade_380();
    }
    if ($wp_current_db_version < 29630) {
        upgrade_400();
    }
    if ($wp_current_db_version < 30133) {
        upgrade_410();
    }
    if ($wp_current_db_version < 30134) {
        upgrade_410a();
    }
    if ($wp_current_db_version < 33055) {
        upgrade_430();
    }
    if ($wp_current_db_version < 33056) {
        upgrade_431();
    }
    if ($wp_current_db_version < 35700) {
        upgrade_440();
    }
    maybe_disable_link_manager();
    maybe_disable_automattic_widgets();
    update_option('db_version', $wp_db_version);
    update_option('db_upgraded', true);
}
开发者ID:leonardopires,项目名称:projectnami,代码行数:55,代码来源:upgrade.php


注:本文中的populate_options函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。