| Conditions | 7 |
| Paths | 36 |
| Total Lines | 34 |
| Code Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | function newbbSynchronization($type = null) |
||
| 27 | { |
||
| 28 | $allTypes = [ |
||
| 29 | 'category', |
||
| 30 | 'forum', |
||
| 31 | 'topic', |
||
| 32 | 'post', |
||
| 33 | 'report', |
||
| 34 | 'rate', |
||
| 35 | 'moderate', |
||
| 36 | 'readtopic', |
||
| 37 | 'readforum', |
||
| 38 | 'stats', |
||
| 39 | ]; |
||
| 40 | $type = []; |
||
| 41 | $type = empty($type) ? $allTypes : (is_array($type) ? $type : [$type]); |
||
| 42 | foreach ($type as $item) { |
||
| 43 | $handler = \XoopsModules\Newbb\Helper::getInstance()->getHandler($item); |
||
| 44 | if ('stats' !== $item) { |
||
| 45 | $handler->synchronization(); |
||
| 46 | } else { |
||
| 47 | $handler->reset(); |
||
| 48 | } |
||
| 49 | |||
| 50 | if (method_exists($handler, 'cleanExpires')) { |
||
| 51 | $handler->cleanExpires(); |
||
| 52 | } |
||
| 53 | if (method_exists($handler, 'clearGarbage')) { |
||
| 54 | $handler->clearGarbage(); |
||
| 55 | } |
||
| 56 | unset($handler); |
||
| 57 | } |
||
| 58 | |||
| 59 | return true; |
||
| 60 | } |
||
| 62 |