SMF Package Parser - Source code now available!

Started by Daniel15, January 05, 2007, 11:29:08 PM

Previous topic - Next topic

auroramae

Ok - this is very cool.  I am too stupid to figure out the XML files  I don't have time to try it tonight but it is just what I am looking for to apply 2 mods that are giving me headaches.

HURRAY.... THANK YOU!

Visualcode

Ah, I see. I have had no problems with my mods being in a folder, on SMF. It seems for your parser though, that was the problem.

Daniel15

QuoteNew file uploaded! In UTF-8, should solve character problems!
Thanks for the fix alperuzi, it seems to work fine :)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Sindorf

Quote from: Daniel15 on January 19, 2007, 05:03:01 AM
QuoteNew file uploaded! In UTF-8, should solve character problems!
Thanks for the fix alperuzi, it seems to work fine :)

Working like a charm! :) Thanks Alperuzi and Daniel15 :)

TechnoDragon

Very Awesome utility!

I have it now bookmarked for useful utilities
Don't tell me to get into shape...I have a shape...It is round!


Alan S

It worked perfectly when try vbgamers Staff Page Mod , but when i tried Karlbesons WikiBBC Code mod i got the following errors

Quote
Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 9: parser error : xmlParseEntityRef: no name in /var/www/smf/package.php on line 77

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: <readme type="inline">For 1.1 versions RC1, RC2 & RC3 in /var/www/smf/package.php on line 77

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /var/www/smf/package.php on line 77

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 24: parser error : Opening and ending tag mismatch: uninstall line 23 and readme in /var/www/smf/package.php on line 77

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: type="inline">This will remove the Alternative Wikipedia BBCode support</readme in /var/www/smf/package.php on line 77

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /var/www/smf/package.php on line 77

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 27: parser error : Opening and ending tag mismatch: package-info line 3 and uninstall in /var/www/smf/package.php on line 77

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: </uninstall> in /var/www/smf/package.php on line 77

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /var/www/smf/package.php on line 77

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 28: parser error : Extra content at the end of the document in /var/www/smf/package.php on line 77

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: </package-info> in /var/www/smf/package.php on line 77

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /var/www/smf/package.php on line 77

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /var/www/smf/package.php:77 Stack trace: #0 /var/www/smf/package.php(77): SimpleXMLElement->__construct('<?xml version="...') #1 /var/www/smf/package.php(54): parsePackageInfoXML('/tmp/smf_xml/pa...', 'install', 'theme') #2 /var/www/smf/package.php(642): parseArchive('/tmp/phpt1XiAD', 'install', 'theme') #3 {main} thrown in /var/www/smf/package.php on line 77
Quote from: Eliana Tamerin on August 23, 2008, 04:10:10 PM
SMF 7 is where it gets good. That has time travel. You can go back and post before the guy who flamed you. :P

Daniel15

Alan S, it looks like the & in the readme is causing that (the SimpleXML parser is very strict about things like that)
Are you talking about this mod: http://custom.simplemachines.org/mods/index.php?mod=434? I just tried it out, and while I don't get that error, I get another one:
QuoteWarning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 1: parser error : Start tag expected, '<' not found in /var/www/smf/package.php on line 364

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: com<?xml version="1.0"?> in /var/www/smf/package.php on line 364

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /var/www/smf/package.php on line 364

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /var/www/smf/package.php:364 Stack trace: #0 /var/www/smf/package.php(364): SimpleXMLElement->__construct('com<?xml versio...') #1 /var/www/smf/package.php(333): parseModificationXML('/tmp/smf_xml/wi...', Object(SimpleXMLElement), 'all') #2 /var/www/smf/package.php(54): parsePackageInfoXML('/tmp/smf_xml/pa...', 'install', 'all') #3 /var/www/smf/package.php(642): parseArchive('/tmp/phpouG3Pq', 'install', 'all') #4 {main} thrown in /var/www/smf/package.php on line 364

This is because the wiki.xml file is malformed (the first line is com<?xml version="1.0"?>, the com shouldn't be there). I'll contact the author about it :).

This reminds me, I really need to implement better error checking :P
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

ZeroSkill

Worked great for me. Just installed PostBox Increase Decrease mod :D

heavyccasey

It doesn't parse BoardMods. Do you have any plans to implement them?

Daniel15

Quote from: ZeroSkill on February 11, 2007, 10:53:46 AM
Worked great for me. Just installed PostBox Increase Decrease mod :D
Glad to hear it works for you, and glad to see you're trying my mods :D

Quote from: heavyccasey on February 11, 2007, 10:55:45 PM
It doesn't parse BoardMods. Do you have any plans to implement them?
Not in the near future. I use a XML parser inbuilt to PHP (SimpleXML) to parse the XML files. BoardMod requires a custom-written parser. I could use the parser that the Package Manager uses, but I don't have time to implement this at the moment ;)

