Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 3rd, 2012  |  syntax: None  |  size: 3.15 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/stk/tools/admin/reparse_bbcode.php b/stk/tools/admin/reparse_bbcode.php
  2. index e9d5957..ac78286 100644
  3. --- a/stk/tools/admin/reparse_bbcode.php
  4. +++ b/stk/tools/admin/reparse_bbcode.php
  5. @@ -219,12 +219,22 @@ class reparse_bbcode
  6.                 // Greb our batch
  7.                 $bitfield = (empty($_REQUEST['reparseall'])) ? true : false;
  8.  
  9. -               // When reparsing everything we need some additional information
  10. -               // including how many posts/pms/sigs we'll be reparsing. This is
  11. -               // needed for MSSQL as that DBMS doesn't appear to break correct
  12. -               // from the loop when it has fetched the last row.
  13. +               // The MSSQL DBMS doesn't break correctly out of the loop
  14. +               // when it is finished reparsing the last post. Therefore
  15. +               // we'll have to find out manually whether the tool is
  16. +               // finished, and if not how many objects it can select
  17. +               // if ($this->step_size * $step > 'maxrows')
  18.                 // #62822
  19. -               if ($bitfield === false)
  20. +
  21. +               // First the easiest, the user selected certain posts/pms
  22. +               if (!empty($reparse_posts) || !empty($reparse_pms))
  23. +               {
  24. +                       $this->step_size = (!empty($reparse_posts)) ? sizeof($reparse_posts) : sizeof($reparse_pms);
  25. +
  26. +                       // This is always done in one go
  27. +                       $last_batch = true;
  28. +               }
  29. +               else
  30.                 {
  31.                         // Get the total
  32.                         $this->max = request_var('rowsmax', 0);
  33. @@ -235,21 +245,27 @@ class reparse_bbcode
  34.                                         case BBCODE_REPARSE_POSTS :
  35.                                                 $ccol = 'post_id';
  36.                                                 $ctab = POSTS_TABLE;
  37. +                                               $bbf  = 'bbcode_bitfield';
  38.                                         break;
  39.  
  40.                                         case BBCODE_REPARSE_PMS:
  41.                                                 $ccol = 'msg_id';
  42.                                                 $ctab = PRIVMSGS_TABLE;
  43. +                                               $bbf  = 'bbcode_bitfield';
  44.                                         break;
  45.  
  46.                                         case BBCODE_REPARSE_SIGS:
  47.                                                 $ccol = 'user_id';
  48.                                                 $ctab = USERS_TABLE;
  49. +                                               $bbf  = 'user_sig_bbcode_bitfield';
  50.                                         break;
  51.                                 }
  52.  
  53. +                               $sql_where = ($bitfield === false) ? '' : "WHERE {$bbf} <> ''";
  54. +
  55.                                 $sql = "SELECT COUNT({$ccol}) AS cnt
  56. -                                       FROM {$ctab}";
  57. +                                       FROM {$ctab}
  58. +                                       {$sql_where}";
  59.                                 $result         = $db->sql_query($sql);
  60.                                 $this->max      = $db->sql_fetchfield('cnt', false, $result);
  61.                                 $db->sql_freeresult($result);
  62. @@ -309,20 +325,6 @@ class reparse_bbcode
  63.                 $batch  = $db->sql_fetchrowset($result);
  64.                 $db->sql_freeresult($result);
  65.  
  66. -               // Finished?
  67. -               if ($last_batch && $mode == BBCODE_REPARSE_SIGS)
  68. -               {
  69. -                       // Done!
  70. -                       $cache->destroy('_stk_reparse_posts');
  71. -                       $cache->destroy('_stk_reparse_pms');
  72. -                       trigger_error($user->lang['REPARSE_BBCODE_COMPLETE']);
  73. -               }
  74. -               else if ($last_batch)
  75. -               {
  76. -                       // Move to the next type
  77. -                       $this->_next_step(0, $mode, true);
  78. -               }
  79. -
  80.                 // Backup
  81.                 // For now disabled. Have to see how to implement this with regards to sigs and pms
  82.  //             $this->_backup($batch);
  83. @@ -401,6 +403,20 @@ class reparse_bbcode
  84.                         $_user2->keyvalues              = array();
  85.                 }
  86.  
  87. +               // Finished?
  88. +               if ($last_batch && $mode == BBCODE_REPARSE_SIGS)
  89. +               {
  90. +                       // Done!
  91. +                       $cache->destroy('_stk_reparse_posts');
  92. +                       $cache->destroy('_stk_reparse_pms');
  93. +                       trigger_error($user->lang['REPARSE_BBCODE_COMPLETE']);
  94. +               }
  95. +               else if ($last_batch)
  96. +               {
  97. +                       // Move to the next type
  98. +                       $this->_next_step(0, $mode, true);
  99. +               }
  100. +
  101.                 // Next step
  102.                 $this->_next_step($step, $mode);
  103.         }