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 (2.0)

Author
Dragonaire
Here there be Dragons
#21 - 2014-07-31 21:48:38 UTC
Okay finished off what I was doing with CONFIG.md and pushed it along with some other minor things I noticed while writing it.

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

Kolb
Fancy Fox Enterprises
#22 - 2014-08-01 13:08:24 UTC
Without the code from here in my script...
https://github.com/Dragonrun1/yapeal/wiki/Using%20Yapeal%20Utils

I'm getting the error:

Fatal error: Class 'RegisteredKey' not found in /var/www/tools/applications/working.php on line 16

With the code I get:

/var/www/lib/yapeal/inc/common_paths.php): failed to open stream: No such file or directory in /var/www/lib/yapeal/util.php on line 12

Fatal error: require_once(): Failed opening required '/var/www/lib/yapeal/inc/common_paths.php' (include_path='.:/usr/share/php:/usr/share/pear')

I'm sure I'm just missing something obvious here but I'm blind to it. Can anyone give me a hand?
Dragonaire
Here there be Dragons
#23 - 2014-08-01 13:48:22 UTC
That wiki page is for the older version (1.0.x) of Yapeal which is no longer really supported since it doesn't work with all the changes to the Eve APIs that have happened.

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

Kolb
Fancy Fox Enterprises
#24 - 2014-08-01 13:59:07 UTC
:-)

So I've gathered, I'm just not seeing how to rework my app to use the new version of yapeal.

I know I'm just missing something, but I don't know what....

Is there a replacement method for:

// Make a new RegisteredKey instance.
$regKey = new RegisteredKey(1156);
// Add the vCode to keyID 1156.
$regKey->vCode = 'abc123';
// Add the API Mask to keyID 1156.
$regKey->activeAPIMask = 8388608;
// Activate the API key.
$regKey->isActive = 1;
// Save the new API Key into the database.
if ($regKey->store()) {
print 'Registered new API Key: ' . $regKey->keyID . ' to the database.' . PHP_EOL;
} else {
print "API Key couldn't be added!" . PHP_EOL;
}
// Release everything.
$regKey = NULL;
unset($regKey);
?>
Dragonaire
Here there be Dragons
#25 - 2014-08-01 14:33:04 UTC
Kolb - At this time none of the old Util classes have been replaced. Some of them of course are no longer needed because the tables don't exist like utilRegisteredChar|Corp|Section. I will look at possible add something to manage the couple of other tables like utilEveApi and utilRegisteredKey which are at this time the only ones you'll need to make changes to. Everything that was done with the other tables can be manages with just these two now.

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

Kolb
Fancy Fox Enterprises
#26 - 2014-08-01 15:13:27 UTC
So, I need to directly add the API information into the yapeal_utilRegisteredKey table and let the yapeal cron job run?

Sorry if I'm being a hassle, I'm still a neophyte when it comes to coding.
Legedric Striker
State War Academy
Caldari State
#27 - 2014-08-02 06:16:11 UTC
Kolb wrote:
So, I need to directly add the API information into the yapeal_utilRegisteredKey table and let the yapeal cron job run?

Sorry if I'm being a hassle, I'm still a neophyte when it comes to coding.


As that's how I did it and it's working I'd say: Yes Smile

EVE-Skillplan.net - Plan your pilot skill training online on PC, Mac, tablet or smartphone!

Tiberius Zol
Moira.
#28 - 2014-08-02 11:54:20 UTC
i have filled up the RegisteredKey table but the char/corp tables don't get filled.. cache dir are empty... i have run /bin/yapeal.php several times.. but yapeal fetch some account stuff only. Did i miss something?

Mr. Tibbers on twitter: @Mr_Tibbers

Mr. Tibbers Blog: www.eve-versum.de

Kolb
Fancy Fox Enterprises
#29 - 2014-08-02 14:11:44 UTC  |  Edited by: Kolb
Tiberius Zol wrote:
i have filled up the RegisteredKey table but the char/corp tables don't get filled.. cache dir are empty... i have run /bin/yapeal.php several times.. but yapeal fetch some account stuff only. Did i miss something?


That's the same results I had, I think the scripts to populate those results are not ready? I'm also getting a segfault on corp wallets.

Is there an upgrade path from 1.0.5 to master or should I clean install?
Dragonaire
Here there be Dragons
#30 - 2014-08-02 17:13:21 UTC
Clean install is best. All the APIs are on by default so as long as the class for that API has been done it'll work. Make sure when you add your info to utilRegisteredKey that isActive = 1 or the only thing you will see is the account stuff since basically it's hardwired on for account/APIKeyInfo and account/Characters. If it still doesn't seem to be working check the log files. log/yapeal.log and log/error.log should be helpful. If there's no error.log file that's normal but if it exist there something more troubling going on. As always make sure the cache directory is writable.

Kolb - About the segfault are you sure you are using PHP 5.4? Try running 'php --version' to check. Also if you can copy it for us here so we can see it or better yet open issue on GitHub with it and any log files were I can take a look at what's going on should be able to figure it out.

As always it's a good idea to go back through the steps in INSTALL.md and CONFIG.md files and make sure you didn't miss something.

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

Tiberius Zol
Moira.
#31 - 2014-08-02 17:49:09 UTC
Dragonaire wrote:
Clean install is best. All the APIs are on by default so as long as the class for that API has been done it'll work. Make sure when you add your info to utilRegisteredKey that isActive = 1 or the only thing you will see is the account stuff since basically it's hardwired on for account/APIKeyInfo and account/Characters. If it still doesn't seem to be working check the log files. log/yapeal.log and log/error.log should be helpful. If there's no error.log file that's normal but if it exist there something more troubling going on. As always make sure the cache directory is writable.


All entries in utilRegisteredKey are active but still no entries in the db. Theres no error.log.
Have set logging to INFO (100) and found some weired entrys in my log now like:

[2014-08-02 19:32:58] yapeal.DEBUG: Starting autoMagic for Char/MarketOrders [] []
[2014-08-02 19:32:58] yapeal.DEBUG: SELECT ac."characterID",urk."keyID",urk."vCode" FROM "db_eve"."accountKeyBridge" AS akb JOIN "db_eve"."accountAPIKeyInfo" AS aaki ON (akb."keyID" = aaki."keyID") JOIN "db_eve"."utilRegisteredKey" AS urk ON (akb."keyID" = urk."keyID") JOIN "db_eve"."accountCharacters" AS ac ON (akb."characterID" = ac."characterID") WHERE aaki."type" IN ('Account','Character') AND urk."isActive"=1 AND (urk."activeAPIMask" & aaki."accessMask" & 4096) <> 0 [] []
[2014-08-02 19:32:58] yapeal.INFO: No active characters found [] []

Why does it say: No active characters found?

Mr. Tibbers on twitter: @Mr_Tibbers

Mr. Tibbers Blog: www.eve-versum.de

Tiberius Zol
Moira.
#32 - 2014-08-02 18:04:49 UTC
Ok think i found the problem. activeAPIMask is NULL by default. After i set all activeAPIMask like accessmask in accountAPIKeyInfo it seems to fetch all the stuff.

Mr. Tibbers on twitter: @Mr_Tibbers

Mr. Tibbers Blog: www.eve-versum.de

Xynen
#33 - 2014-08-02 19:10:54 UTC
Dragonaire wrote:
I now need some input on which APIs people want to see done next so I've decided to try to get some. I'm calling it the 'Vote for your most needed API' campaign.


For me it would be:
corp/Contracts
corp/StarbaseList
corp/AssetList

Legedric Striker
State War Academy
Caldari State
#34 - 2014-08-03 09:30:29 UTC
Well, I've got some trouble to get the character sheet for one of my characters which never has been in a player corp, ever:

Quote:
[2014-08-03 09:14:32] yapeal.DEBUG: Started network retrieve for char/CharacterSheet [] []
[2014-08-03 09:14:32] yapeal.DEBUG: Started XSD validating [] []
[2014-08-03 09:14:32] yapeal.DEBUG: Element 'cloneName': This element is not expected. Expected is ( allianceName ). [] []
[2014-08-03 09:14:32] yapeal.WARNING: The data retrieved from Eve API char/CharacterSheet for 93717778 is invalid [] []


The specific XML looks like this:
Edit: Meh, forums don't allow xml in here as they think it's HTML... Ugh
Replaced all the tag brackets...

Quote:
*characterID*yyyyyyy*/characterID*
*name*xxxxxxx*/name*
*DoB*2013-08-09 11:38:12*/DoB*
*race*Amarr*/race*
*bloodLine*Amarr*/bloodLine*
*ancestry*Wealthy Commoners*/ancestry*
*gender*Female*/gender*
*corporationName*Royal Amarr Institute*/corporationName*
*corporationID*1000077*/corporationID*
*cloneName*Clone Grade Iota*/cloneName*
*cloneSkillPoints*9800000*/cloneSkillPoints*
*balance*180000.00*/balance*
*attributeEnhancers key="bonusName" columns="augmentatorValue,augmentatorName,bonusName"/*

EVE-Skillplan.net - Plan your pilot skill training online on PC, Mac, tablet or smartphone!

Dragonaire
Here there be Dragons
#35 - 2014-08-03 17:22:00 UTC
Legedric Striker - You may have found a bug in the API actually because it's not suppose to matter if char is or has been in an alliance or faction it suppose to return some defaults like 0. I'll look at working around it as it'll probably effect any char that is in an NPC corporation since they don't have alliances or factions normally. I'll create an issue on GitHub and do a fix for it.

https://github.com/Dragonrun1/yapeal/issues/30

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
#36 - 2014-08-03 17:28:22 UTC
So just looking at the voting so far it seems AssetList needs to be the next one I work on which somehow didn't surprise me as it both very useful in most application and of course one of the harder API to program which is why it's not done yet Blink Do continue to vote if you haven't because after doing AssetList I'll need to decided on what to do next.

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

Jack Haydn
Magellanic Itg
Goonswarm Federation
#37 - 2014-08-03 18:38:36 UTC  |  Edited by: Jack Haydn
Good work dragonaire, appreciate it. I haven't yet tested the new branch, but here's two points of feedback from the old versions:

- The "run the api every minute" concept is good, but yapeal should come with its own locking mechanism then. If you are working with a huge amount of keys (several dozen full keys), the api run will definitely be longer than 1 minute. Multiple instances running at the same time results in really weird behavior, due to DB locks, API caches ignored and stuff like that. Right now, we manually need to place a lock file in a folder, check for that before running and only proceed if the lock file doesn't exist (thanks to Somer for that tip). I think yapeal should come with this functionality ootb.

- IIRC, the standard class only provides methods to add and disable APIs. It would be really great if yapeal came with a native method to actually delete APIs. Especially in setups with a huge amount of APIs stored and a high fluctuation of APIs being deleted/invalidated, keeping the DB clean and not just isActive = 0'ed would be much appreciated.


As for the voting:

CorpSheet
OutpostList
OutpostServiceDetail
WalletJournal
AllianceList
ConquerableStationList
Sovereignty


Some of these already might be implemented. Like I said, I haven't taken a look at the new version yet.
Dragonaire
Here there be Dragons
#38 - 2014-08-03 19:18:28 UTC
Actual Yapeal does locking on a per API basis which allows multiple instances to run without stepping on each others toes just like it always has for a long time. AbstractCommonEveApi::gotApiLock() handles getting the lock. Using the database for locking is faster plus more cross platform compatible for what it needs. It also using transactions for all deletes and upsert so it makes sure multiple table APIs are updated correctly and keeps everything ACID. So you shouldn't need to do any extra locking in your crontab. You said it would cause weird behavior, have you actually experienced this or just assumed because you didn't see any locking that it would?

I'm a little puzzled by what you mean when you say 'delete APIs' maybe you can explain what you mean just a little more.

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

Kolb
Fancy Fox Enterprises
#39 - 2014-08-03 19:23:24 UTC  |  Edited by: Kolb
Dragonaire wrote:

Kolb - About the segfault are you sure you are using PHP 5.4? Try running 'php --version' to check. Also if you can copy it for us here so we can see it or better yet open issue on GitHub with it and any log files were I can take a look at what's going on should be able to figure it out.


PHP 5.5.3-1ubuntu2.3 (cli) (built: Apr 4 2014 01:10:38)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies

here's my log dump.

http://pastebin.com/Jz7bezb8

it outputs Segmentation fault (core dumped) on the console
Tiberius Zol
Moira.
#40 - 2014-08-03 19:42:37 UTC
Dragonaire wrote:
So just looking at the voting so far it seems AssetList needs to be the next one I work on which somehow didn't surprise me as it both very useful in most application and of course one of the harder API to program which is why it's not done yet Blink Do continue to vote if you haven't because after doing AssetList I'll need to decided on what to do next.


\o/ after AssetList is implemented, I can switch my whole project to the new version.

Mr. Tibbers on twitter: @Mr_Tibbers

Mr. Tibbers Blog: www.eve-versum.de