Skip to content
This repository has been archived by the owner on Mar 9, 2020. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/1.1.x-WIP' into 1.1.x-WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragonrun1 committed Jun 23, 2014
2 parents 8014050 + 3095282 commit 165fb6b
Show file tree
Hide file tree
Showing 4 changed files with 428 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/sql/CreateCorpTables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ CREATE TABLE IF NOT EXISTS "{database}"."{table_prefix}corpMemberTracking" (
"baseID" BIGINT(20) UNSIGNED DEFAULT NULL,
"characterID" BIGINT(20) UNSIGNED NOT NULL,
"grantableRoles" CHAR(64) DEFAULT NULL,
"location" CHAR(50) DEFAULT NULL,
"location" CHAR(255) DEFAULT NULL,
"locationID" BIGINT(20) UNSIGNED DEFAULT NULL,
"logoffDateTime" DATETIME DEFAULT NULL,
"logonDateTime" DATETIME DEFAULT NULL,
Expand Down
149 changes: 149 additions & 0 deletions lib/Database/Account/Characters.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<?php
/**
* Contains CallList class.
*
* PHP version 5.3
*
* LICENSE:
* This file is part of 1.1.x-WIP
* Copyright (C) 2014 Michael Cummings
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*
* You should be able to find a copy of this license in the LICENSE.md file. A copy of the GNU GPL should also be
* available in the GNU-GPL.md file.
*
* @copyright 2014 Michael Cummings
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL
* @author Michael Cummings <mgcummings@yahoo.com>
* @author Stephen Gulick <stephenmg12@gmail.com>
*/
namespace Yapeal\Database\Map;

use Yapeal\Database\AbstractCommonEveApi;
use Yapeal\Database\AttributesDatabasePreserver;
use Yapeal\Database\DatabasePreserverInterface;
use Yapeal\Xml\EveApiPreserverInterface;
use Yapeal\Xml\EveApiReadWriteInterface;
use Yapeal\Xml\EveApiRetrieverInterface;
use Yapeal\Xml\EveApiXmlModifyInterface;

/**
* Class CallList
*/
class Characters extends AbstractCommonEveApi
{
/**
* @param EveApiReadWriteInterface $data
* @param EveApiRetrieverInterface $retrievers
* @param EveApiPreserverInterface $preservers
* @param int $interval
*/
public function autoMagic(
EveApiReadWriteInterface $data,
EveApiRetrieverInterface $retrievers,
EveApiPreserverInterface $preservers,
$interval
) {
$this->getLogger()
->info(
sprintf(
'Starting autoMagic for %1$s/%2$s',
$this->getSectionName(),
$this->getApiName()
)
);
/**
* @var EveApiReadWriteInterface|EveApiXmlModifyInterface $data
*/
$data->setEveApiSectionName(strtolower($this->getSectionName()))
->setEveApiName($this->getApiName())
->setEveApiXml();
if ($this->cacheNotExpired(
$this->getApiName(),
$this->getSectionName()
)
) {
return;
}
$retrievers->retrieveEveApi($data);
if ($data->getEveApiXml() === false) {
$mess = sprintf(
'Could NOT retrieve Eve Api data for %1$s/%2$s',
strtolower($this->getSectionName()),
$this->getApiName()
);
$this->getLogger()
->debug($mess);
return;
}
$this->transformRowset($data);
if ($this->isInvalid($data)) {
$mess = sprintf(
'Data retrieved is invalid for %1$s/%2$s',
strtolower($this->getSectionName()),
$this->getApiName()
);
$this->getLogger()
->warning($mess);
$data->setEveApiName('Invalid' . $this->getApiName());
$preservers->preserveEveApi($data);
return;
}
$preservers->preserveEveApi($data);
$preserver = new AttributesDatabasePreserver(
$this->getPdo(),
$this->getLogger(),
$this->getCsq()
);
$this->preserveToCharacters($preserver, $data->getEveApiXml());
$this->updateCachedUntil($data, $interval, '0');
}
/**
* @return string
*/
protected function getSectionName()
{
if (empty($this->sectionName)) {
$this->sectionName = basename(str_replace('\\', '/', __DIR__));
}
return $this->sectionName;
}
/**
* @return string
*/
protected function getApiName()
{
if (empty($this->apiName)) {
$this->apiName = basename(str_replace('\\', '/', __CLASS__));
}
return $this->apiName;
}
/**
* @param DatabasePreserverInterface $preserver
* @param string $xml
*/
protected function preserveToCharacters(
DatabasePreserverInterface $preserver,
$xml
) {
$columnDefaults = array(
'name' => null,
'characterID' => null,
'corporationID' => null,
'corporationName' => null
);
$preserver->setTableName('mapFacWarSystems')
->setColumnDefaults($columnDefaults)
->preserveData($xml);
}
}
41 changes: 41 additions & 0 deletions lib/Database/Corp/MemberTracking.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="../common.xsd"/>
<xs:complexType name="rowType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="eveIDType" name="characterID"/>
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="eveNEDTType" name="startDateTime"/>
<xs:attribute type="eveIDType" name="baseID"/>
<xs:attribute type="xs:string" name="base"/>
<xs:attribute type="xs:string" name="title"/>
<xs:attribute type="eveNEDTType" name="logonDateTime"/>
<xs:attribute type="eveNEDTType" name="logoffDateTime"/>
<xs:attribute type="eveIDType" name="locationID"/>
<xs:attribute type="xs:string" name="location"/>
<xs:attribute type="xs:long" name="shipTypeID"/>
<xs:attribute type="xs:string" name="shipType"/>
<xs:attribute type="eveIDType" name="roles"/>
<xs:attribute type="eveIDType" name="grantableRoles"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="resultType">
<xs:sequence>
<xs:element name="members">
<xs:complexType>
<xs:sequence>
<xs:element type="rowType"
name="row"
minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attributeGroup ref="rowsetAttrs"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
Loading

0 comments on commit 165fb6b

Please sign in to comment.