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 @@ ...@@ -33,26 +33,15 @@
*/ */
protected $reflectionService; protected $reflectionService;
/**
* @var Tx_Extbase_Persistence_IdentityMap
*/
protected $identityMap;
/** /**
* @var array * @var array
*/ */
protected $classSchemata; protected $classSchemata;
/** /**
* Injects the identity map * @var array
*
* @param Tx_Extbase_Persistence_IdentityMap $identityMap
* @return void
*/ */
public function injectIdentityMap(Tx_Extbase_Persistence_IdentityMap $identityMap) { protected $objects = array();
$this->identityMap = $identityMap;
}
/** /**
...@@ -78,10 +67,10 @@ ...@@ -78,10 +67,10 @@
throw new Exception('No valid params given to create an object'); throw new Exception('No valid params given to create an object');
} }
// Check identity map // Check internal cache first
$identifier = md5(json_encode($attributes)); $identifier = md5($className . json_encode($attributes));
if ($this->identityMap->hasIdentifier($identifier, $className)) { if (!empty($this->objects[$identifier])) {
return $this->identityMap->getObjectByIdentifier($identifier, $className); return $this->objects[$identifier];
} }
// Build object // Build object
...@@ -100,8 +89,8 @@ ...@@ -100,8 +89,8 @@
} }
} }
// Register object in identity map // Add object to internal cache
$this->identityMap->registerObject($object, $identifier); $this->objects[$identifier] = $object;
return $object; return $object;
} }
......
...@@ -271,7 +271,7 @@ ...@@ -271,7 +271,7 @@
$filename = PATH_site . $this->extensionRootPath . $filename; $filename = PATH_site . $this->extensionRootPath . $filename;
$content = t3lib_div::getURL($filename); $content = t3lib_div::getURL($filename);
if (empty($content)) { if (empty($content)) {
throw new Exception('Can not fetch file "' . $filename . '"'); throw new Exception('Could not fetch file "' . $filename . '"');
} }
// Check file hash // Check file hash
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
/** /**
* Service to handle mirrors * Service to handle mirrors
*/ */
class Tx_TerFe2_Service_Mirror { class Tx_TerFe2_Service_Mirror implements t3lib_Singleton {
/** /**
* @var integer * @var integer
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
/** /**
* Service to handle soap requests * Service to handle soap requests
*/ */
class Tx_TerFe2_Service_Soap { class Tx_TerFe2_Service_Soap implements t3lib_Singleton {
/** /**
* @var SoapClient * @var SoapClient
......
...@@ -48,6 +48,11 @@ ...@@ -48,6 +48,11 @@
*/ */
protected $settings; protected $settings;
/**
* @var Tx_Extbase_Configuration_ConfigurationManager
*/
protected $configurationManager;
/** /**
* @var Tx_Extbase_Object_ObjectManager * @var Tx_Extbase_Object_ObjectManager
*/ */
...@@ -95,8 +100,9 @@ ...@@ -95,8 +100,9 @@
// Load configuration manager and set extension setup, // Load configuration manager and set extension setup,
// it is required to be loaded in object manager for persistence mapping // it is required to be loaded in object manager for persistence mapping
$configurationManager = $this->objectManager->get('Tx_Extbase_Configuration_ConfigurationManager'); $this->settings = Tx_TerFe2_Utility_TypoScript::getSetup('plugin.tx_terfe2');
$configurationManager->setConfiguration(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 // Load provider manager
$this->providerManager = $this->objectManager->get('Tx_TerFe2_Provider_ProviderManager'); $this->providerManager = $this->objectManager->get('Tx_TerFe2_Provider_ProviderManager');
...@@ -125,6 +131,11 @@ ...@@ -125,6 +131,11 @@
public function execute() { public function execute() {
$this->initializeTask(); $this->initializeTask();
// Check storage page
if (!$this->storagePageConfigured()) {
throw new Exception('Please configure "plugin.tx_terfe2.persistence.storagePid" in TypoScript setup');
}
// Get information // Get information
$lastRun = (int) $this->registry->get('lastRun'); $lastRun = (int) $this->registry->get('lastRun');
$offset = (int) $this->registry->get('offset'); $offset = (int) $this->registry->get('offset');
...@@ -145,7 +156,7 @@ ...@@ -145,7 +156,7 @@
} }
} }
// Set new values to registry // Add new values to registry
$offset = (!empty($extensions) ? $offset + $count : 0); $offset = (!empty($extensions) ? $offset + $count : 0);
$this->registry->add('lastRun', $GLOBALS['EXEC_TIME']); $this->registry->add('lastRun', $GLOBALS['EXEC_TIME']);
$this->registry->add('offset', $offset); $this->registry->add('offset', $offset);
...@@ -219,6 +230,24 @@ ...@@ -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 * Clear cache of given pages
* *
......
...@@ -14,18 +14,18 @@ plugin.tx_terfe2 { ...@@ -14,18 +14,18 @@ plugin.tx_terfe2 {
} }
persistence { 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 storagePid = 0
} }
view { 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/ 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/ 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/ 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