]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/UserImport.php
Replace "q" calls
[friendica.git] / src / Core / UserImport.php
index 1e103c1f5df8451c1614e942cea8030d399436f3..07119873d97a371d14dec7d3d46d40d44a19d192 100644 (file)
@@ -6,6 +6,7 @@ namespace Friendica\Core;
 
 use Friendica\App;
 use Friendica\Database\DBA;
+use Friendica\Database\DBStructure;
 use Friendica\Model\Photo;
 use Friendica\Object\Image;
 use Friendica\Util\Strings;
@@ -35,9 +36,8 @@ class UserImport
         */
        private static function checkCols($table, &$arr)
        {
-               $query = sprintf("SHOW COLUMNS IN `%s`", DBA::escape($table));
-               Logger::log("uimport: $query", Logger::DEBUG);
-               $r = q($query);
+               $r = DBStructure::getColumns($table);
+
                $tcols = [];
                // get a plain array of column names
                foreach ($r as $tcol) {
@@ -66,16 +66,12 @@ class UserImport
                }
 
                self::checkCols($table, $arr);
-               $cols = implode("`,`", array_map(['Friendica\Database\DBA', 'escape'], array_keys($arr)));
-               $vals = implode("','", array_map(['Friendica\Database\DBA', 'escape'], array_values($arr)));
-               $query = "INSERT INTO `$table` (`$cols`) VALUES ('$vals')";
-               Logger::log("uimport: $query", Logger::TRACE);
 
                if (self::IMPORT_DEBUG) {
                        return true;
                }
 
-               return q($query);
+               return DBA::insert($table, $arr);
        }
 
        /**