Commit 879db2f3 authored by speedprogs_de's avatar speedprogs_de

working state of the scheduler task with database processing

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@51626 735d13b6-9817-0410-8766-e36946ffe9aa
parent 8bf91fd2
......@@ -33,26 +33,15 @@
*/
protected $reflectionService;
/**
* @var Tx_Extbase_Persistence_IdentityMap
*/
protected $identityMap;
/**
* @var array
*/
protected $classSchemata;
/**
* Injects the identity map
*
* @param Tx_Extbase_Persistence_IdentityMap $identityMap
* @return void
* @var array
*/
public function injectIdentityMap(Tx_Extbase_Persistence_IdentityMap $identityMap) {
$this->identityMap = $identityMap;
}
protected $objects = array();
/**
......@@ -78,10 +67,10 @@
throw new Exception('No valid params given to create an object');
}
// Check identity map
$identifier = md5(json_encode($attributes));
if ($this->identityMap->hasIdentifier($identifier, $className)) {
return $this->identityMap->getObjectByIdentifier($identifier, $className);
// Check internal cache first
$identifier = md5($className . json_encode($attributes));
if (!empty($this->objects[$identifier])) {
return $this->objects[$identifier];
}
// Build object
......@@ -100,8 +89,8 @@
}
}
// Register object in identity map
$this->identityMap->registerObject($object, $identifier);
// Add object to internal cache
$this->objects[$identifier] = $object;
return $object;
}
......
......@@ -271,7 +271,7 @@
$filename = PATH_site . $this->extensionRootPath . $filename;
$content = t3lib_div::getURL($filename);
if (empty($content)) {
throw new Exception('Can not fetch file "' . $filename . '"');
throw new Exception('Could not fetch file "' . $filename . '"');
}
// Check file hash
......
......@@ -26,7 +26,7 @@
/**
* Service to handle mirrors
*/
class Tx_TerFe2_Service_Mirror {
class Tx_TerFe2_Service_Mirror implements t3lib_Singleton {
/**
* @var integer
......
......@@ -26,7 +26,7 @@
/**
* Service to handle soap requests
*/
class Tx_TerFe2_Service_Soap {
class Tx_TerFe2_Service_Soap implements t3lib_Singleton {
/**
* @var SoapClient
......
......@@ -48,6 +48,11 @@
*/
protected $settings;
/**
* @var Tx_Extbase_Configuration_ConfigurationManager
*/
protected $configurationManager;
/**
* @var Tx_Extbase_Object_ObjectManager
*/
......@@ -95,8 +100,9 @@
// Load configuration manager and set extension setup,
// it is required to be loaded in object manager for persistence mapping
$configurationManager = $this->objectManager->get('Tx_Extbase_Configuration_ConfigurationManager');
$configurationManager->setConfiguration(Tx_TerFe2_Utility_TypoScript::getSetup('plugin.tx_terfe2'));
$this->settings = Tx_TerFe2_Utility_TypoScript::getSetup('plugin.tx_terfe2');
$this->configurationManager = $this->objectManager->get('Tx_Extbase_Configuration_ConfigurationManager');
$this->configurationManager->setConfiguration($this->settings);
// Load provider manager
$this->providerManager = $this->objectManager->get('Tx_TerFe2_Provider_ProviderManager');
......@@ -125,6 +131,11 @@
public function execute() {
$this->initializeTask();
// Check storage page
if (!$this->storagePageConfigured()) {
throw new Exception('Please configure "plugin.tx_terfe2.persistence.storagePid" in TypoScript setup');
}
// Get information
$lastRun = (int) $this->registry->get('lastRun');
$offset = (int) $this->registry->get('offset');
......@@ -145,7 +156,7 @@
}
}
// Set new values to registry
// Add new values to registry
$offset = (!empty($extensions) ? $offset + $count : 0);
$this->registry->add('lastRun', $GLOBALS['EXEC_TIME']);
$this->registry->add('offset', $offset);
......@@ -219,6 +230,24 @@
}
/**
* Check whether a storage page is configured or not
*
* @return TRUE if a storage page was found
*/
protected function storagePageConfigured() {
$setup = Tx_TerFe2_Utility_TypoScript::getSetup('config.tx_extbase.persistence');
$setup = Tx_Extbase_Utility_Arrays::arrayMergeRecursiveOverrule($setup, $this->settings['persistence.'], FALSE, FALSE);
if (!empty($setup['storagePid'])) {
return TRUE;
}
if (!empty($setup['classes.']['Tx_TerFe2_Domain_Model_Extension.']['newRecordStoragePid'])) {
return TRUE;
}
return FALSE;
}
/**
* Clear cache of given pages
*
......
......@@ -14,18 +14,18 @@ plugin.tx_terfe2 {
}
persistence {
# cat=TER Frontend/persistence/100; type=int+; label=General storage PID for the TER Frontend Index
# cat=TER Frontend/persistence/200; type=int+; label=General storage PID for the TER Frontend Index
storagePid = 0
}
view {
# cat=TER Frontend/view/200; type=string; label=Path to template root
# cat=TER Frontend/view/300; type=string; label=Path to template root
templateRootPath = EXT:ter_fe2/Resources/Private/Templates/
# cat=TER Frontend/view/210; type=string; label=Path to template partials
# cat=TER Frontend/view/310; type=string; label=Path to template partials
partialRootPath = EXT:ter_fe2/Resources/Private/Partials/
# cat=TER Frontend/view/220; type=string; label=Path to template layouts
# cat=TER Frontend/view/320; type=string; label=Path to template layouts
layoutRootPath = EXT:ter_fe2/Resources/Private/Layouts/
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment