/ 设置 10 秒超时 // 每日统计清 0 runtime_set('todaycomments', 0); runtime_set('todayarticles', 0); runtime_set('todayusers', 0); if ($forumlist) { $fidarr = array(); foreach ($forumlist as $fid => $forum) { $fidarr[] = $forum['fid']; } forum_update($fidarr, array('todayposts' => 0, 'todaythreads' => 0)); } // 清理临时附件 attach_gc(); // 当天24点 $today = strtotime(date('Ymd')) + 86400; runtime_set('cron_2_last_date', $today, TRUE); // 往前推8个小时,尽量保证在前一天 升级过来和采集的数据会很卡 // table_day_cron($time - 8 * 3600); cache_delete('cron_lock_2'); } } } ?>permalinks - WordPress Multisite ABSPATH and get_home_path() to check for htaccess or web.config file|Concepts Of Algorithm

permalinks - WordPress Multisite ABSPATH and get_home_path() to check for htaccess or web.config file

admin2025-04-21  2

Looking to update my WP Login Flow open source plugin to prevent using rewrite URLs in things like Lost Password, Login, Register, if the rewrite file does not exist on the server -- but need some help with multisite support.

From my understanding multisite installs will have just a single root .htaccess or web.config file, and rewrites are stored in the options table for sub-sites.

For now i'm using these functions below to check for rewrite file (and just return true now for multisite), but i would like to add support for checking multisites

function htaccess_exists(){
    if ( is_multisite() ) {
        return true;
    }

    // Ensure get_home_path() is declared.
    require_once( ABSPATH . 'wp-admin/includes/file.php' );

    $home_path     = get_home_path();
    $htaccess_file = $home_path . '.htaccess';
    return file_exists( $htaccess_file );
}

function iis_web_config_exists() {
    if ( is_multisite() ) {
        return true;
    }

    // Ensure get_home_path() is declared.
    require_once( ABSPATH . 'wp-admin/includes/file.php' );
    $home_path       = get_home_path();
    $web_config_file = $home_path . 'web.config';
    // iis7_supports_permalinks() also checks to make sure IIS7 or above (required for permalinks)
    return iis7_supports_permalinks() && file_exists( $web_config_file );
}

Maybe I can just try using ABSPATH for multisite to check for the files?

Any thoughts or suggestions on how I could accomplish this to work with multisite?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745172147a288721.html

最新回复(0)