function checkScriptExists($srData, $dbArr, &$log) { $remoteSrData = getRemoteScriptData($srData[data][scriptID], $dbArr); $linkID = connectDB($dbArr[target][0], $dbArr[target][2], $dbArr[target][3], $dbArr[target][1]); $sql = "select " . "scriptID " . "from " . "scripts " . "where " . "script='" . $remoteSrData[script] . "' and " . "scriptLocation='" . $remoteSrData[scriptLocation] . "' and " . "componentID=" . $remoteSrData[componentID] . " and " . "categoryID=" . $remoteSrData[categoryID]; $result = mysql_query($sql); // SCRIPT EXISTS - RETURN ITS ID if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); $log .= "INFO: Script <b>{$remoteSrData[script]}</b> EXISTS in target DB. Returning existing scriptID={$row[scriptID]}.<br><br><br>"; return $row[scriptID]; // SCRIPT DOES NOT EXIST - CREATE AND RETURN ITS ID } else { return insertScript($remoteSrData, $dbArr, $log); } }
/** * Remove user and optionally reassign posts and links to another user. * * If the $reassign parameter is not assigned to an User ID, then all posts will * be deleted of that user. The action 'delete_user' that is passed the User ID * being deleted will be run after the posts are either reassigned or deleted. * The user meta will also be deleted that are for that User ID. * * @since 2.0.0 * * @param int $id User ID. * @param int $reassign Optional. Reassign posts and links to new User ID. * @return bool True when finished. */ function wp_delete_user($id, $reassign = 'novalue') { global $wpdb; $id = (int) $id; // allow for transaction statement do_action('delete_user', $id); if ('novalue' === $reassign || null === $reassign) { $post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_author = %d", $id)); if ($post_ids) { foreach ($post_ids as $post_id) { wp_delete_post($post_id); } } // Clean links $link_ids = $wpdb->get_col($wpdb->prepare("SELECT link_id FROM {$wpdb->links} WHERE link_owner = %d", $id)); if ($link_ids) { foreach ($link_ids as $link_id) { wp_delete_link($link_id); } } } else { $reassign = (int) $reassign; $wpdb->update($wpdb->posts, array('post_author' => $reassign), array('post_author' => $id)); $wpdb->update($wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id)); } clean_user_cache($id); // FINALLY, delete user if (!is_multisite()) { $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->usermeta} WHERE user_id = %d", $id)); $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->users} WHERE ID = %d", $id)); } else { $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE user_id = {$id} AND meta_key = '{$level_key}'"); } // EKLEME (USER ENGELI EKLE) require_once './dbconnect.php'; $disSql = "DELETE FROM er_disability_user WHERE user_id = " . $id; insertScript($disSql); // allow for commit transaction do_action('deleted_user', $id); return true; }