Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add attachment conversion support #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Habbie
Copy link
Contributor

@Habbie Habbie commented May 6, 2013

Hello,

this patch adds support for converting attachments. It posts them as gists (one gist per attachment) and then posts comments to the ticket.

Limitations:

  • it fetches attachments over HTTP (I don't recall whether they're in the trac DB too)
  • the comments linking to the attachments appear before all other comments, instead of chronologically like in Trac

When I used this, I hardcoded the URL. For this pull request, I moved the URL to a variable. I did not test this.

I extracted this patch from a bigger bunch of changes; I did not test the code after extraction. If anything is broken, my apologies.

@Habbie
Copy link
Contributor Author

Habbie commented May 6, 2013

Replying to #5 I realise this pull request depends on SQLite. Remove rowid, from the query, and from one of the prints, and it is portable to MySQL.

@trustmaster
Copy link
Owner

Does it have to have both $row['id'] and $row['rowid'] for SQLite?

@ctrueden
Copy link
Contributor

ctrueden commented Jan 8, 2014

@trustmaster: I am no expert, but at least with my SQLite3 Trac environments, here's what I see:

sqlite> select count(*) from `ticket`;
822
sqlite> select count(*) from `ticket` where rowid <> id;
0

I am guessing id vs. rowid doesn't matter unless you start manually deleting rows from your ticket table.

So for consistency (assuming @Habbie ever comes back to this), I would suggest the patch just use $row['id'] like everywhere else does.

@Habbie
Copy link
Contributor Author

Habbie commented Jan 13, 2014

id vs. rowid actually makes a big difference in the attachment table:

sqlite> select id,rowid from attachment limit 3;
8|1
8|2
8|3

However, the only reason rowid is in the select is so we can print it. Drop it from the select, drop the print, everything should work with both SQLite and MySQL again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants