private function php_handle_col( $col, $primary_keys, $table ) {
		global $wpdb;

		$count = 0;

		$table_sql = $this->esc_sql_ident( $table );
		$col_sql   = $this->esc_sql_ident( $col );

		$where            = " WHERE $col_sql" . $wpdb->prepare( ' LIKE %s', '%' . $wpdb->esc_like( $this->old ) . '%' );
		$primary_keys_sql = implode( ',', $this->esc_sql_ident( $primary_keys ) );

		$rows = $wpdb->get_results( "SELECT {$primary_keys_sql} FROM {$table_sql} {$where}" );

		foreach ( $rows as $keys ) {
			$where_sql = '';

			foreach ( (array) $keys as $k => $v ) {
				if ( strlen( $where_sql ) ) {
					$where_sql .= ' AND ';
				}
				$where_sql .= $this->esc_sql_ident( $k ) . ' = ' . esc_sql( $v );
			}

			$col_value = $wpdb->get_var( "SELECT {$col_sql} FROM {$table_sql} WHERE {$where_sql}" );

			if ( '' === $col_value ) {
				continue;
			}

			$value = $this->php_search_replace( $col_value, false );

			if ( $value === $col_value ) {
				continue;
			}

			$where = array();

			foreach ( (array) $keys as $k => $v ) {
				$where[ $k ] = $v;
			}

			$count += $wpdb->update( $table, array( $col => $value ), $where );
		}

		return $count;
	}
private function php_handle_col( $col, $primary_keys, $table ) {
		global $wpdb;

		$count = 0;

		$table_sql = $this->esc_sql_ident( $table );
		$col_sql   = $this->esc_sql_ident( $col );

		$where            = " WHERE $col_sql" . $wpdb->prepare( ' LIKE %s', '%' . $wpdb->esc_like( $this->old ) . '%' );
		$primary_keys_sql = implode( ',', $this->esc_sql_ident( $primary_keys ) );

		$rows = $wpdb->get_results( "SELECT {$primary_keys_sql} FROM {$table_sql} {$where}" );

		foreach ( $rows as $keys ) {
			$where_sql = '';

			foreach ( (array) $keys as $k => $v ) {
				if ( strlen( $where_sql ) ) {
					$where_sql .= ' AND ';
				}
				$where_sql .= $this->esc_sql_ident( $k ) . ' = ' . esc_sql( $v );
			}

			$col_value = $wpdb->get_var( "SELECT {$col_sql} FROM {$table_sql} WHERE {$where_sql}" );

			if ( '' === $col_value ) {
				continue;
			}

			$value = $this->php_search_replace( $col_value, false );

			if ( $value === $col_value ) {
				continue;
			}

			$where = array();

			foreach ( (array) $keys as $k => $v ) {
				$where[ $k ] = $v;
			}

			$count += $wpdb->update( $table, array( $col => $value ), $where );
		}

		return $count;
	}
private function php_handle_col ( $ col , $ primary_keys , $ table ) { global $ wpdb ; $ count = 0 ; $ table_sql = $ this -> esc_sql_ident ( $ table ) ; $ col_sql = $ this -> esc_sql_ident ( $ col ) ; $ where = " WHERE $col_sql" . $ wpdb -> prepare ( ' LIKE %s' , '%' . $ wpdb -> esc_like ( $ this -> old ) . '%' ) ; $ primary_keys_sql = implode ( ',' , $ this -> esc_sql_ident ( $ primary_keys ) ) ; $ rows = $ wpdb -> get_results ( "SELECT {$primary_keys_sql} FROM {$table_sql} {$where}" ) ; foreach ( $ rows as $ keys ) { $ where_sql = '' ; foreach ( ( array ) $ keys as $ k => $ v ) { if ( strlen ( $ where_sql ) ) { $ where_sql .= ' AND ' ; } $ where_sql .= $ this -> esc_sql_ident ( $ k ) . ' = ' . esc_sql ( $ v ) ; } $ col_value = $ wpdb -> get_var ( "SELECT {$col_sql} FROM {$table_sql} WHERE {$where_sql}" ) ; if ( '' === $ col_value ) { continue ; } $ value = $ this -> php_search_replace ( $ col_value , false ) ; if ( $ value === $ col_value ) { continue ; } $ where = array ( ) ; foreach ( ( array ) $ keys as $ k => $ v ) { $ where [ $ k ] = $ v ; } $ count += $ wpdb -> update ( $ table , array ( $ col => $ value ) , $ where ) ; } return $ count ; }
Use PHP to run search and replace on a column. This is mostly used for serialized data.
Returns number of updates made

@param  string $col Column name
@param  array  $primary_keys Array of keys
@param  string $table Table name
@return int
Use PHP to run search and replace on a column . This is mostly used for serialized data . Returns number of updates made