|
From: <gem...@li...> - 2012-03-01 09:22:50
|
Revision: 520
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=520&view=rev
Author: mennodekker
Date: 2012-03-01 09:22:39 +0000 (Thu, 01 Mar 2012)
Log Message:
-----------
Added final upgrade step to be a task
Modified Paths:
--------------
trunk/library/classes/Gems/Upgrades.php
Added Paths:
-----------
trunk/library/classes/Gems/Task/SourceSyncSurveys.php
Added: trunk/library/classes/Gems/Task/SourceSyncSurveys.php
===================================================================
--- trunk/library/classes/Gems/Task/SourceSyncSurveys.php (rev 0)
+++ trunk/library/classes/Gems/Task/SourceSyncSurveys.php 2012-03-01 09:22:39 UTC (rev 520)
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package Gems
+ * @subpackage Task
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $
+ */
+
+/**
+ * Executes the syncSurveys method for a given sourceId
+ *
+ * @package Gems
+ * @subpackage Task
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.6
+ */
+class Gems_Task_SourceSyncSurveys
+{
+ /**
+ * @var Gems_Tracker
+ */
+ public $tracker;
+
+ public function execute($id = null)
+ {
+ $source = $tracker->getSource($id);
+
+ if ($messages = $source->synchronizeSurveys($this->loader->getCurrentUser()->getUserId())) {
+ foreach ($messages as $message) {
+ $this->_batch->addMessage($message);
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/library/classes/Gems/Upgrades.php
===================================================================
--- trunk/library/classes/Gems/Upgrades.php 2012-02-29 15:44:03 UTC (rev 519)
+++ trunk/library/classes/Gems/Upgrades.php 2012-03-01 09:22:39 UTC (rev 520)
@@ -73,6 +73,7 @@
$this->_batch->addTask('CreateNewTables');
$this->addMessage($this->_('Syncing surveys for all sources'));
+
//Now sync the db sources to allow limesurvey source to add a field to the tokentable
$model = new MUtil_Model_TableModel('gems__sources');
$data = $model->load(false);
@@ -80,13 +81,7 @@
$tracker = $this->loader->getTracker();
foreach ($data as $row) {
- $source = $tracker->getSource($row['gso_id_source']);
-
- if ($messages = $source->synchronizeSurveys($this->loader->getCurrentUser()->getUserId())) {
- foreach ($messages as $message) {
- $this->addMessage($message);
- }
- }
+ $this->_batch->addTask('SourceSyncSurveys', $row['gso_id_source']);
}
$this->invalidateCache();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|