Advertisement
Guest User

May fix some incorrect home & content directory paths in w3tc_total_cache plugin for WordPress

a guest
Jun 8th, 2010
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.62 KB | None | 0 0
  1. Index: w3-total-cache/lib/W3/Plugin/PgCache.php
  2. ===================================================================
  3. --- w3-total-cache/lib/W3/Plugin/PgCache.php    (revision 249851)
  4. +++ w3-total-cache/lib/W3/Plugin/PgCache.php    (working copy)
  5. @@ -139,7 +139,7 @@
  6.                  $this->_config->save();
  7.              } else {
  8.                  if (!w3_is_wpmu() && !$this->write_rules_core()) {
  9. -                    w3_writable_error(ABSPATH . '.htaccess');
  10. +                    w3_writable_error(get_home_path() . '.htaccess');
  11.                  }
  12.                  
  13.                  if (!$this->write_rules_cache()) {
  14. @@ -614,7 +614,7 @@
  15.       */
  16.      function write_rules_core()
  17.      {
  18. -        $path = ABSPATH . '.htaccess';
  19. +        $path = get_home_path() . '.htaccess';
  20.          
  21.          if (file_exists($path)) {
  22.              if (($data = @file_get_contents($path)) !== false) {
  23. @@ -699,7 +699,7 @@
  24.       */
  25.      function remove_rules_core()
  26.      {
  27. -        $path = ABSPATH . '.htaccess';
  28. +        $path = get_home_path() . '.htaccess';
  29.          
  30.          if (file_exists($path)) {
  31.              if (($data = @file_get_contents($path)) !== false) {
  32. @@ -733,7 +733,7 @@
  33.       */
  34.      function check_rules_core()
  35.      {
  36. -        $path = ABSPATH . '.htaccess';
  37. +        $path = get_home_path() . '.htaccess';
  38.          $search = $this->generate_rules_core();
  39.          
  40.          return (($data = @file_get_contents($path)) && strstr(w3_clean_rules($data), w3_clean_rules($search)) !== false && $this->check_rules_wp());
  41. @@ -763,7 +763,7 @@
  42.              return true;
  43.          }
  44.          
  45. -        $path = ABSPATH . '/.htaccess';
  46. +        $path = get_home_path() . '.htaccess';
  47.          
  48.          return (($data = @file_get_contents($path)) && preg_match('~# BEGIN WordPress.*# END WordPress~s', w3_clean_rules($data)));
  49.      }
  50. Index: w3-total-cache/lib/W3/Plugin/TotalCache.php
  51. ===================================================================
  52. --- w3-total-cache/lib/W3/Plugin/TotalCache.php (revision 249851)
  53. +++ w3-total-cache/lib/W3/Plugin/TotalCache.php (working copy)
  54. @@ -1277,7 +1277,7 @@
  55.      {
  56.          $pgcache_rules_core = '';
  57.          $pgcache_rules_cache = '';
  58. -        $pgcache_htaccess_core = ABSPATH . '.htaccess';
  59. +        $pgcache_htaccess_core = get_home_path() . '.htaccess';
  60.          $pgcache_htaccess_cache = W3TC_CACHE_FILE_PGCACHE_DIR . '/.htaccess';
  61.          
  62.          $minify_rules = '';
  63. Index: w3-total-cache/inc/define.php
  64. ===================================================================
  65. --- w3-total-cache/inc/define.php   (revision 249851)
  66. +++ w3-total-cache/inc/define.php   (working copy)
  67. @@ -37,11 +37,11 @@
  68.  define('W3TC_PREFIX', (W3TC_BLOGNAME != '' ? '-' . W3TC_BLOGNAME : ''));
  69.  
  70.  defined('WP_CONTENT_DIR') || define('WP_CONTENT_DIR', realpath(W3TC_DIR . '/../..'));
  71. -define('WP_CONTENT_DIR_NAME', basename(WP_CONTENT_DIR));
  72. -define('W3TC_CONTENT_DIR_NAME', WP_CONTENT_DIR_NAME . '/w3tc' . W3TC_PREFIX);
  73. -define('W3TC_CONTENT_DIR', ABSPATH . W3TC_CONTENT_DIR_NAME);
  74. +define('WP_CONTENT_DIR_NAME', basename(WP_CONTENT_DIR)); // irrelevant?
  75. +define('W3TC_CONTENT_DIR_NAME', 'w3tc' . W3TC_PREFIX);
  76. +define('W3TC_CONTENT_DIR', WP_CONTENT_DIR . '/' . W3TC_CONTENT_DIR_NAME);
  77.  define('W3TC_CONTENT_MINIFY_DIR_NAME', W3TC_CONTENT_DIR_NAME . '/min');
  78. -define('W3TC_CONTENT_MINIFY_DIR', ABSPATH . W3TC_CONTENT_DIR_NAME . '/min');
  79. +define('W3TC_CONTENT_MINIFY_DIR', W3TC_CONTENT_DIR . '/min');
  80.  define('W3TC_CACHE_FILE_DBCACHE_DIR', W3TC_CONTENT_DIR . '/dbcache');
  81.  define('W3TC_CACHE_FILE_PGCACHE_DIR', W3TC_CONTENT_DIR . '/pgcache');
  82.  define('W3TC_CACHE_FILE_MINIFY_DIR', W3TC_CONTENT_DIR . '/min');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement