⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 10003_mysql_queries.php

📁 sabreipb 2.1.6 utf-8中文版本!
💻 PHP
📖 第 1 页 / 共 5 页
字号:
<?php/*+--------------------------------------------------------------------------|   Invision Power Board v2.1.5|   ========================================|   by Matthew Mecham|   (c) 2001 - 2004 Invision Power Services|   |   ========================================|   Web: |   Time: Wed, 01 Mar 2006 19:11:35 GMT|   Release: |   Email: |   Licence Info: +---------------------------------------------------------------------------||   > IPB UPGRADE 1.3 -> 2.0 SQL STUFF!|   > Script written by Matt Mecham|   > Date started: 21st April 2004|   > Interesting fact: Turin Brakes are also good+--------------------------------------------------------------------------*/class upgrade_sql{	var $errors   = array();	var $sqlcount = 0;	var $sqlbit   = array();		/*-------------------------------------------------------------------------*/	// CONSTRUCTOR	/*-------------------------------------------------------------------------*/		function upgrade_sql()	{		global $DB, $ibforums, $std;				define( 'THIS_HUMAN_VERSION', '2.0.2' );		define( 'THIS_LONG_VERSION' , '20012' );				$this->sqlbit['attach'] = "attach_file != ''";	}		/*-------------------------------------------------------------------------*/	// STEP 24: RECACHE & REBUILD	/*-------------------------------------------------------------------------*/		function step_24()	{		global $DB, $std, $ibforums;				//-----------------------------------		// Get ACP library		//-----------------------------------			require_once( ROOT_PATH.'sources/lib/admin_cache_functions.php' );		$acp           =  new admin_cache_functions();		$acp->ipsclass =& $this->ipsclass;				//-----------------------------------		// Cache skins and shit		//-----------------------------------				$acp->_rebuild_all_caches( array(2,3) );				//-------------------------------------------------------------		// Forum cache		//-------------------------------------------------------------				$this->ipsclass->cache['forum_cache'] = array();			$this->ipsclass->DB->simple_construct( array( 'select' => '*',									  'from'   => 'forums',									  'order'  => 'parent_id, position'							 )      );		$this->ipsclass->DB->simple_exec();				while( $fr = $this->ipsclass->DB->fetch_row() )		{			$perms = unserialize(stripslashes($fr['permission_array']));						$fr['read_perms']   = $perms['read_perms'];			$fr['reply_perms']  = $perms['reply_perms'];			$fr['start_perms']  = $perms['start_perms'];			$fr['upload_perms'] = $perms['upload_perms'];			$fr['show_perms']   = $perms['show_perms'];						unset($fr['permission_array']);						$this->ipsclass->cache['forum_cache'][ $fr['id'] ] = $fr;		}				$this->ipsclass->update_cache( array( 'name' => 'forum_cache', 'array' => 1, 'deletefirst' => 1 ) );					//-------------------------------------------------------------		// Group Cache		//-------------------------------------------------------------				$this->ipsclass->cache['group_cache'] = array();			$this->ipsclass->DB->simple_construct( array( 'select' => "*",									  'from'   => 'groups'							 )      );				$this->ipsclass->DB->simple_exec();				while ( $i = $this->ipsclass->DB->fetch_row() )		{			$this->ipsclass->cache['group_cache'][ $i['g_id'] ] = $i;		}				$this->ipsclass->update_cache( array( 'name' => 'group_cache', 'array' => 1, 'deletefirst' => 1 ) );				//-------------------------------------------------------------		// Systemvars		//-------------------------------------------------------------				$this->ipsclass->cache['systemvars'] = array();				$result = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'count(*) as cnt', 'from' => 'mail_queue' ) );				$this->ipsclass->cache['systemvars']['mail_queue'] = intval( $result['cnt'] );		$this->ipsclass->cache['systemvars']['task_next_run'] = time() + 3600;				$this->ipsclass->update_cache( array( 'name' => 'systemvars', 'array' => 1, 'deletefirst' => 1 ) );					//-------------------------------------------------------------		// Stats		//-------------------------------------------------------------				$this->ipsclass->cache['stats'] = array();				$this->ipsclass->DB->simple_construct( array( 'select' => 'count(pid) as posts', 'from' => 'posts', 'where' => "queued <> 1" ) );		$this->ipsclass->DB->simple_exec();			$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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -