📄 10001_mysql_queries.php
字号:
$r = $this->ipsclass->DB->fetch_row(); $stats['total_replies'] = intval($r['posts']); $this->ipsclass->DB->simple_construct( array( 'select' => 'count(tid) as topics', 'from' => 'topics', 'where' => "approved = 1" ) ); $this->ipsclass->DB->simple_exec(); $r = $this->ipsclass->DB->fetch_row(); $stats['total_topics'] = intval($r['topics']); $stats['total_replies'] -= $stats['total_topics']; $this->ipsclass->DB->simple_construct( array( 'select' => 'count(id) as members', 'from' => 'members', 'where' => "mgroup <> '".$this->ipsclass->vars['auth_group']."'" ) ); $this->ipsclass->DB->simple_exec(); $r = $this->ipsclass->DB->fetch_row(); $stats['mem_count'] = intval($r['members']); $this->ipsclass->cache['stats']['total_replies'] = $stats['total_replies']; $this->ipsclass->cache['stats']['total_topics'] = $stats['total_topics']; $this->ipsclass->cache['stats']['mem_count'] = $stats['mem_count']; $r = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'id, name', 'from' => 'members', 'order' => 'id DESC', 'limit' => '0,1' ) ); $this->ipsclass->cache['stats']['last_mem_name'] = $r['name']; $this->ipsclass->cache['stats']['last_mem_id'] = $r['id']; $this->ipsclass->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 1 ) ); //------------------------------------------------------------- // Ranks //------------------------------------------------------------- $this->ipsclass->cache['ranks'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => 'id, title, pips, posts', 'from' => 'titles', 'order' => "posts DESC", ) ); $this->ipsclass->DB->simple_exec(); while ($i = $this->ipsclass->DB->fetch_row()) { $this->ipsclass->cache['ranks'][ $i['id'] ] = array( 'TITLE' => $i['title'], 'PIPS' => $i['pips'], 'POSTS' => $i['posts'], ); } $this->ipsclass->update_cache( array( 'name' => 'ranks', 'array' => 1, 'deletefirst' => 1 ) ); //------------------------------------------------------------- // SETTINGS //------------------------------------------------------------- $this->ipsclass->cache['settings'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'conf_settings', 'where' => 'conf_add_cache=1' ) ); $info = $this->ipsclass->DB->simple_exec(); while ( $r = $this->ipsclass->DB->fetch_row($info) ) { $this->ipsclass->cache['settings'][ $r['conf_key'] ] = $r['conf_value'] != "" ? $r['conf_value'] : $r['conf_default']; } $this->ipsclass->update_cache( array( 'name' => 'settings', 'array' => 1, 'deletefirst' => 1 ) ); //------------------------------------------------------------- // EMOTICONS //------------------------------------------------------------- $this->ipsclass->cache['emoticons'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => 'typed,image,clickable,emo_set', 'from' => 'emoticons' ) ); $this->ipsclass->DB->simple_exec(); while ( $r = $this->ipsclass->DB->fetch_row() ) { $this->ipsclass->cache['emoticons'][] = $r; } $this->ipsclass->update_cache( array( 'name' => 'emoticons', 'array' => 1, 'deletefirst' => 1 ) ); //------------------------------------------------------------- // LANGUAGES //------------------------------------------------------------- $this->ipsclass->cache['languages'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => 'ldir,lname', 'from' => 'languages' ) ); $this->ipsclass->DB->simple_exec(); while ( $r = $this->ipsclass->DB->fetch_row() ) { $this->ipsclass->cache['languages'][] = $r; } $this->ipsclass->update_cache( array( 'name' => 'languages', 'array' => 1, 'deletefirst' => 1 ) ); //------------------------------------------------------------- // ATTACHMENT TYPES //------------------------------------------------------------- $this->ipsclass->cache['attachtypes'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => 'atype_extension,atype_mimetype,atype_post,atype_photo,atype_img', 'from' => 'attachments_type', 'where' => "atype_photo=1 OR atype_post=1" ) ); $this->ipsclass->DB->simple_exec(); while ( $r = $this->ipsclass->DB->fetch_row() ) { $this->ipsclass->cache['attachtypes'][ $r['atype_extension'] ] = $r; } $this->ipsclass->update_cache( array( 'name' => 'attachtypes', 'array' => 1, 'deletefirst' => 1 ) ); } /*-------------------------------------------------------------------------*/ // STEP 21: OPTIMIZATION II /*-------------------------------------------------------------------------*/ function step_21() { global $DB, $std, $ibforums; $SQL[] = "alter table ".SQL_PREFIX."posts drop index topic_id;"; $SQL[] = "alter table ".SQL_PREFIX."posts drop index author_id;"; $SQL[] = "alter table ".SQL_PREFIX."posts add index topic_id (topic_id, queued, pid);"; $SQL[] = "alter table ".SQL_PREFIX."posts add index author_id( author_id, topic_id);"; $SQL[] = "ALTER TABLE ".SQL_PREFIX."posts DROP INDEX forum_id, ADD INDEX(post_date);";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -