Plugin Directory

Changeset 2180662


Ignore:
Timestamp:
10/26/2019 02:49:09 PM (6 years ago)
Author:
magent
Message:

Fixed complaint about using count on an object for PHP7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vampire-character/trunk/inc/install.php

    r2056046 r2180662  
    12191219        // Only read in data if the target table is clear
    12201220        $sql = "select ID from " . VTM_TABLE_PREFIX . $tablename;
    1221         $rows = count($wpdb->get_results($sql));
     1221        $rows = vtm_count($wpdb->get_results($sql));
    12221222        if (!$rows) {
    12231223            $filehandle = fopen($datafile,"r");
     
    13601360    foreach ($data as $key => $entry) {
    13611361        $sql = "select VALUE from " . VTM_TABLE_PREFIX . "ST_LINK where VALUE = %s;";
    1362         $exists = count($wpdb->get_results($wpdb->prepare($sql,$key)));
     1362        $exists = vtm_count($wpdb->get_results($wpdb->prepare($sql,$key)));
    13631363        if (!$exists)
    13641364            $rowsadded = $wpdb->insert( VTM_TABLE_PREFIX . "ST_LINK", $entry);
     
    14871487    $sql = "SHOW TABLES LIKE '" . $prefix . $table . "'";
    14881488    $result = $wpdb->get_results($sql);
    1489     $tableExists = count($result) > 0;
     1489    $tableExists = vtm_count($result) > 0;
    14901490   
    14911491    //echo "<p>Table $table exists: $tableExists ($sql)</p>";
     
    15581558        $sql = $wpdb->prepare($sql, $oldprefix . "%");
    15591559        $result = $wpdb->get_col($sql);
    1560         if (count($result) > 0) {
     1560        if (vtm_count($result) > 0) {
    15611561            foreach ($result as $table) {
    15621562                $newtable = str_replace($oldprefix, VTM_TABLE_PREFIX, $table);
     
    15671567                //echo "<p>SQL: $sql</p>";
    15681568               
    1569                 if (count($result) == 0) {
     1569                if (vtm_count($result) == 0) {
    15701570                    $sql = "RENAME TABLE $table TO $newtable";
    15711571                    $result = $wpdb->query($sql);
     
    15981598        $result = $wpdb->get_col($sql);
    15991599        //print_r($result);
    1600         if (count($result) > 0) {
     1600        if (vtm_count($result) > 0) {
    16011601            foreach ($result as $characterID) {
    16021602                $wpdb->update(VTM_TABLE_PREFIX . "CHARACTER",
     
    16131613        //echo "<li>SQL: $sql</li>";
    16141614        //print_r($result);
    1615         if (count($result) > 0) {
     1615        if (vtm_count($result) > 0) {
    16161616            foreach ($result as $clanID) {
    16171617                $wpdb->update(VTM_TABLE_PREFIX . "CLAN",
     
    16351635        //echo "<p>SQL: $sql</p>";
    16361636        $result = $wpdb->get_results($sql);
    1637         if (count($result) > 0) {
     1637        if (vtm_count($result) > 0) {
    16381638            foreach ($result as $row) {
    16391639                $userdata = get_user_by( 'login', $row->WORDPRESS_ID );
     
    17101710        $result = $wpdb->get_col($sql);
    17111711        //print_r($result);
    1712         if (count($result) > 0) {
     1712        if (vtm_count($result) > 0) {
    17131713            foreach ($result as $roadid) {
    17141714                $wpdb->update(VTM_TABLE_PREFIX . "ROAD_OR_PATH",
     
    17451745            //print_r($result);
    17461746            //echo "<li>Updating...</li>";
    1747             if (count($result) > 0) {
     1747            if (vtm_count($result) > 0) {
    17481748                foreach ($result as $row) {
    17491749                    $grp = sanitize_key($row->GROUPING);
     
    19301930   
    19311931    // Display what database updates were made by dbDelta
    1932     if (empty($error) && count($for_update) > 0 ) {
     1932    if (empty($error) && vtm_count($for_update) > 0 ) {
    19331933        $erroutput = "";
    19341934        foreach ($for_update as $update) {
     
    21092109            fputcsv($file, $headings);
    21102110            // output contents
    2111             if (count($contents) > 0) {
     2111            if (vtm_count($contents) > 0) {
    21122112                foreach ($contents as $data) {
    21132113                    foreach ($headings as $heading) {
Note: See TracChangeset for help on using the changeset viewer.