These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Yapeal PHP API library (version 1.0.5)

First post
Author
Dragonaire
Here there be Dragons
#181 - 2011-12-18 04:56:36 UTC  |  Edited by: Dragonaire
Quote:
I'm running it from the command line, but it kept complaining about not being able to find the database password, which is logical, as there isn't any.
So how does it work later while running it since Yapeal requires one then as well Question but it can be blank. You do know it can pull all the settings from your config/yapeal.ini file right without having to use the command parameters? Maybe you've missed it in this thread or in the CHANGELOG but the scripts in install and yapeal.php itself have had a overhaul that added some better command help etc. Might try createMySQLTables.php --help to see what is new.

Quote:
It also seems to be trying to connect over a unix socket, which is never going to work, but I guess this has more to do with php than with yapeal, as it worked later.
Yeah sounds like you were having some kind of database connection error there that cleared itself up. You might make sure the settings in my.cnf are right.

Quote:
What sections is the script updating at the moment?
It doesn't do that but in the help message it tells you the default order which is util, account, char, corp, eve, map, server. So it's in alphabetical order except for util because each of the other sections update tables in it so they have to exist first. You can also tell it to run just one or a couple by adding the optional --xml=util ... parameter.

Quote:
What queries is it going to execute?
It saves the queries it was trying to run into cache/ADOdb/*.sql one per section.

Quote:
What is the result of the queries, and the result per section?
The part of ADOdb used to run them doesn't really let you know just if it worked or not.

Edit: Also be nice to see you in chat again the evephp is gone until I find a new place to host it but I'm still around so convo me.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Dragonaire
Here there be Dragons
#182 - 2011-12-18 07:37:41 UTC
Thanks to some work by Satis Iqulenax over the last week or so she has added the faction APIs to Yapeal the only problem is since neither she nor I have any character/corporations doing faction warfare we have no real way to test all of them Sad So we're looking for some testers that are involved in faction warfare to do some testing for us on a test build and give some feedback. They should be all working as most of the code came from other know working code in Yapeal but typos happen Blink If you are interested in helping out either Eve-Mail me or let me know in the thread here so we can get in contact with you and give instructions about the where and how to get the code that needs to be tested.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Xander Hunt
#183 - 2011-12-18 14:12:00 UTC
Dude, this is pretty damned sweet. At first, when I looked at this entire project I thought it was another PHP framework that I had to use in my own PHP code. Instead, I found out that it drops data directly into a database for me. Perfect. :]

I was a little frustrated at start when I ran the [php yapeal.php] script that I didn't see much activity in the database. I looked at the charAssetList after running the script and noted that it didn't add anything. After mucking around, found that I had to enable the option in the utilSections. I don't remember reading that anywhere. :( I have not had the chance to dive into the rest of the code yet, but maybe on the Wiki you could set aside some hints on how to get the ball rolling from a brand new install? Personally, I'd like to see a HINTS/TIPS section that'd give up some details on raw SQL queries to get some data out.

I've been working on coming up with a new Asset Manager (Since HeavyDuck isn't really doing much with his, and the old API system is going to be going bye bye, AND his UI is looking dated - NO OFFENSE!), and found your link about how things are done with the nested rowsets. Very VERY facinating (and new to me) method to say the least. The question I do have though is why you chose to go the route you did with this method of containing the data? The concept I get after looking at the external wiki you linked to, and its quite clear in my head, but, isn't it a bit overboard?

What I mean is, since a single item can only be placed in a container, on a ship, in a station, in the solar system, in the constellation, in the region, in the universe, that single item has a parent which is the container, and that container has a parent which is the ship, so on and so on. Standard Primary Key to Foreign Key relationship. No need for even an additional table since its a one to many relationship (But then again, a many to many relationship is just with an additional table linking O2M and M2O.)

Using your particular method (Which I am NOT putting down), if I wanted to find out what items I own are in a station, I'd first do a query to find all distinct itemID rows in a particular location. Now I'd make another query and find out what items are in that station, including GSCs, SWH, etc. But this is where things kind of get difficult to sort out at least on thrashing the database (Something I wish to avoid doing)

Here's an example of how I'm conceptualizing the pseudo code;

I have a Mammoth. The typeID for the ship is 652. Doing a query against this typeID gives me a lft value of 204 and rgt value of 315. So now my next query would want to run against all fields between lft and rgt of 204 and 315 respectively. This returns a count of 56 items in my case. I know I have 4 GSCs sitting on this ship. Each of these four containers are going to have their own lft and rgt values. Thing is, being a fore-thinker, I know that I'm going to have to re-query, or ignore somehow, the result set from the first query.

select lft,rgt from charAssetList where typeID=652; --Query #1
-- Have a list of all my mammoths - Which is one. Returns 204 & 315
select * from charAssetList where lft>204 and rgt<315 where ownerID={MycharID}; -- Query #2
-- First several rows return lft+1=rgt
-- Skip a few of the result set, I now have the GSCs, so have to requery
select * from charAssetList where lft>227 and rgt<310 where ownerID={MycharID}; -- Query #x
-- Process this result set as usual
***

So now I'm stuck. I've already 'worked' on the items between 227 and 310 and now I have to "remember" that I've dealt with this particular set going down the rest of the rows from the query #2.

Am I looking at this right?
Dragonaire
Here there be Dragons
#184 - 2011-12-18 17:29:54 UTC
you might try looking for the GSC first and use lvl or flag to find only the ones you want. Another idea is if you only want the GSCs that have items in them filter on rgt > lft+1.
The remember part is easy just use a foreach loop it'll walk through the items returned in your outer queries. I think in part the mistake you are making is trying to think about how to do stuff only in SQL or only in PHP instead of use each of them where they make the most sense.
Also to make your queries cleaner and faster try using between in SQL.

http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html#operator_between

So
Quote:
select * from charAssetList where lft>204 and rgt<315 where ownerID={MycharID}; -- Query #2

becomes
select * from charAssetList where (lft between 205 and 314) and ownerID={MycharID};

You have to learn to think in a bit different way about how to get to what you want. Often times turning the problem and queries around will show you a better way. Always start by asking yourself what you want to get and see if there isn't a direct query that gets the items you're interested in then figure out where it happens to be. Hopefully that'll help you in using it more effectively.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Callean Drevus
Perkone
Caldari State
#185 - 2011-12-23 16:07:02 UTC  |  Edited by: Callean Drevus
Yapeal has a problem where the log directories for log4php are not relative to the script execution root. Which is annoying to say the least. As it differs from how it originally worked.

Ok, no, I got it wrong. The config file has actually changed, and it meant that yapeal suddenly didn't work anymore, because I was using the old config file (and the new config file still doesn't count log directories relative to the script execution directory).

I just hope that this doesn't catch anyone else off guard. Blink

Developer/Creator of EVE Marketeer

Dragonaire
Here there be Dragons
#186 - 2011-12-23 17:19:39 UTC
Yeah someone else was having problems with the log file paths as well a while back but it's easy enough to simply update config/logger.xml. When I get a chance I'm planning on looking into ways Yapeal can set it to use the same common paths that Yapeal uses but since it's an outside library now being use instead of code from Yapeal itself it's a bit more complicated Blink

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Dragonaire
Here there be Dragons
#187 - 2012-01-02 02:29:45 UTC
Hi everyone and Happy New Year Big smile So I've been working on a couple things in Yapeal and decided I should push them out to everyone.

First Ruziel reported a bug in Contracts API with how Yapeal handled ones that hadn't been accepted or completed yet. The API sends empty string value for 'dateAccepted' and 'dateCompleted' so it needs to be changed to a NULL for the insert/upsert. This seems to now be fixed now.

I've also been trying a new development tool PhpStorm that another developer told me about and I've been trying out some of it's features. Your can get it from
http://www.jetbrains.com/phpstorm/
One of the things I've been trying out was a complete inspection of Yapeal with it's inspect code feature. I told different developer about it and he said he'd be scared what it would report if he used it on his own code Blink I'll have to say when you get back a report with 8000+ things it found Shocked it wasn't much fun but after looking at it some I realized most of them were 'spelling' errors including name of variables etc. There were some actual spelling errors too in some of the comments and I fixed them Blink but the other problems it found were a bit more interesting.

Most of the rest of the problems it found turned out to be in the other libraries I use like log4php, eac_httprequest, and ADOdb in ext/. I already know there were problems with ADOdb since every time I really take a look at it's code I shutter and get this overwhelming urge to either try fixing it or go hide somewhere because of all the problems that exist. It works very well and doesn't have any real 'bugs' as such but you can tell many people have handled it and it still has a lot of legacy code from the PHP4 days that it just hasn't been able to shake off yet. So the first thing was to exclude ext/ and a couple other things that are outside of Yapeal itself that I just use in development. So next I figured out how to filter out stuff I wasn't interested in for now like everything in ext/.
So after filtering I only had a little over 2000 with 1800+ being spelling stuff which can largely be ignored but it still does look great yet for Yapeal. Some of the rest were pointing out the limits of the inspection feature itself in understanding dynamically building SQL and understanding how I'm using the magic functions like __get() and __set() in a couple places which isn't surprising since I've had to explain it to more than a few people that had never seen them used before in PHP Smile

In the end after the manual filtering I did find several minor problems that needed fixing like not initializing some variables correctly, and some unused properties in some classes which were easy to fix. I also found a few places where I could simplify some if/else statements at the end of methods etc. There are some additional things I'll be looking into changing as well but they more about doing things in simpler ways or breaking up some of the more complex tasks which is something that is always an ongoing process in Yapeal anyway for me Blink

Over all Yapeal was fairly clean which made me very happy Big smile

So you can get the new fully inspected version from the Mercurial or archives.

version 12.001.1845

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Tanith YarnDemon
Hypernet Inc.
Umbrella Chemical Inc
#188 - 2012-01-03 04:32:36 UTC
I'm sure this is due to my own incompetence but couldn't find much about it online and noticed your last post revolving quite a bit about ADOdb so figured it might be related. Using a clean windows install, wampserver and Yapeal 12.001.1845

Setup went suprisingly smooth, but upon execution of yapeal.php I get a

Fatal error: Declaration of ADODB_Exception::attach() must be compatible with that of IYapealSubject::attach() in C:\wamp\www\yapeal\class\ADODB_Exception.php on line 68

Call Stack:
0.0009 373440 1. {main}() C:\wamp\www\yapeal\yapeal.php:0
0.1573 878176 2. YapealDBConnection::connect() C:\wamp\www\yapeal\yapeal.php:146
0.1579 919920 3. require_once('C:\wamp\www\yapeal\class\ADODB_Exception.php') C:\wamp\www\yapeal\class\YapealDBConnection.php:97

Any ideas?
Dragonaire
Here there be Dragons
#189 - 2012-01-03 06:35:16 UTC
Yeah it looks like I broke something trying to fix something else I'll try to get fix out in the morning after I've had some sleep and figure out how it broke and how to fix what I was trying to fix Blink

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Dragonaire
Here there be Dragons
#190 - 2012-01-03 17:46:19 UTC
Ok I pushed out a update that has remove the rest of the old legacy logging system that used observers so you shouldn't get that error anymore, just some new ones maybe Blink

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Halonet
Imperial Shipment
Amarr Empire
#191 - 2012-01-04 08:55:03 UTC  |  Edited by: Halonet
Hi Dragonaire,
I have tested yapeal yesterday and I do like how it works. Great job.
But I did not found what I was looking for, and it is data fetched from http://wiki.eve-id.net/APIv2_Char_ContractItems_XML
Was it me or there is no way to fetch the data with curent library?
Dragonaire
Here there be Dragons
#192 - 2012-01-04 17:37:17 UTC
I'm sorry to say the person that was working on Contracts ran into some technical problems with ContractItems and ContractBids and then kind of drop out of Eve for a while and didn't finish them Sad I've been busy with some other projects as well so I haven't looked into it to see what it would take to work around the issues he ran into yet. I think the main thing was CCP deciding to use a single mask for all three APIs and how Yapeal decides which APIs are do to be retrieved etc. I'll try to get to it when I have a couple other things out of the way. If you could add it as an issue so it reminds me that would be great as I have forgot it a couple times over the last few months with everything else I'm working on.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Halonet
Imperial Shipment
Amarr Empire
#193 - 2012-01-04 18:31:39 UTC
Issue added.
I am already happy with yapeal importing API to my db. Looking forward for ContractItems added. Could you add table for the data to distribution now so I could use my scrips for data imports? Would add my own table, but i am afraid it will be different from yapeals and than I would have to fix other of related scripts and tables.
Dragonaire
Here there be Dragons
#194 - 2012-01-04 18:36:32 UTC
I'll try to do that at least in the next few days for you. and maybe get XSDs made.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Halonet
Imperial Shipment
Amarr Empire
#195 - 2012-01-04 18:50:37 UTC  |  Edited by: Halonet
Forgot to ask...
Why you adding checks for running it on shell? I have webspace and db only. Comented check on yapeal.php, and now scripts runs on apache without any errors... Is there anything to be afraid using apache to start scripts?
Dragonaire
Here there be Dragons
#196 - 2012-01-04 23:32:11 UTC
You can also just do the last two tables in Drapko Nitzhonot's example as the Yapeal default is 'optional' for the data in the utilRegisteredCorporation table. Also you might want to look at a couple wiki pages that should help you better understand how to use it and how it works.
http://code.google.com/p/yapeal/wiki/UsingClassUtilClasses
and
http://code.google.com/p/yapeal/wiki/UtilDatabaseTableDependences

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Drapko Nitzhonot
Abdera Logistics
#197 - 2012-01-09 14:41:59 UTC  |  Edited by: Drapko Nitzhonot
Hello. I've just upgraded to last Mercurial version and I get this error:
Quote:
PHP Fatal error: Declaration of ExceptionRenderer::render() must be compatible with that of LoggerRendererObject::render() in /home/drapko/doc/yapeal/class/ExceptionRenderer.php on line 56


Thanks!
Dragonaire
Here there be Dragons
#198 - 2012-01-09 17:18:03 UTC
Sorry for the late reply I missed your post just before mine.
Halonet wrote:
Forgot to ask...
Why you adding checks for running it on shell? I have webspace and db only. Comented check on yapeal.php, and now scripts runs on apache without any errors... Is there anything to be afraid using apache to start scripts?
Yapeal is made to be ran by CLI not CGI version of PHP which you probably also have access to.There are a few technical reason why it needs CLI for example CGI does not allow parameters and has timeout timer set to 30 seconds on most common hosting sites which doesn't always give Yapeal the time it needs to do it's job. There use to be others but they are less of a problem now. There is another issue I avoid by adding those and that is people asking constantly why its not working when their try going to the files in their web browsers instead of reading how to run it. Everyone thinks anything done with PHP has to be web based which is really sad since it truly is a very good general scripting language.

I have largely made Yapeal to work with either by adding extra guard code around CLI only stuff so CGI can be used but that may change in future versions so once again CLI will be required. There are plans to add forking using PCNTL to Yapeal in the future for users with larger work loads where the single task structure starts runs out of gas because of network I/O and DB bandwidth issues. PCNTL can't be used with CGI so CLI will be needed then.

@Drapko Nitzhonot - I've not been able to get it to throw a fatal error on my system for some strange reason but I understand why it could so I fixed it. Mercurials updated and archives as well.

version 12.009.1652

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Drapko Nitzhonot
Abdera Logistics
#199 - 2012-01-09 19:36:52 UTC
Thanks Dragonaire Big smile
Callean Drevus
Perkone
Caldari State
#200 - 2012-01-11 20:24:44 UTC  |  Edited by: Callean Drevus
Hey Dragonaire,

I've just taken a look at my yap_accountAccountStatus table, and it's pretty messed up :P is it by any chance possible that a new item is created every time yapeal queries for this information? EMK certainly doesn't have 255.000 accounts...

I've now added a primary key on keyID to keep it from doing things like this again, but I do not know if that's entirely correct.

In addition, does yapeal EVER clean it's utilXmlCache table? Mine seems to be filling up like there's no tomorrow Blink (15 GB?)

Developer/Creator of EVE Marketeer