|
|
|
|
|
|
|
|
|
|
Менеджер загрузок был полностью переписан для версии IPB 2.2, чтобы сделать его более функциональным и приятным в использовании. Однако, на форумах возможно чрезмерное использование ресурсов для многократных приложений.
- The attachment manager was completely rewritten for 2.2 to make it more modularized, and to provide a more streamlined DHTML interface that is easier to use. On boards with high attachment counts, however, we've recently noticed some extra resource usage when dealing with attachments.
Эта проблема была исправлена в IPB 2.2.2! Если вас интересует решение проблемы, то следуйте инструкции.
1. Выполните следующий запрос к MySQL ('ibf_' - префикс таблицы, замените на свой если необходимо):
ANALYZE TABLE ibf_attachments
2. Сделайте резервную копию файлов /sources/classes/attach/plugin_post.php и /sources/classes/attach/plugin_msg.php
3. Откройте файл plugin_post.php и найдите код:
- This issue will be officially corrected in IPB 2.2.2, however for any users wishing to patch their boards now, just following these instructions: 1. Run this query from your mysql console (ensure to change the prefix if different from 'ibf_'): ANALYZE TABLE ibf_attachments 2. Download and backup sources/classes/attach/plugin_post.php and sources/classes/attach/plugin_msg.php 3. Open plugin_post.php and find:
//----------------------------------------- // INIT //----------------------------------------- $rows = array(); $query = '';a $match = 0; //----------------------------------------- // Check //----------------------------------------- if ( ! is_array( $attach_ids ) OR ! count( $attach_ids ) ) { $attach_ids = array( -2 ); } if ( is_array( $rel_ids ) and count( $rel_ids ) ) { $query = " OR attach_rel_id IN (-1," . implode( ",", $rel_ids ) . ")"; $match = 1; } if ( $attach_post_key ) { $query .= " OR attach_post_key='".$this->ipsclass->DB->add_slashes( $attach_post_key )."'"; $match = 2; } //----------------------------------------- // Grab 'em //----------------------------------------- $this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='".$this->module."' AND ( attach_id IN(-1,". implode( ",", $attach_ids ) . ") " . $query . " )", ) );
Замените его на:
//----------------------------------------- // INIT //----------------------------------------- $rows = array(); $query_bits = array(); $query = ''; $match = 0; //----------------------------------------- // Check //----------------------------------------- if ( is_array( $attach_ids ) AND count( $attach_ids ) ) { $query_bits[] = "attach_id IN (" . implode( ",", $attach_ids ) .")"; } if ( is_array( $rel_ids ) and count( $rel_ids ) ) { $query_bits[] = "attach_rel_id IN (" . implode( ",", $rel_ids ) . ")"; //$query = " OR attach_rel_id IN (-1," . implode( ",", $rel_ids ) . ")"; $match = 1; } if ( $attach_post_key ) { $query_bits[] = "attach_post_key='".$this->ipsclass->DB->add_slashes( $attach_post_key )."'"; //$query .= " OR attach_post_key='".$this->ipsclass->DB->add_slashes( $attach_post_key )."'"; $match = 2; } if( !count($query_bits) ) { $query = "attach_id IN (-1)"; } else { $query = implode( " OR ", $query_bits ); } //----------------------------------------- // Grab 'em //----------------------------------------- $this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='".$this->module."' AND ( " . $query . " )", ) );
4. Сохраните изменения. Откройте файл plugin_msg.php и найдите код:
//----------------------------------------- // INIT //----------------------------------------- $rows = array(); $query = ''; //----------------------------------------- // Check //----------------------------------------- if ( ! is_array( $attach_ids ) OR ! count( $attach_ids ) ) { $attach_ids = array( -2 ); } if ( is_array( $rel_ids ) and count( $rel_ids ) ) { $query = " OR attach_rel_id IN (-1," . implode( ",", $rel_ids ) . ")"; } //----------------------------------------- // Grab 'em //----------------------------------------- $this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='".$this->module."' AND ( attach_id IN(-1,". implode( ",", $attach_ids ) . ") " . $query . " )", ) );
Замените его на:
//----------------------------------------- // INIT //----------------------------------------- $rows = array(); $query = ''; $query_bits = array(); $match = 0; //----------------------------------------- // Check //----------------------------------------- if ( is_array( $attach_ids ) AND count( $attach_ids ) ) { //$attach_ids = array( -2 ); $query_bits[] = "attach_id IN (" . implode( ",", $attach_ids ) .")"; } if ( is_array( $rel_ids ) and count( $rel_ids ) ) { $query_bits[] = "attach_rel_id IN (" . implode( ",", $rel_ids ) . ")"; //$query = " OR attach_rel_id IN (-1," . implode( ",", $rel_ids ) . ")"; $match = 1; } if( !count($query_bits) ) { $query = "attach_id IN (-1)"; } else { $query = implode( " OR ", $query_bits ); } //----------------------------------------- // Grab 'em //----------------------------------------- $this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='".$this->module."' AND ( " . $query . " )", ) );
5. Сохраните файл plugin_msg.php. Загрузите оба файла обратно.
Работает на DokuWiki |