Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Out-commented Code in Erfurt #140

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions library/Erfurt/Ac/Default.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,24 +373,6 @@ public function isActionAllowed($action, $isFullUri = false)
// Every Action allowed
return true;
} else {
// create action instance
// array for new statements (an action instance pus label)
/*
$actionStmt = array(
$actionUri => array (
EF_RDF_TYPE => array (
array ( 'type' => 'uri' , 'value' => $this->_uris['actionClassUri'] )
) ,
EF_RDFS_LABEL => array (
array ( 'type' => 'literal' , 'value' => $action )
)
)
);

$store = Erfurt_App::getInstance()->getStore();
$store->addMultipleStatements($this->_uris['acModelUri'], $actionStmt, false);
*/

return false;
}
}
Expand Down
7 changes: 0 additions & 7 deletions library/Erfurt/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -1160,13 +1160,6 @@ private function _getQueryCacheBackend()
case 'database':
$this->_queryCacheBackend = new Erfurt_Cache_Backend_QueryCache_Database();
break;
# case 'file':
# $this->_queryCacheBackend = new Erfurt_Cache_Backend_QueryCache_File();
# break;
#
# case 'memory':
# $this->_queryCacheBackend = new Erfurt_Cache_Backend_QueryCache_Memory();
# break;
default:
throw new Erfurt_Exception('Cache type is not supported.');
}
Expand Down
1 change: 0 additions & 1 deletion library/Erfurt/Auth/Adapter/FoafSsl.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ public function verifyIdpResult($get)
if ((null === $this->_publicKey) || !extension_loaded('openssl')) {
return false;
}
//$this->_publicKey = str_replace(str_split(" \t\n\r\0\x0B"), '', $this->_publicKey);
$schema = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'])) ? 'https://' : 'http://';
$url = $schema . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];

Expand Down
8 changes: 0 additions & 8 deletions library/Erfurt/Auth/Adapter/OpenId.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,6 @@ public function authenticate()
if (!isset($this->_get['openid_identity'])) {
$result = false;
$msg = 'OpenID authentication failed.';

/*
$identity = array(
'uri' => null,
'dbuser' => false,
'anonymous' => false
);
*/
return new Zend_Auth_Result($result, null, array($msg));
}

Expand Down
14 changes: 1 addition & 13 deletions library/Erfurt/Auth/Adapter/Rdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,7 @@ public function authenticate()
'anonymous' => false
);

// have a look at the cache...
/*$cache = Erfurt_App::getInstance()->getCache();
$id = $cache->makeId($this, '_fetchDataForUser', array($this->_username));
OntoWiki::getInstance()->appendMessage( new OntoWiki_Message($id));
$cachedVal = $cache->load($id);
if ($cachedVal) {
OntoWiki::getInstance()->appendMessage( new OntoWiki_Message("cached"));
$this->_users[$this->_username] = $cachedVal;
} else {
*/$this->_users[$this->_username] = $this->_fetchDataForUser($this->_username);
/*$cache->save($this->_users[$this->_username], $id, array('_fetchDataForUser'));
OntoWiki::getInstance()->appendMessage( new OntoWiki_Message("uncached"));
}*/
$this->_users[$this->_username] = $this->_fetchDataForUser($this->_username);

