Closed pascalchevrel closed 11 years ago
Maybe it's more interesting to create a "Transvision API" that generates and serve TMX and JSON files. More work, but maybe more useful. In fact it's "only" display the result page in XML(TMX) or JSON depending on the parameters in the URL.
What do you think? (or do you have other ideas for the download page?)
ok, so let's do the download page :) Can I help with that?
If yes, I going to need a little help, because I don't understand very well the part of separate the TMX files "from the cached array files we use in Transvision". Is the download page any other thing that a list of the cached TXM files hosted in transvision server?
it is nothing else than that, we have a TMX file per locale and per channel, so we just need a big table of links :) Assigining to you per your request ;)
Do I plan it for 2.6 this week or do I plan it for 2.7+ ?
I can send the pull request tomorrow (I have to implement the tests yet).
Anyway, I would like to talk with you about how I've done it, I'm not sure if it's the best way...
if you have already created a branch, I can import it locally to have a look before the PR :)
Tomorrow I'll upload it to github ( all the code is in my computer at work :S ) and I'll let you try it
ok, this is the branch https://github.com/tx2z/transvision/tree/issue76
I've created the view "downloads.php". It gets all the locales from central repository (I'm not sure if this is the most complete, the idea is to have an array with all the available locales) and then I've created another function in Utils that check if the TMX file of every locale in every repo exist, and it generates a table with the links.
Maybe not the best in terms of performance (It checks all files when the page is load). Another idea (but more work) could be create a cache file with this information and only reload it every day / week... What do you think about it?
I looked at your branch and reworked your code locally to make it a bit simpler, can you do a pull request? I will send my local patch behind it.
Regarding the caching system, I think it's ok to leave it without caching for now, the page will not be used by many people and the impact won't be important. I think we need to write a caching system that we could plug into the page later but that would be reusable outside of the page.
There is one problem with using the TMX constant as the base for the link which is that it is a link to the filesystem (/home/...) which works for includes and probably locally for you, but on the real site the hg/TMX data is not in the webroot, there is a symlink to that folder on production (the reason is backups and the fact that we have two instances of Transvision, release and beta site, sharing the same data).
I think we should just generate these symlinks in setup.sh and redefine the TMX constant to point to that.
Ok, done, tell me if I can give you a hand.
actuallly, now that we want proper downloads, we should change the mime type for the tmx files, fortunately francesco patched that last week :)
The page is created there: http://transvision-beta.mozfr.org/downloads/
I am keeping this issue open for you to write the tests
ok, I have to "study" all your notes :) thank you for take the time to comment them!
I'll write the test (tomorrow I think :) )
Hi, I have a problem to write the tests. The constants variables defined in constans.php are not included in atoum and I didn't find an easy way to include them.
Same problem occurs with my changes on the bugzilla json file (if you launch the test right now you can see this errors).
What do you think? Do you see any way to integrate the constants in atoum? maybe it's better to do not use the constants variables in the code?
doesn't defining the constant with a relative path in the data provider work ? like: const TMX = '../../../TMX';
Can you take a look at my PR and tell me if I've done it right?
I've included the "config.ini" values (because if not it's only going to work in my computer, I think) and then defined the global variables.
We should create a download page for out TMX files and probably separate them from the cached array files we use in Transvision.
We could also propose other formats, json in particular.