Exemplo n.º 1
0
/**
 * Handles upgrade for review table.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $wpdb WordPress Database object.
 * @global string $plugin_prefix Geodirectory plugin table prefix.
 */
function geodir_update_review_db()
{
    global $wpdb, $plugin_prefix;
    geodir_fix_review_date();
    geodir_fix_review_post_status();
    geodir_fix_review_content();
    geodir_fix_review_location();
}
Exemplo n.º 2
0
/**
 * Handles upgrade for review table.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $wpdb WordPress Database object.
 * @global string $plugin_prefix Geodirectory plugin table prefix.
 */
function geodir_update_review_db()
{
    global $wpdb, $plugin_prefix;
    // Add columns to review table
    geodir_add_column_if_not_exist(GEODIR_REVIEW_TABLE, 'post_status', 'INT(11) DEFAULT NULL');
    geodir_add_column_if_not_exist(GEODIR_REVIEW_TABLE, 'post_date', 'DATETIME NOT NULL');
    geodir_add_column_if_not_exist(GEODIR_REVIEW_TABLE, 'post_city', 'varchar(30) NULL DEFAULT NULL');
    geodir_add_column_if_not_exist(GEODIR_REVIEW_TABLE, 'post_region', 'varchar(30) NULL DEFAULT NULL');
    geodir_add_column_if_not_exist(GEODIR_REVIEW_TABLE, 'post_country', 'varchar(30) NULL DEFAULT NULL');
    geodir_add_column_if_not_exist(GEODIR_REVIEW_TABLE, 'post_latitude', 'varchar(20) NULL DEFAULT NULL');
    geodir_add_column_if_not_exist(GEODIR_REVIEW_TABLE, 'post_longitude', 'varchar(20) NULL DEFAULT NULL');
    geodir_add_column_if_not_exist(GEODIR_REVIEW_TABLE, 'comment_content', 'TEXT NULL DEFAULT NULL');
    // this should not be needed anymore becasue of geodir_fix_review_location()
    /*$reviews = $wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL");
      foreach($reviews as $review){
      $location = $wpdb->get_row("SELECT * FROM ".$plugin_prefix.$review->post_type."_detail WHERE post_id=".$review->post_id);
      $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." gdr SET gdr.post_city=%s, gdr.post_region=%s , gdr.post_country=%s , gdr.post_latitude=%s, gdr.post_longitude=%s WHERE gdr.id=%d",$location->post_city,$location->post_region,$location->post_country,$review->id,$location->post_latitude,$location->post_longitude));
      }*/
    geodir_fix_review_date();
    geodir_fix_review_post_status();
    geodir_fix_review_content();
    geodir_fix_review_location();
}