// if login is denied return failure auth result
if ($this->_users[$this->_username]['denyLogin'] === true) {
Expand Down
8 changes: 0 additions & 8 deletions library/Erfurt/Cache/Backend/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function load($id, $doNotTestCacheValidity = false) {
if ($result !== false) {
if (isset($result[0])) {
$content = $result[0]['content'];
#$content = base64_decode($content);
return $content;
}
}
Expand Down Expand Up @@ -123,7 +122,6 @@ public function save($data, $id, $tags = array(), $specificLifetime = false) {
}

$lifetime = $this->getLifetime($specificLifetime);
#$data = $this->_getConnection()->real_escape_string($data);
$data = addslashes($data);
$mktime = time();
if (is_null($lifetime)) {
Expand Down Expand Up @@ -177,12 +175,6 @@ public function test($id) {
* This method will build the database structure.
*/
private function _buildStructure() {
# $this->_query('DROP INDEX ef_cache_tag_id_index');
# $this->_query('DROP INDEX ef_cache_tag_name_index');
# $this->_query('DROP INDEX ef_cache_id_expire_index');
# $this->_query('DROP TABLE ef_cache_version');
# $this->_query('DROP TABLE ef_cache');
# $this->_query('DROP TABLE ef_cache_tag');

$this->_query(' CREATE TABLE ef_cache_version (
num INT,
Expand Down
7 changes: 1 addition & 6 deletions library/Erfurt/Ping.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,19 +380,14 @@ private function _getResourceFromWrapper ($sourceUri, $targetUri, $wrapperName =
$wrapperResult = $wrapper->run($r, null, true);

$newStatements = null;
if ($wrapperResult === false) {
// IMPORT_WRAPPER_NOT_AVAILABLE;
} else if (is_array($wrapperResult)) {
if (is_array($wrapperResult)) {
$newStatements = $wrapperResult['add'];
// TODO make sure to only import the specified resource
$newModel = new Erfurt_Rdf_MemoryModel($newStatements);
$newStatements = array();
$object = array('type' => 'uri', 'value' => $targetUri);
$newStatements = $newModel->getP($sourceUri, $object);
} else {
// IMPORT_WRAPPER_ERR;
}

return $newStatements;
}

Expand Down
35 changes: 0 additions & 35 deletions library/Erfurt/Plugin/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,41 +138,6 @@ private function _addPlugin($pluginName, $pluginPath)
}

public function addPluginExternally($pluginName, $fileName, $pluginPath, $pluginConfig){
// for use of array based config
// if($pluginConfig instanceof Zend_Config){
// $pluginConfig = $pluginConfig->toArray();
// }

// $pluginConfig['pluginPath'] = $pluginPath;
// if(!isset($pluginConfig['enabled'])){
// $pluginConfig['enabled'] = false;
// }
// $enabled = $pluginConfig['enabled'];
//
// // keep track of loaded plug-ins
// if (!array_key_exists($pluginName, $this->_plugins)) {
// $this->_plugins[$pluginName] = $pluginConfig;
// }
//
// if ($enabled && isset($pluginConfig['events']) && is_array($pluginConfig['events'])) {
// foreach ($pluginConfig['events'] as $event) {
// if (is_array($event)) {
// // TODO: allow trigger method that differs from event name
// } else if (is_string($event)) {
// $pluginSpec = array(
// 'class_name' => ucfirst($pluginName) . self::PLUGIN_CLASS_POSTFIX,
// 'file_name' => $fileName,
// 'include_path' => $pluginPath,
// 'config' => isset($pluginPrivateConfig) ? $pluginPrivateConfig : null
// );
//
// $priority = isset($event['priority']) ? (int) $event['priority'] : 10;
//
// // register plugin events with event dispatcher
// $this->_eventDispatcher->register($event, $pluginSpec, $priority);
// }
// }
// }
$pluginConfig->pluginPath = $pluginPath;
if(!isset($pluginConfig->enabled)){
$pluginConfig->enabled = false;
Expand Down
8 changes: 0 additions & 8 deletions library/Erfurt/Rdf/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,14 +655,6 @@ public function sparqlQuery($query, $options = array())
return $this->getStore()->sparqlQuery($query, $options);
}

/*public function sparqlQueryWithPlainResult($query)
{
$queryObject = Erfurt_Sparql_SimpleQuery::initWithString($query);
$queryObject->addFrom($this->_graphUri);

return $this->getStore()->sparqlQuery($queryObject);
}*/

/**
* set the model store
*
Expand Down
2 changes: 0 additions & 2 deletions library/Erfurt/Rdf/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ protected function _fetchDescription($maxDepth)
$this->_descriptionResource($property);

$currentValue = array(
// typed-literal --> literal
// 'type' => str_replace('typed-', '', $row['o']['type']),
'type' => $row['o']['type'],
'value' => $row['o']['value']
);
Expand Down
111 changes: 0 additions & 111 deletions library/Erfurt/Sparql/EngineDb/Adapter/EfZendDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,97 +122,6 @@ public function getTypeSorter()
return $this->ts;
}

/**
* Create a prepared statement that can be executed later.
*
* @param Dataset $dataset RDF Dataset
* @param Query $query Parsed SPARQL query
*
* @return SparqlEngineDb_PreparedStatement Prepared statment that can
* be execute()d later.
*/
/*public function prepare(Dataset $dataset, Query $query)
{
//require_once RDFAPI_INCLUDE_DIR . 'sparql/SparqlEngineDb/PreparedStatement.php';
//require_once RDFAPI_INCLUDE_DIR . 'sparql/SparqlEngineDb/Preparator.php';

$this->query = $query;
$this->dataset = $dataset;
$this->sg = new SparqlEngineDb_SqlGenerator ($this->query, $this->dbConn, $this->arModelIds);
$this->rc = new SparqlEngineDb_ResultConverter($this->query, $this->sg, $this);
$this->ts = new SparqlEngineDb_TypeSorter ($this->query, $this->dbConn);
$this->pr = new SparqlEngineDb_Preparator ($this->query, $this->dbConn);

$this->arPrepared = $this->sg->createSql();
$this->ts->setData($this->sg);

if ($this->ts->willBeDataDependent()) {
$this->bRealPrepared = false;
} else {
$this->bRealPrepared = true;
list($strSelect, $strFrom, $strWhere) = $this->arPrepared;
$this->arPreparedQueries = $this->ts->getOrderifiedSqls(
$strSelect,
$strFrom,
$strWhere
);
$this->arDbStatements = $this->pr->prepareInDb(
$this->arPreparedQueries,
$this->sg->getPlaceholders()
);
}


return new SparqlEngineDb_PreparedStatement(
$this
);
}*/

/**
* Execute a prepared statement by filling it with variables
*
* @param array $arVariables Array with (variable name => value) pairs
* @param string $resultform Which form the result should have
*
* @return mixed Result according to $resultform
*/
/*public function execute($arVariables, $resultform = false)
{
if ($this->arPrepared === null) {
throw new Exception('You need to prepare() the query first.');
}

if ($this->bRealPrepared) {
return
SparqlEngineDb_ResultConverter::convertFromDbResults(
$this->pr->execute(
$this->arDbStatements,
$arVariables
),
$this,
$resultform
);
} else {
list($strSelect, $strFrom, $strWhere) = $this->arPrepared;

return SparqlEngineDb_ResultConverter::convertFromDbResults(
$this->_queryMultiple(
$this->ts->getOrderifiedSqls(
$strSelect,
$strFrom,
$this->pr->replacePlaceholdersWithVariables(
$strWhere,
$this->sg->getPlaceholders(),
$arVariables
)
)
),
$this,
$resultform
);
}
}*/

/**
* Query the database with the given SPARQL query.
*
Expand Down Expand Up @@ -243,9 +152,6 @@ public function queryModel(Erfurt_Sparql_Query $query, $resultform = 'plain')
case 'xml':
$rc = new Erfurt_Sparql_EngineDb_ResultRenderer_Xml();
break;
//throw new Erfurt_Exception('XML result format not supported yet.');
//$this->rc = new Erfurt_Sparql_EngineDb_ResultRenderer_RapZendDb_Xml();
//break;
case 'extended':
$rc = new Erfurt_Sparql_EngineDb_ResultRenderer_Extended();
break;
Expand All @@ -268,10 +174,7 @@ public function queryModel(Erfurt_Sparql_Query $query, $resultform = 'plain')

$this->ts = new Erfurt_Sparql_EngineDb_TypeSorter($this->query, $this);

$this->_setOptions();

$arSqls = $this->sg->createSql();
#var_dump($arSqls);exit;

$this->ts->setData($this->sg);

Expand All @@ -298,8 +201,6 @@ public function sqlQuery($sql)
protected function _queryDb($arSql, $nOffset, $nLimit)
{
$strSql = Erfurt_Sparql_EngineDb_SqlMerger::getSelect($this->query, $arSql);
#var_dump($nLimit, $nOffset);
#echo $strSql;
if ($strSql === '()') {
return array();
}
Expand Down Expand Up @@ -361,16 +262,4 @@ protected function _queryMultiple($arSqls)
return $arResults;
}

/**
* Set options to subobjects like SqlGenerator
*/
protected function _setOptions()
{
// allow changing the statements' table name
//if (isset($GLOBALS['RAP']['conf']['database']['tblStatements'])) {
// $this->sg->setStatementsTable(
// $GLOBALS['RAP']['conf']['database']['tblStatements']
// );
//}
}
}
2 changes: 0 additions & 2 deletions library/Erfurt/Sparql/EngineDb/FilterGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public function createFilterSql($tree, $bOptional, $nUnionCount)
$this->bOptional = $bOptional;
$this->nUnionCount = $nUnionCount;

#return ' AND ' . $this->createTreeSql($tree, null);
try {
return ' AND ' . $this->createTreeSql($tree, null);
} catch (Exception $e) {
Expand Down Expand Up @@ -610,7 +609,6 @@ protected function createFunction_regex($tree)
break;

default:
//var_dump($strMod);exit;
throw new Erfurt_Sparql_EngineDb_SqlGeneratorException(
'Unsupported regex modifier "'
. $strMod
Expand Down
Loading