Example #1
0
function wp_cache_check_link()
{
    global $wp_cache_link, $wp_cache_file;
    $ret = true;
    if (file_exists($wp_cache_link)) {
        $file = file_get_contents($wp_cache_link);
        if (strpos($file, "WP SUPER CACHE 0.8.9.1")) {
            return true;
        } else {
            if (!@unlink($wp_cache_link)) {
                $ret = false;
            } else {
                $ret = wp_cache_create_advanced_cache();
            }
        }
    } else {
        $ret = wp_cache_create_advanced_cache();
    }
    if (false == $ret) {
        echo "<h3>Warning! <em>" . constant('WP_CONTENT_DIR') . "/advanced-cache.php</em> does not exist or cannot be updated.</h3>";
        echo "<p><ul><li>1. If it already exists please delete the file first.</li>";
        echo "<li>2. Make " . constant('WP_CONTENT_DIR') . " writable using the chmod command through your ftp or server software. (<em>chmod 777 " . constant('WP_CONTENT_DIR') . "</em>) and refresh this page. This is only a temporary measure and you'll have to make it read only afterwards again. (Change 777 to 755 in the previous command)</li>";
        echo "<li>3. Refresh this page to update <em>" . constant('WP_CONTENT_DIR') . "/advanced-cache.php</em></li></ul>";
        echo "If that doesn't work, make sure the file <em>" . constant('WP_CONTENT_DIR') . "/advanced-cache.php</em> doesn't exist:<ol>";
        echo "<li>1. Open <em>{$wp_cache_file}</em> in a text editor.</li><li>2. Change the text <em>CACHEHOME</em> to <em>" . constant('WPCACHEHOME') . "</em></li><li>3. Save the file and copy it to <em>{$wp_cache_link}</em> and refresh this page.</li>";
        return false;
    }
    return true;
}
Example #2
0
function wp_cache_check_link()
{
    global $wp_cache_link, $wp_cache_file;
    $ret = true;
    if (file_exists($wp_cache_link)) {
        $file = file_get_contents($wp_cache_link);
        if (strpos($file, "WP SUPER CACHE 0.8.9.1")) {
            return true;
        } else {
            if (!@unlink($wp_cache_link)) {
                $ret = false;
            } else {
                $ret = wp_cache_create_advanced_cache();
            }
        }
    } else {
        $ret = wp_cache_create_advanced_cache();
    }
    if (false == $ret) {
        echo "<h3>" . __('Warning', 'wp-super-cache') . "! <em>" . sprintf(__('%s/advanced-cache.php</em> does not exist or cannot be updated.', 'wp-super-cache'), WP_CONTENT_DIR) . "</h3>";
        echo "<p><ul><li>" . __('1. If it already exists please delete the file first.', 'wp-super-cache') . "</li>";
        echo "<li>" . sprintf(__('2. Make %1$s writable using the chmod command through your ftp or server software. (<em>chmod 777 %1$s</em>) and refresh this page. This is only a temporary measure and you&#8217;ll have to make it read only afterwards again. (Change 777 to 755 in the previous command)', 'wp-super-cache'), WP_CONTENT_DIR) . "</li>";
        echo "<li>" . sprintf(__('3. Refresh this page to update <em>%s/advanced-cache.php</em>', 'wp-super-cache'), WP_CONTENT_DIR) . "</li></ul>";
        echo sprintf(__('If that doesn&#8217;t work, make sure the file <em>%s/advanced-cache.php</em> doesn&#8217;t exist:', 'wp-super-cache'), WP_CONTENT_DIR) . "<ol>";
        printf(__('<li>1. Open <em>%1$s$wp_cache_file</em> in a text editor.</li><li>2. Change the text <em>CACHEHOME</em> to <em>%2$s</em></li><li>3. Save the file and copy it to <em>%3$s</em> and refresh this page.</li>', 'wp-super-cache'), $wp_cache_file, WPCACHEHOME, $wp_cache_link);
        return false;
    }
    return true;
}
function wp_cache_admin_notice()
{
    global $cache_enabled, $wp_cache_phase1_loaded;
    if (substr($_SERVER["PHP_SELF"], -11) == 'plugins.php' && !$cache_enabled && function_exists("admin_url")) {
        echo '<div class="error"><p><strong>' . sprintf(__('WP Super Cache is disabled. Please go to the <a href="%s">plugin admin page</a> to enable caching.', 'wp-super-cache'), admin_url('options-general.php?page=wpsupercache')) . '</strong></p></div>';
    }
    if (defined('WP_CACHE') && WP_CACHE == true && (defined('ADVANCEDCACHEPROBLEM') || $cache_enabled && false == isset($wp_cache_phase1_loaded))) {
        echo '<div class="error"><p>' . sprintf(__('Warning! WP Super Cache caching <strong>was</strong> broken but has been <strong>fixed</strong>! The script advanced-cache.php could not load wp-cache-phase1.php.<br /><br />The file %1$s/advanced-cache.php has been recreated and WPCACHEHOME fixed in your wp-config.php. Reload to hide this message.', 'wp-super-cache'), WP_CONTENT_DIR) . '</p></div>';
        wp_cache_create_advanced_cache();
    }
}