# من SMF2 إلى discourse - مشاكل في استيراد المرفقات

**URL:** <https://meta.discourse.org/t/smf2-to-discourse-troubles-importing-attachments/89302>\
**Category:** Support\
**Created:** [6 يونيو 2018، 9:46م UTC](https://meta.discourse.org/t/smf2-to-discourse-troubles-importing-attachments/89302 "2018-06-06T21:46:17Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![marcozambi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marcozambi/32/119505_2.png) [@marcozambi](https://meta.discourse.org/u/marcozambi)\
**Post date:** [7 يونيو 2018، 5:47ص UTC](https://meta.discourse.org/t/smf2-to-discourse-troubles-importing-attachments/89302/3 "2018-06-07T05:47:44Z")

</div>

Thanks a lot @pfaffman.  
If I understood correctly your suggestion, I had to adapt it to the smf2.rb import script.  
Since there is no such method as mysql\_query(sql) in the script, I have updated what I think is the most likely equivalent of it.

```plaintext
def __query(db, sql, **opts)
    db.query(sql.gsub('{prefix}', options.prefix),
      { symbolize_keys: true, cache_rows: false }.merge(opts))
    rescue Exception => e
      puts '=' * 50
      puts "Problem with database. Trying again in 5"
      sleep 5
      puts e.message
      db = create_db_connection
      db.query(sql.gsub('{prefix}', options.prefix),
        { symbolize_keys: true, cache_rows: false }.merge(opts))
    end

```

What do you think?

Later today I’ll give it a try and come back with feedback.

---

_[View the full topic](https://meta.discourse.org/t/smf2-to-discourse-troubles-importing-attachments/89302)._