In general, no new mods should be using BoardMod - XML is preferred ;)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

OutofOrder

Hi, terrific idea & work there :)
I tried uploading gobaloppers' location mod:
QuoteModifications to SMF files
Error: Modification XML file (/tmp/smf_xml/smf1.1.xinstall.xml) doesn't exist!
I guess that's because of the mod itself, right? What should be done in order to fix it? I'm really looking forward to use this tool to install this mod with my theme.   :o


Then i went back and tried with the "PM on registration" mod.
QuoteERROR: The package-info.xml file is invalid!

Debugging Information
Error message: String could not be parsed as XML
Source: /var/www/smf/package.php:93
Errors encountered while parsing XML file:

Stack Trace:
#0 /var/www/smf/package.php(93): SimpleXMLElement->__construct('')
#1 /var/www/smf/package.php(54): parsePackageInfoXML('/tmp/smf_xml/pa...', 'install', 'all')
#2 /var/www/smf/package.php(707): parseArchive('/tmp/php2xun59', 'install', 'all')
#3 {main}

XML File:
After that it showed an empty space.

I tried it with MemberAwards Mod and it worked perfectly.

Finally, here's a spanish.php file i translated. Had to play with some phrases because grammar is sometimes different ( i.e. we don't say "Installation instructions", we kinda say "Instructions of installation" -or else, it doesn't make sense-. That's why i replaced the phrase with "Installation: Instructions for ...." which makes a lot more sense :) )
You might think the translation ain't reliable, that's why i'll go to the spanish forums to ask some people to come to the thread and validate it :)
Hope it works.

Spanish.php : http://m00.laughingllamas.com/fileupload/index.php?act=dl&file=c3BhbmlzaHBocC56aXAuemlw

Daniel15

OutofOrder, I'll take a look at that later (the first error), and see what's causing it. It looks like the / from the path is being removed, but I'm not sure what could be causing this. When I have more free time, I'll take a look at it :)

For the "PM on Registration" mod, it could possibly be because the mod is inside a seperate folder in the ZIP file. While SMF doesn't mind this, my parser does (due to the way it handles files). If you like, extract all the files in the ZIP, open the directory, and then recompress all the files (so they're in the 'root' of the archive).


Thanks for the Spanish translation, I'll implement it as soon as possible ;)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Daniel15

I've added the Spanish translation

Quote from: margarett on February 15, 2007, 10:00:19 AM
Portuguese translation

http://www.badongo.com/file/2243494
That download isn't working for me. Could you please email me the translation? My email address is daniel15 [-at-] simplemachines ([dot]) org ([-at-] is @, ([dot]) is .)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

OutofOrder

Quote from: Daniel15 on February 13, 2007, 03:40:52 AM
OutofOrder, I'll take a look at that later (the first error), and see what's causing it. It looks like the / from the path is being removed, but I'm not sure what could be causing this. When I have more free time, I'll take a look at it :)
I think you're right. The path should be
.../smf1.1.x/install.xml
Perhaps you've forgotten to add/parse a slash somewhere.  :-X :-X
Anyway i hope you can fix it, and please post back if you do. Thanks in advance.

ZeroSkill


Daniel15

Quote from: ZeroSkill on February 23, 2007, 08:33:18 AM
When package parser will be updated for SMF 1.1.2 ? :)
Oops, I forgot about that :P
It's a very easy change, I'll fix it right now :)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Neol

Quote from: Daniel15 on February 12, 2007, 03:57:15 AM
Quote from: heavyccasey on February 11, 2007, 10:55:45 PM
It doesn't parse BoardMods. Do you have any plans to implement them?
Not in the near future. I use a XML parser inbuilt to PHP (SimpleXML) to parse the XML files. BoardMod requires a custom-written parser. I could use the parser that the Package Manager uses, but I don't have time to implement this at the moment ;)

You mean parseBoardMod()?

http://support.simplemachines.org/function_db/index.php?action=view_function;function=327

Daniel15

Quote from: Zeri YT! on February 26, 2007, 02:04:27 AM
Quote from: Daniel15 on February 12, 2007, 03:57:15 AM
Quote from: heavyccasey on February 11, 2007, 10:55:45 PM
It doesn't parse BoardMods. Do you have any plans to implement them?
Not in the near future. I use a XML parser inbuilt to PHP (SimpleXML) to parse the XML files. BoardMod requires a custom-written parser. I could use the parser that the Package Manager uses, but I don't have time to implement this at the moment ;)

You mean parseBoardMod()?

http://support.simplemachines.org/function_db/index.php?action=view_function;function=327

Yep, that's the one :).
I'm currently not using any SMF functions, other than read_tgz_data and read_zip_data. I may implement the BoardMod stuff, but it's not a big priority for me (I designed this to be an XML parser, after all ;))
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Advertisement: