• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP install_verify_settings函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: install_main

/**
 * The Drupal installation happens in a series of steps. We begin by verifying
 * that the current environment meets our minimum requirements. We then go
 * on to verify that settings.php is properly configured. From there we
 * connect to the configured database and verify that it meets our minimum
 * requirements. Finally we can allow the user to select an installation
 * profile and complete the installation process.
 *
 * @param $phase
 *   The installation phase we should proceed to.
 */
function install_main()
{
    require_once './includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
    // The user agent header is used to pass a database prefix in the request when
    // running tests. However, for security reasons, it is imperative that no
    // installation be permitted using such a prefix.
    if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "simpletest") !== FALSE) {
        header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
        exit;
    }
    // This must go after drupal_bootstrap(), which unsets globals!
    global $profile, $install_locale, $conf;
    require_once './modules/system/system.install';
    require_once './includes/file.inc';
    // Ensure correct page headers are sent (e.g. caching)
    drupal_page_header();
    // Set up $language, so t() caller functions will still work.
    drupal_init_language();
    // Load module basics (needed for hook invokes).
    include_once './includes/module.inc';
    $module_list['system']['filename'] = 'modules/system/system.module';
    $module_list['filter']['filename'] = 'modules/filter/filter.module';
    module_list(TRUE, FALSE, FALSE, $module_list);
    drupal_load('module', 'system');
    drupal_load('module', 'filter');
    // Install profile chosen, set the global immediately.
    // This needs to be done before the theme cache gets
    // initialized in drupal_maintenance_theme().
    if (!empty($_GET['profile'])) {
        $profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
    }
    // Set up theme system for the maintenance page.
    drupal_maintenance_theme();
    // Check existing settings.php.
    $verify = install_verify_settings();
    if ($verify) {
        // Since we have a database connection, we use the normal cache system.
        // This is important, as the installer calls into the Drupal system for
        // the clean URL checks, so we should maintain the cache properly.
        require_once './includes/cache.inc';
        $conf['cache_inc'] = './includes/cache.inc';
        // Establish a connection to the database.
        require_once './includes/database.inc';
        db_set_active();
        // Check if Drupal is installed.
        $task = install_verify_drupal();
        if ($task == 'done') {
            install_already_done_error();
        }
    } else {
        // Since no persistent storage is available yet, and functions that check
        // for cached data will fail, we temporarily replace the normal cache
        // system with a stubbed-out version that short-circuits the actual
        // caching process and avoids any errors.
        require_once './includes/cache-install.inc';
        $conf['cache_inc'] = './includes/cache-install.inc';
        $task = NULL;
    }
    // No profile was passed in GET, ask the user.
    if (empty($_GET['profile'])) {
        if ($profile = install_select_profile()) {
            install_goto("install.php?profile={$profile}");
        } else {
            install_no_profile_error();
        }
    }
    // Load the profile.
    require_once "./profiles/{$profile}/{$profile}.profile";
    // Locale selection
    if (!empty($_GET['locale'])) {
        $install_locale = preg_replace('/[^a-zA-Z_0-9\\-]/', '', $_GET['locale']);
    } elseif (($install_locale = install_select_locale($profile)) !== FALSE) {
        install_goto("install.php?profile={$profile}&locale={$install_locale}");
    }
    // Tasks come after the database is set up
    if (!$task) {
        global $db_url;
        if (!$verify && !empty($db_url)) {
            // Do not install over a configured settings.php.
            install_already_done_error();
        }
        // Check the installation requirements for Drupal and this profile.
        install_check_requirements($profile, $verify);
        // Verify existence of all required modules.
        $modules = drupal_verify_profile($profile, $install_locale);
        // If any error messages are set now, it means a requirement problem.
        $messages = drupal_set_message();
        if (!empty($messages['error'])) {
//.........这里部分代码省略.........
开发者ID:alexismb5,项目名称:ckan-drupal,代码行数:101,代码来源:install.php


示例2: install_begin_request

/**
 * Begin an installation request, modifying the installation state as needed.
 *
 * This function performs commands that must run at the beginning of every page
 * request. It throws an exception if the installation should not proceed.
 *
 * @param $install_state
 *   An array of information about the current installation state. This is
 *   modified with information gleaned from the beginning of the page request.
 */
function install_begin_request(&$install_state)
{
    // Allow command line scripts to override server variables used by Drupal.
    require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
    if (!$install_state['interactive']) {
        drupal_override_server_variables($install_state['server']);
    }
    // The user agent header is used to pass a database prefix in the request when
    // running tests. However, for security reasons, it is imperative that no
    // installation be permitted using such a prefix.
    if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "simpletest") !== FALSE) {
        header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
        exit;
    }
    drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
    // This must go after drupal_bootstrap(), which unsets globals!
    global $conf;
    require_once DRUPAL_ROOT . '/modules/system/system.install';
    require_once DRUPAL_ROOT . '/includes/common.inc';
    require_once DRUPAL_ROOT . '/includes/file.inc';
    require_once DRUPAL_ROOT . '/includes/path.inc';
    // Set up $language, so t() caller functions will still work.
    drupal_language_initialize();
    // Load module basics (needed for hook invokes).
    include_once DRUPAL_ROOT . '/includes/module.inc';
    include_once DRUPAL_ROOT . '/includes/session.inc';
    include_once DRUPAL_ROOT . '/includes/entity.inc';
    $module_list['system']['filename'] = 'modules/system/system.module';
    $module_list['filter']['filename'] = 'modules/filter/filter.module';
    $module_list['user']['filename'] = 'modules/user/user.module';
    module_list(TRUE, FALSE, FALSE, $module_list);
    drupal_load('module', 'system');
    drupal_load('module', 'filter');
    drupal_load('module', 'user');
    // Load the cache infrastructure with the Fake Cache. Switch to the database cache
    // later if possible.
    require_once DRUPAL_ROOT . '/includes/cache.inc';
    require_once DRUPAL_ROOT . '/includes/cache-install.inc';
    $conf['cache_inc'] = 'includes/cache.inc';
    $conf['cache_default_class'] = 'DrupalFakeCache';
    // Prepare for themed output, if necessary. We need to run this at the
    // beginning of the page request to avoid a different theme accidentally
    // getting set.
    if ($install_state['interactive']) {
        drupal_maintenance_theme();
    }
    // Check existing settings.php.
    $install_state['settings_verified'] = install_verify_settings();
    if ($install_state['settings_verified']) {
        // Since we have a database connection, we use the normal cache system.
        // This is important, as the installer calls into the Drupal system for
        // the clean URL checks, so we should maintain the cache properly.
        unset($conf['cache_default_class']);
        // Initialize the database system. Note that the connection
        // won't be initialized until it is actually requested.
        require_once DRUPAL_ROOT . '/includes/database/database.inc';
        // Verify the last completed task in the database, if there is one.
        $task = install_verify_completed_task();
    } else {
        $task = NULL;
        // Since previous versions of Drupal stored database connection information
        // in the 'db_url' variable, we should never let an installation proceed if
        // this variable is defined and the settings file was not verified above
        // (otherwise we risk installing over an existing site whose settings file
        // has not yet been updated).
        if (!empty($GLOBALS['db_url'])) {
            throw new Exception(install_already_done_error());
        }
    }
    // Modify the installation state as appropriate.
    $install_state['completed_task'] = $task;
    $install_state['database_tables_exist'] = !empty($task);
    // Add any installation parameters passed in via the URL.
    $install_state['parameters'] += $_GET;
    // Validate certain core settings that are used throughout the installation.
    if (!empty($install_state['parameters']['profile'])) {
        $install_state['parameters']['profile'] = preg_replace('/[^a-zA-Z_0-9]/', '', $install_state['parameters']['profile']);
    }
    if (!empty($install_state['parameters']['locale'])) {
        $install_state['parameters']['locale'] = preg_replace('/[^a-zA-Z_0-9\\-]/', '', $install_state['parameters']['locale']);
    }
}
开发者ID:blipp,项目名称:drupal,代码行数:92,代码来源:install.php


示例3: install_main

/**
 * The Drupal installation happens in a series of steps. We begin by verifying
 * that the current environment meets our minimum requirements. We then go
 * on to verify that settings.php is properly configured. From there we
 * connect to the configured database and verify that it meets our minimum
 * requirements. Finally we can allow the user to select an installation
 * profile and complete the installation process.
 *
 * @param $phase
 *   The installation phase we should proceed to.
 */
function install_main()
{
    require_once './includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
    // This must go after drupal_bootstrap(), which unsets globals!
    global $profile, $install_locale;
    require_once './modules/system/system.install';
    require_once './includes/file.inc';
    // Ensure correct page headers are sent (e.g. caching)
    drupal_page_header();
    // Check existing settings.php.
    $verify = install_verify_settings();
    // Drupal may already be installed.
    if ($verify) {
        // Establish a connection to the database.
        require_once './includes/database.inc';
        db_set_active();
        // Check if Drupal is installed.
        if (install_verify_drupal()) {
            install_already_done_error();
        }
    }
    // Load module basics (needed for hook invokes).
    include_once './includes/module.inc';
    $module_list['system']['filename'] = 'modules/system/system.module';
    $module_list['filter']['filename'] = 'modules/filter/filter.module';
    module_list(TRUE, FALSE, FALSE, $module_list);
    drupal_load('module', 'system');
    drupal_load('module', 'filter');
    // Decide which profile to use.
    if (!empty($_GET['profile'])) {
        $profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
    } elseif ($profile = install_select_profile()) {
        install_goto("install.php?profile={$profile}");
    } else {
        install_no_profile_error();
    }
    // Locale selection
    if (!empty($_GET['locale'])) {
        $install_locale = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['locale']);
    } elseif (($install_locale = install_select_locale($profile)) !== FALSE) {
        install_goto("install.php?profile={$profile}&locale={$install_locale}");
    }
    // Load the profile.
    require_once "./profiles/{$profile}/{$profile}.profile";
    // Check the installation requirements for Drupal and this profile.
    install_check_requirements($profile);
    // Change the settings.php information if verification failed earlier.
    // Note: will trigger a redirect if database credentials change.
    if (!$verify) {
        install_change_settings($profile, $install_locale);
    }
    // Verify existence of all required modules.
    $modules = drupal_verify_profile($profile, $install_locale);
    if (!$modules) {
        install_missing_modules_error($profile);
    }
    // Perform actual installation defined in the profile.
    drupal_install_profile($profile, $modules);
    // Warn about settings.php permissions risk
    $settings_file = './' . conf_path() . '/settings.php';
    if (!drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE)) {
        drupal_set_message(st('All necessary changes to %file have been made, so you should now remove write permissions to this file. Failure to remove write permissions to this file is a security risk.', array('%file' => $settings_file)), 'error');
    } else {
        drupal_set_message(st('All necessary changes to %file have been made. It has been set to read-only for security.', array('%file' => $settings_file)));
    }
    // Show end page.
    install_complete($profile);
}
开发者ID:jiva-technology,项目名称:smcuk,代码行数:80,代码来源:install.php


示例4: install_main

/**
 * The Drupal installation happens in a series of steps. We begin by verifying
 * that the current environment meets our minimum requirements. We then go
 * on to verify that settings.php is properly configured. From there we
 * connect to the configured database and verify that it meets our minimum
 * requirements. Finally we can allow the user to select an installation
 * profile and complete the installation process.
 *
 * @param $phase
 *   The installation phase we should proceed to.
 */
function install_main()
{
    require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
    // The user agent header is used to pass a database prefix in the request when
    // running tests. However, for security reasons, it is imperative that no
    // installation be permitted using such a prefix.
    if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "simpletest") !== FALSE) {
        header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
        exit;
    }
    // This must go after drupal_bootstrap(), which unsets globals!
    global $profile, $install_locale, $conf;
    require_once DRUPAL_ROOT . '/modules/system/system.install';
    require_once DRUPAL_ROOT . '/includes/file.inc';
    // Ensure correct page headers are sent (e.g. caching)
    drupal_page_header();
    // Set up $language, so t() caller functions will still work.
    drupal_init_language();
    // Load module basics (needed for hook invokes).
    include_once DRUPAL_ROOT . '/includes/module.inc';
    $module_list['system']['filename'] = 'modules/system/system.module';
    $module_list['filter']['filename'] = 'modules/filter/filter.module';
    module_list(TRUE, FALSE, FALSE, $module_list);
    drupal_load('module', 'system');
    drupal_load('module', 'filter');
    // Load the cache infrastructure using a "fake" cache implementation that
    // does not attempt to write to the database. We need this during the initial
    // part of the installer because the database is not available yet. We
    // continue to use it even when the database does become available, in order
    // to preserve consistency between interactive and command-line installations
    // (the latter complete in one page request and therefore are forced to
    // continue using the cache implementation they started with) and also
    // because any data put in the cache during the installer is inherently
    // suspect, due to the fact that Drupal is not fully set up yet.
    require_once DRUPAL_ROOT . '/includes/cache-install.inc';
    $conf['cache_inc'] = './includes/cache-install.inc';
    // Install profile chosen, set the global immediately.
    // This needs to be done before the theme cache gets
    // initialized in drupal_maintenance_theme().
    if (!empty($_GET['profile'])) {
        $profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
    }
    // Set up theme system for the maintenance page.
    drupal_maintenance_theme();
    // Check existing settings.php.
    $verify = install_verify_settings();
    if ($verify) {
        // Establish a connection to the database.
        require_once DRUPAL_ROOT . '/includes/database.inc';
        db_set_active();
        // Check if Drupal is installed.
        $task = install_verify_drupal();
        if ($task == 'done') {
            install_already_done_error();
        }
    } else {
        $task = NULL;
    }
    // No profile was passed in GET, ask the user.
    if (empty($_GET['profile'])) {
        if ($profile = install_select_profile()) {
            install_goto("install.php?profile={$profile}");
        } else {
            install_no_profile_error();
        }
    }
    // Load the profile.
    require_once DRUPAL_ROOT . "/profiles/{$profile}/{$profile}.profile";
    // Locale selection
    if (!empty($_GET['locale'])) {
        $install_locale = preg_replace('/[^a-zA-Z_0-9\\-]/', '', $_GET['locale']);
    } elseif (($install_locale = install_select_locale($profile)) !== FALSE) {
        install_goto("install.php?profile={$profile}&locale={$install_locale}");
    }
    // Tasks come after the database is set up
    if (!$task) {
        global $db_url;
        if (!$verify && !empty($db_url)) {
            // Do not install over a configured settings.php.
            install_already_done_error();
        }
        // Check the installation requirements for Drupal and this profile.
        install_check_requirements($profile, $verify);
        // Verify existence of all required modules.
        $modules = drupal_verify_profile($profile, $install_locale);
        // If any error messages are set now, it means a requirement problem.
        $messages = drupal_set_message();
        if (!empty($messages['error'])) {
//.........这里部分代码省略.........
开发者ID:rjbrown99,项目名称:6,代码行数:101,代码来源:install.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP installerHook函数代码示例发布时间:2022-05-15
下一篇:
PHP install_update_script函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap