Analysis and Diagnostics module
mridgwel
Joined: 2007-01-27
Posts: 215 |
Posted: Mon, 2009-02-09 18:02 |
Hello, I've written an analysis module to list things that need attention: Now installable from the community repository: http://codex.gallery2.org/Gallery2:Modules:mranalysis Currently it adds two views to the Administration section: 'Broken Images' - Lists photos which have broken derivatives so these can be investigated. If you have any ideas for features, design or improvements on the current code, please post here and let me know - Thanks! Currently I've only tested this on MS SQL Server 2005, but in theory it should work with other platforms - let me know either way if it works for you if you are using a different database. Full version history and screenshots. |
|
Posts: 27300
COOL!
A few issues:
module.inc I had to change the CaSe of the call:
else I got a error.
Don't know why you need a markup bar in BrokenImages.tpl
I did not have any broken images so can't comment on if it is required or not.
I think users would like to see some more action items for the broken images, perhaps a delete derivative?
Keep up the good work!
Can you create a codex page? Let me know if you need help with that.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 215
I've corrected the case and removed the markup bar.
I didn't do anything with the derivatives other than bring up the edit page - my broken derivatives was down to a bad transfer of files to my new server - and just needed a new image to be uploaded. - There is already a plugin (customderivatives) which does a lot with derivatives on the item edit menu.
_________
Mark
Posts: 4342
also how about uploading it to the community repository?
Sign up for a sourceforge.net account if you don't have one, and forward your details to Floridave (I think?) then follow these instructions:
http://codex.gallery2.org/Gallery2:UploadToRepository
Posts: 27300
Well I can get it to the right person, but the best bet is to pop into IRC ( http://codex.gallery2.org/IRC ) and see if bharat or ckdake are about.
Would be nice if it was available via downloadable plugins.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 2258
Yup, please e-mail your sf.net user name to ckdake atz ckdake dotz com and I'll get you added and send instructions your way.
____
http://ckdake.com/ - If you found my help useful, please consider donating to Gallery.
Posts: 244
Thanks for this great idea and your work! This plugin makes my work much more easier ;-)
I've found a few issues and workarounds/fixes for ver.0.0.4:
1) DefaultFileNames:
- Does not bring a result for me. By changing line 89 in 'DefaultFileNames.inc'
from:
$items = ItemList::readItemsFromQuery2( $query, array( "DefaultFileNamesView", "IsDefaultFileName" ) );
to:
$items = ItemList::readItemsFromQuery( $query, array( "DefaultFileNamesView", "IsDefaultFileName" ) );
seems to fix the error.
- Typo in DefaultFileNames.tpl
I think line 51 should be:
There are no items that have default (Camera generated) filenames.
2) MissingTitles:
- The same issue with
ItemList::readItemsFromQuery2
in line 96 of MissingTitles.inc.3) Classification:
As far as I understand for both you are using the classification to filter the results. Only items with numbers after the given prefix should be listed.
This is an really good enhancement, but seems not to work for me.
I have a entities beginning with 'Petrasch' (filename and title). These items are listed under DefaultFileNames/DefaultTitles - but they shoul not.
By now I have not found a workaround. Tried e.g. to alter manually the prefix in Classification.inc (to 'P_' and/or the search string in the SQL-request to 'P_%'. Nothing happens. The results are still the same...
Suggestions
Now your prefixes/search-strings are located in 3 files. What about storing them in an separated file? Think this would be easier to maintain. Better would be to give the user the possibility to alter these values via an option page at the admin interface. There are many different default prefixes so I would give the possibility to maintain it for personal needs.
As I am far away from giving all items individual names and titles I have a list of nearly 600 items. I think it would be a good idea to give the user the option to activate a pagination and the adjustment how many items per page should be shown.
Did you thought about a limitation of the query? I think the plugin could run into trouble if you start the query on a huge gallery with a lot of default items.
Keep on tis good work!
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 215
I've updated to v0.0.5 which corrects the issues with DefaultFilename.inc. and have moved all the prefixes code into Classifications.inc. I've added your requests for prefix customization and paging to http://codex.gallery2.org/Gallery2:Modules:mranalysis#Requested_Features - I agree, paging is essential.
To be honest, I don't get the issue with the 'Petrasch' in the title that you report - I've tried creating items called 'Petrasch', 'Petrasch 42', 'Petrasch42' etc but haven't been able to reproduce the problem. - It may be a bug I've fixed somewhere between v0.0.4 and you reporting problems.
_________
Mark
Posts: 244
WOW, that was really fast!
Thank you for the update. All works fine now, including the filtering-feature by classification.
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 244
Hi Mark,
I have written two additional views for your plugin:
'Missing Tags' - lists all items without tags (including Edit Tags link)
'No FileExtension' - lists all items with no extension in their filenames.
If you want to integrate them into your plugin I have attached them to you.
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 215
Thanks! I've added them and they're in v0.0.6.
They've already found some problems in my gallery that I need to fix ;-).
Does the tags module need to be installed\configured for the 'Missing Tags' view to work? - I haven't added a check for this yet.
_________
Mark
Posts: 244
Thanks for pointing to this.
Yes, the tags module need to be installed for the 'Missing Tags' view. So the check for this should be made. I did not keep this in mind.
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 215
I've just installed the tags module, and it claimed all my items had tags! I've corrected the SQL so it now uses a left join rather than a product:
I've submitted this along with the changes to enable\disable the tags checks if the tags module is not installed or not enabled.
Have also added a 'duplicate titles' test, but this is still experimental so let me know if it gets anything wrong. - have bumped the version to v0.0.7 for this.
_________
Mark
Posts: 244
Hi Mark,
have found time to work with the new version yet - and all works fine, including your new feature.
On what base did you set the required core and api versions for your plugin?
Do you plan to change the kind of implementing the plugin into the admin panel? What are you thinking about the following: one entry at the sidebar and a visuel integration like the maintenance-module? So we prevent the growing of the sidebar-entries for each new view ;-)
//EDIT:
...found a little issue...
Items without broken derivatives are listed at the view 'Broken Images'. This happens under the following circumstances.
You have defined more than one view-size per item. Freshly uploaded items without generated derivatives are listed.
This could happen if these view-sizes of the items are not yet visited (and created) or if you deleted all resized images via support-tools.
Cause is the check for width/height = zero of the derivatives.
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 215
in terms of base and core - I just coppied these from another working module - can't remember which.
Having one entry in the sidebar Is something I'm undecided about - it was something I considered when doing the initial version, but eventually decided against it. Obviously if this list gets ridiculously long I'll need to reconsider this. If I do go down this route, I'll have two entries on the sidebar - one for settings, one for te tests.
I deliberately put the zero sized images in and treated them as broken as I've had oddities where even after viewing the resizes and rebuilding from the maintenance, they stayed as 0x0. I haven't manages to track down what. It may be an idea to split these up.
The settings page seems to be becoming more important now - I'll have a look at implementing that next.
I've added support for missing Google map entries for albums only in v0.0.8 if assuming that is installed and active.
_________
Mark
Posts: 215
Just added a settings page - v0.0.9 - allows toggling of whether zero sized derivatives are treated as broken images.
_________
Mark
Posts: 244
Thanks for the update.
I have two questions:
You have defined $query in 'DuplicateTitles.inc' twice. As far as I understand the first one is obsolete. Did I understood right?
In 'DuplicateItemChecker.inc' you are using the second if-condition for the check if the possible duplicated titles are in the same album. For testing purposes I have deleted this condition. My results are still the same. Only items within the same albums are found. Did I make a mistake or could this condition be eliminated?
I wanted to test if this test could found duplicate titles in different albums too...
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 215
The first $query is redundant.
The check 'if( $this->lastitem->parentId != $item->parentId )' is important - without this I had a few things which had the same title, but in different albums.
If you want to check for duplicate across ALL albums then I'll add this as an option - shouldn't take too long to do.
_________
Mark
Posts: 215
Have added a setting to 'Expand' the duplicate titles check across albums. Now in V0.0.10.
The check for duplicate items across albums is more than just changing\removing the line you found - the items come in pre-sorted by the database within album groups so removing the line you removed would only match items across albums where the last item in album A was the same as the first item in album B.
Let me know if the changes work for you.
_________
Mark
Posts: 244
Works like a charme - thank you Mark!
In an earlier version there was the 'Strings.raw' included. Do you have an actual one? If not I would create one by hand. If you are interested in I could localize the module for the German language.
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 215
I'm interested - I'll need to modify the tpl files to use the g->text rather than just the English text. I'll let you know when I've produced the strings.raw - the original strings.raw was somewhat out of date\incorrect having being copied from the module I used as a base to start coding.
I'm not sure what needs doing after the strings.raw is produced - IIRC there's something to do with .mo and .po files, but I'll need to read up on them.
_________
Mark
Posts: 215
I've produced the strings.raw - its submitted into the latest subversion commit and in the current zip at http://www.markridgwell.com/gallery/mranalysis.zip
_________
Mark
Posts: 244
From the strings.raw you can create a so called .pot file as a template with all translatable strings in it.
On this base you could create a .po (portable) file for a language - this is the human readable file for a specific language with the original and the translated strings.
The last step is to create the compiled .mo file.
For the English language you do not need to do these steps, because there is nothing to translate ;-)
Further information you can find: at http://codex.gallery2.org/index.php/Gallery2:Localization and Wikipedia
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
//EDIT: you are faster - I will work tomorrow on it and will give you the files
Posts: 244
I have created the needed files for localization and the German language files. The file strings.raw I have updated with one string (Edit-Tags). You can find all language-related files in a zip file at http://jekophoto.eu/downloads/download.php?file=mranalysis_loc_de.zip
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 4342
I'm really interested to hear how the translations work when you get the compiled .mo files into the -contrib repository.
I've had a lot of problems reported with the checkout series of modules in respect of language packages not being downloaded correctly (and therefore translations remaining stubbornly unavailable). I can't find any fault with the way the language files are included in the checkout module and I have a (totally unsubstantiated) theory that the problems stem from the rewrite of the language system in G2.3. So it would be really good to get a green/red light for another recently updated module which has translations in -contrib.
Thanks!
Posts: 244
Hi alec,
I will test the plugin when it's available in its new version at the repository and will give you my feedback. Depending on the result we could need a workaround like for your checkout modules. I have given you a thought of mine at Checkout module and languages.
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 215
I've put the translations in as v0.0.11 and switching language to German has correctly switched the language. Let me know if it works when downloaded from the -contrib repository and any changes I need to make to persuade it to if it doesn't.
_________
Mark
Posts: 244
Just tried to install it from the community repository - without success.
Served version is 0.0.10 (build 10212). Download stops with the following error message:
Error (ERROR_PLATFORM_FAILURE) : Size of '/.../gallery2/modules/mranalysis/MANIFEST' did not match package descriptor.
The error is reproducible. Clearing downloaded files and the cache does not help.
As far as I can see in the file system the downloaded version is really v0.0.10 without any language file.
btw: Are there update cycles for the repository or should the new version be available yet?
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 215
There are update cycles, but I would have thought that it would have passed through the update cycle - I can't remember when they go off but there are several a day. I've reupdated and submitted the manifest seeing it claims it has changed - so it may be I missed that.
_________
Mark
Posts: 4342
every six hours: see http://gallery.menalto.com/repository/status
Jens_k: I've updated the checkout language files and if I've done the upload to the repository correctly it should be ready to test after the next push. Which is in about 3 hours from time of writing.
Posts: 244
The push to the repository was run.
For Gallery Plugin-update there are no changes for me with version 2.3:
mranalysis: v 0.0.10 with the same error-message
checkout: version 0.4.3 (no folder ./locale and no .mo files in the folder .po)
checkoutemail: version 0.4 (empty folder ./locale and no .mo files in the folder ./po)
Tried to uninstall/deltete items, cleared the cache, etc. nothing brings me to a positive result.
Wanted to check with an pre-2.3 version too (api versions 7.18 / 3.4) - but without success. Seems to me that the required api-versions are to high for this test (7.4 and 3.0 for checkout / 7.41 and 3.9 for mranalysis).
There are two options I could imagine. There is something wrong with the repository or the error is sitting in front of my pc ;-)
I think the second is the true one. So it would be helpful to get test-results from somebody else.
Cheers,
Jens
____________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 4342
I've only updated the checkout module, not checkoutemail, yet.
I had to delete my test installation of checkout because the update failed (on a language file, but that might have been spurious, I can't tell.)
On a *new* installation, there were no .mo or .po files included. I then had to go to the language-manager page, remove the english (UK) setting, save, reenable it, save and then the en_GB.po and en_GB.mo files were downloaded and installed to g2data/locale/... etc, and active (hallelujah).
Then I went back to the language manager, moved the deutsch setting to "upgrade", hit save, and that downloaded the de.po and de.mo (and copied them under the correct name into g2data/locale... etc).
So maybe you need to play with the language manager settings.
Posts: 215
I've just killed mine and got the same issues with the error platform failure.
Not sure what I'm doing wrong - I follow the following steps after checking in any changes:
1. Update Manifest
php.exe lib\tools\bin\makemanifest.php -p modules/mranalysis
2. Submmit manifest
svn commit --username=mridgwel -m"update Manifest"
and somehow it has managed to do something that its unhappy about.
If I kill the manifest and start again, I get:
_________
Mark
Posts: 244
This way works...
As far as I have tested you can do the language upgrade for all activated languages in one step, even for the default language. After the upgrade via the language manager they are up-to-date (tested with "German" as default language).
For the checkout all is fine. For checkoutemail the download of the language files will be done but my galery ignores them at the old structure. So they need to be directly at the ./po folder.
As you defined with the needed API-settings in module.inc your modules will only work with Gallery 2.3 and greater. So you do not need to carry about the old structure for your modules.
Sounds not really intuitive to upgrade all installed languages after installing or upgrading a plugin - I think this could cause some trouble for the users. Therefore it's good to know.
@ Mark: I have updated the zip file - the localization will work with gallery version 2.3 and greater, as you limited in modules.inc.
The structure ./locale/de/LC_MESSAGES/... can be deleted. This seems to be obsolete since version 2.3.
Cheers,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
//EDIT: sorry, I can't help you, for this I have no knowledge. I hope Alec could point you to the right direction.
Posts: 4342
Patience... I haven't (hadn't) done checkoutemail, just checkout. I'm doing the other checkout modules now.
Posts: 244
I am patient ;-)
Only wanted to approve that the old structure for the language files is obsolete (even if the files were downloaded).
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 4342
According to the developers the old file structure (module/locale/...) is (should be) used as a fallback to copy the .mo files to the g2data/locale/... directory if the .mo files aren't found in the module/po directory. That seems to be where things were falling down.
I've updated all the checkout modules (*email, *paypal, *download etc) removing the locale directory and adding the .mo files in the po/ directory, so they should be good to go when the next repository push goes through. I've also updated with the latest translations that I can lay my hands on.
Posts: 244
@ Alec :
Do you know what this could caused by and could you support Mark?
Thanks,
Jens
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 215
Its almost as if its decided to ignore the last update. I've spent a bit of time looking at the files and noticed that the ones which appear to get marked as changed didn't have the same svn auto-props and line ending tags as others. I've corrected those, and am waiting on the 12pm push. Could do with a big button that says 'push now!' so I can make a change and see what happens. The debug log didn't seem to give me much help when looking at the platform failure.
_________
Mark
Posts: 4342
Important to get this right, especially if you're developing on a windows system. subversion will do unix<->windows line end conversions if you get it right.
See http://codex.gallery2.org/Gallery:Using_Subversion, Developer info section.
Posts: 215
I did have it set then I updated subversion and it seems to have stomped on my config file. Am hoping re-tagging the files with the line ending stuff and re-submitting will help.
_________
Mark
Posts: 215
Still doesn't work.
How do I find out which file(s) its unhappy about?
And more to the point how do I find out if I've been successful without having to wait 6 hours for the next sync?
_________
Mark
Posts: 215
This might sound silly, but a MANIFEST file shouldn't contain a line for the MANIFEST file should it? Others don't appear to, but mine strangely insists on putting it in.
_________
Mark
Posts: 215
I've excluded the manifest file and submitted a manifest without a manifest so that its like the others. I don't understand why the preg_match in the makemanifest.php doesn't match the line with the manifest in it.
_________
Mark
Posts: 244
Sounds strange to me - nice to read that you solved this.
Now the download and installation of version 0.0.11 works as expected for the plugin.
The language files were not downloaded. Updating the German language via the filemanager seems to change nothing for me. Are they included yet?
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 215
They should be included. They're even listed in the manifest.
When I murder my files and go to download from the community repository I get:
Do you get something else?
_________
Mark
Posts: 4342
Mark,
The de.po isn't downloading for me either, even though (as you point out) it shows as available. It's not downloading in initial install (with de enabled) or after an update of the de language in the language manager.
I've tried packaging it myself (discovered today you can do that) - and the packaging works ok except I get a php warning
I've looked at that file, but a cause doesn't jump out at me. I know not if this is significant somewhere.
Also can I suggest changed the de_DE descriptor to de to match the other de translations? I think the country code should be added by default, but just in case...
Posts: 215
Have just changed de_DE.* to be de.* like the others.
Hopefully this will work.
_________
Mark
Posts: 244
Thanks Mark - now all works great!
___________________________________
http://jekophoto.eu | http://jekophoto.de
Posts: 17
Hello Mark,
I was wondering, can I use the Maintenance option "Keyword Analysis: Add missing Keywords" to read changed keywords from the iptc info of the pictures and put that into the DB?
I have a lot of images wich changed the iptc keywords, but gallery2 only puts the iptc keywords into the database the first time you uploaded the image.
The is no Maintenance option for that (yet)
peter.
Posts: 215
The Add missing keywords is a feature I've not really finished - was intended to look at other keywords on an item and suggest keywords that are related from a configuration file. e.g. if you had a keyword that mentioned a specific type of bird, you could configure it so that it would add\suggest the keyword 'Bird' to items.
I tend to maintain the keywords in G2 and then extract them out of the DB to tag the original images, so have a different workflow to you.
If you can write PHP, and want to add your mechanism then feel free to update the source of the module, or if you would prefer, create your own to do this. I believe there are other modules which read information from the image e.g. the google maps module reads GPS info from an image.
_________
Mark
ACCU - www.accu.org - Professionalism in Programming.