]> git.mxchange.org Git - friendica.git/blobdiff - include/uimport.php
merged 2 if() into one as requested by CR
[friendica.git] / include / uimport.php
index 78471af1514461d33cdef9a13f7b1e5bd31503e8..4cc5b6c04b3f14d17b87c6c9d254968f4bdd54fc 100644 (file)
@@ -11,14 +11,11 @@ define("IMPORT_DEBUG", False);
 \r
 function last_insert_id() {\r
        global $db;\r
+\r
        if (IMPORT_DEBUG)\r
                return 1;\r
-       if ($db->mysqli) {\r
-               $thedb = $db->getdb();\r
-               return $thedb->insert_id;\r
-       } else {\r
-               return mysql_insert_id();\r
-       }\r
+\r
+       return $db->insert_id();\r
 }\r
 \r
 function last_error() {\r
@@ -78,7 +75,7 @@ function import_cleanup($newuid) {
        q("DELETE FROM `pconfig` WHERE uid = %d", $newuid);\r
 }\r
 \r
-function import_account(&$a, $file) {\r
+function import_account(App $a, $file) {\r
        logger("Start user import from " . $file['tmp_name']);\r
        /*\r
          STEPS\r
@@ -116,7 +113,7 @@ function import_account(&$a, $file) {
                notice(t('Error! Cannot check nickname'));\r
                return;\r
        }\r
-       if (count($r) > 0) {\r
+       if (dbm::is_result($r) > 0) {\r
                notice(sprintf(t("User '%s' already exists on this server!"), $account['user']['nickname']));\r
                return;\r
        }\r
@@ -127,13 +124,13 @@ function import_account(&$a, $file) {
                notice(t('Error! Cannot check nickname'));\r
                return;\r
        }\r
-       if (count($r) > 0) {\r
+       if (dbm::is_result($r) > 0) {\r
                notice(sprintf(t("User '%s' already exists on this server!"), $account['user']['nickname']));\r
                return;\r
        }\r
 \r
        $oldbaseurl = $account['baseurl'];\r
-       $newbaseurl = $a->get_baseurl();\r
+       $newbaseurl = App::get_baseurl();\r
        $olduid = $account['user']['uid'];\r
 \r
         unset($account['user']['uid']);\r
@@ -186,8 +183,8 @@ function import_account(&$a, $file) {
                        }\r
                }\r
                if ($contact['uid'] == $olduid && $contact['self'] == '0') {\r
-                       // set contacts 'avatar-date' to "0000-00-00 00:00:00" to let poller to update urls\r
-                       $contact["avatar-date"] = "0000-00-00 00:00:00" ;\r
+                       // set contacts 'avatar-date' to NULL_DATE to let poller to update urls\r
+                       $contact["avatar-date"] = NULL_DATE;\r
 \r
 \r
                        switch ($contact['network']) {\r
@@ -195,10 +192,10 @@ function import_account(&$a, $file) {
                                        //  send relocate message (below)\r
                                        break;\r
                                case NETWORK_ZOT:\r
-                                       // TODO handle zot network\r
+                                       /// @TODO handle zot network\r
                                        break;\r
                                case NETWORK_MAIL2:\r
-                                       // TODO ?\r
+                                       /// @TODO ?\r
                                        break;\r
                                case NETWORK_FEED:\r
                                case NETWORK_MAIL:\r
@@ -287,8 +284,8 @@ function import_account(&$a, $file) {
        }\r
 \r
        // send relocate messages\r
-       proc_run('php', 'include/notifier.php', 'relocate', $newuid);\r
+       proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', $newuid);\r
 \r
        info(t("Done. You can now login with your username and password"));\r
-       goaway($a->get_baseurl() . "/login");\r
+       goaway(App::get_baseurl() . "/login");\r
 }\r