From: <gem...@li...> - 2011-09-15 09:47:15
|
Revision: 14 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=14&view=rev Author: matijsdejong Date: 2011-09-15 09:47:09 +0000 (Thu, 15 Sep 2011) Log Message: ----------- - try catch statements to prevent hanging errors when a survey is no longer active. Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2011-09-14 17:45:40 UTC (rev 13) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2011-09-15 09:47:09 UTC (rev 14) @@ -540,7 +540,12 @@ $lsTab = $this->_getSurveyTableName($sourceSurveyId); $token = $this->_getToken($tokenId); - $values = $lsDb->fetchRow("SELECT * FROM $lsTab WHERE token = ?", $token); + try { + $values = $lsDb->fetchRow("SELECT * FROM $lsTab WHERE token = ?", $token); + } catch (Zend_Db_Statement_Exception $exception) { + $this->logger->logError($exception, $this->request); + $values = false; + } if ($values) { return $this->_getFieldMap($sourceSurveyId)->mapKeysToTitles($values); @@ -708,8 +713,14 @@ $sql = 'SELECT * FROM ' . $lsTokens . ' WHERE token = ? LIMIT 1'; - $result = $this->getSourceDatabase()->fetchRow($sql, $tokenId); + try { + $result = $this->getSourceDatabase()->fetchRow($sql, $tokenId); + } catch (Zend_Db_Statement_Exception $exception) { + $this->logger->logError($exception, $this->request); + $result = false; + } + $token->cacheSet(self::CACHE_TOKEN_INFO, $result); } else { $result = $token->cacheGet(self::CACHE_TOKEN_INFO); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-03-12 14:30:09
|
Revision: 547 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=547&view=rev Author: mennodekker Date: 2012-03-12 14:29:58 +0000 (Mon, 12 Mar 2012) Log Message: ----------- Cleanup (addSyncronizeSurveyCommands was moved to the synchronizeSurveys) Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-03-12 12:15:27 UTC (rev 546) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-03-12 14:29:58 UTC (rev 547) @@ -329,40 +329,6 @@ } /** - * Add the commands to update this source to a source synchornization batch - * - * @param Gems_Tracker_Batch_SynchronizeSourcesBatch $batch - * @param int $userId Id of the user who takes the action (for logging) - */ - public function addSynchronizeSurveyCommands(Gems_Tracker_Batch_SynchronizeSourcesBatch $batch, $userId) - { - // Surveys in LS - $lsDb = $this->getSourceDatabase(); - $select = $lsDb->select(); - $select->from($this->_getSurveysTableName(), 'sid') - ->order('sid'); - $lsSurveys = $lsDb->fetchCol($select); - $lsSurveys = array_combine($lsSurveys, $lsSurveys); - - // Surveys in Gems - $gemsSurveys = $this->_getGemsSurveysForSynchronisation(); - - foreach ($gemsSurveys as $surveyId => $sourceSurveyId) { - if (isset($lsSurveys[$sourceSurveyId])) { - $batch->addSourceFunction('checkSurvey', $sourceSurveyId, $surveyId, $userId); - } else { - $batch->addSourceFunction('checkSurvey', null, $surveyId, $userId); - } - $batch->addToSurveyCounter(); - } - - foreach (array_diff($lsSurveys, $gemsSurveys) as $sourceSurveyId) { - $batch->addSourceFunction('checkSurvey', $sourceSurveyId, null, $userId); - $batch->addToSurveyCounter(); - } - } - - /** * Check if the tableprefix exists in the source database, and change the status of this * adapter in the gems_sources table accordingly * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-26 13:49:19
|
Revision: 642 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=642&view=rev Author: mennodekker Date: 2012-04-26 13:49:09 +0000 (Thu, 26 Apr 2012) Log Message: ----------- Fix for crash on survey sync with ls install without any surveys Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-04-26 12:47:52 UTC (rev 641) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-04-26 13:49:09 UTC (rev 642) @@ -1085,8 +1085,14 @@ $select->from($this->_getSurveysTableName(), 'sid') ->order('sid'); $lsSurveys = $lsDb->fetchCol($select); - $lsSurveys = array_combine($lsSurveys, $lsSurveys); + if (!$lsSurveys) { + //If no surveys present, just use an empty array as array_combine fails + $lsSurveys = array(); + } else { + $lsSurveys = array_combine((array) $lsSurveys, (array) $lsSurveys); + } + // Surveys in Gems $gemsSurveys = $this->_getGemsSurveysForSynchronisation(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |