|
From: <gem...@li...> - 2012-03-01 12:05:34
|
Revision: 524
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=524&view=rev
Author: mennodekker
Date: 2012-03-01 12:05:22 +0000 (Thu, 01 Mar 2012)
Log Message:
-----------
Fixing loader problem where no new task was created after the first one + some cleanup
Modified Paths:
--------------
trunk/library/classes/Gems/Loader.php
trunk/library/classes/Gems/Task/TaskRunnerBatch.php
trunk/library/classes/Gems/Upgrades.php
trunk/library/classes/Gems/UpgradesAbstract.php
Modified: trunk/library/classes/Gems/Loader.php
===================================================================
--- trunk/library/classes/Gems/Loader.php 2012-03-01 10:53:11 UTC (rev 523)
+++ trunk/library/classes/Gems/Loader.php 2012-03-01 12:05:22 UTC (rev 524)
@@ -206,7 +206,7 @@
* @return Gems_Task_TaskAbstract
*/
public function getTask($name) {
- return $this->_getClass('task', 'Task_' . ucfirst($name));
+ return $this->_loadClass('Task_' . ucfirst($name), true);
}
/**
Modified: trunk/library/classes/Gems/Task/TaskRunnerBatch.php
===================================================================
--- trunk/library/classes/Gems/Task/TaskRunnerBatch.php 2012-03-01 10:53:11 UTC (rev 523)
+++ trunk/library/classes/Gems/Task/TaskRunnerBatch.php 2012-03-01 12:05:22 UTC (rev 524)
@@ -71,6 +71,7 @@
public function addMessage($text)
{
parent::addMessage($text);
+ return $this;
}
/**
@@ -120,7 +121,8 @@
*/
public function setMessage($id, $text)
{
- return parent::setMessage($id, $text);
+ parent::setMessage($id, $text);
+ return $this;
}
/**
Modified: trunk/library/classes/Gems/Upgrades.php
===================================================================
--- trunk/library/classes/Gems/Upgrades.php 2012-03-01 10:53:11 UTC (rev 523)
+++ trunk/library/classes/Gems/Upgrades.php 2012-03-01 12:05:22 UTC (rev 524)
@@ -72,20 +72,17 @@
$this->_batch->addTask('CreateNewTables');
- $this->addMessage($this->_('Syncing surveys for all sources'));
+ $this->_batch->addTask('Echo', $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);
- $tracker = $this->loader->getTracker();
-
foreach ($data as $row) {
$this->_batch->addTask('SourceSyncSurveys', $row['gso_id_source']);
}
- $this->invalidateCache();
-
return true;
}
Modified: trunk/library/classes/Gems/UpgradesAbstract.php
===================================================================
--- trunk/library/classes/Gems/UpgradesAbstract.php 2012-03-01 10:53:11 UTC (rev 523)
+++ trunk/library/classes/Gems/UpgradesAbstract.php 2012-03-01 12:05:22 UTC (rev 524)
@@ -69,11 +69,6 @@
public $db;
/**
- * @var Gems_Model_DbaModel
- */
- public $dbaModel;
-
- /**
* @var GemsEscort
*/
public $escort;
@@ -84,12 +79,6 @@
public $loader;
/**
- *
- * @var Gems_Util_DatabasePatcher
- */
- public $patcher;
-
- /**
* @var Gems_Project_ProjectSettings
*/
public $project;
@@ -130,33 +119,10 @@
*/
protected function addMessage($message)
{
- $this->_messages[] = $message;
+ $this->_batch->addMessage($message);
}
- /**
- * Now we have the requests answered, add the DatabasePatcher as it needs the db object
- *
- * @return boolean
- */
- public function checkRegistryRequestsAnswers() {
- //As an upgrade almost always includes executing db patches, make a DatabasePatcher object available
- $this->patcher = new Gems_Util_DatabasePatcher($this->db, 'patches.sql', $this->escort->getDatabasePaths());
- //Now load all patches, and save the resulting changed patches for later (not used yet)
- $changed = $this->patcher->uploadPatches($this->loader->getVersions()->getBuild());
-
- //Load the dbaModel
- $paths = $this->escort->getDatabasePaths();
- $model = new Gems_Model_DbaModel($this->db, array_values($paths));
- $model->setLocations(array_keys($paths));
- if ($this->project->databaseFileEncoding) {
- $model->setFileEncoding($this->project->databaseFileEncoding);
- }
- $this->dbaModel = $model;
-
- return true;
- }
-
- /**
+ /**
* Reset the message stack
*/
protected function clearMessages()
@@ -165,29 +131,6 @@
}
/**
- * Create all new tables according to the dba model
- */
- protected function createNewTables()
- {
- //Now create all new tables
- $todo = $this->dbaModel->load(array('state'=> Gems_Model_DbaModel::STATE_DEFINED));
- $i = 1;
- $oCount = count($todo);
- $results = array();
- foreach($todo as $tableData) {
- $result = $this->dbaModel->runScript($tableData);
- $results = array_merge($results, $result);
- $results[] = sprintf($this->_('Finished %s creation script for object %d of %d'), $this->_(strtolower($tableData['type'])), $i, $oCount) . '<br/>';
- $i++;
- }
-
- foreach ($results as $result)
- {
- $this->addMessage($result);
- }
- }
-
- /**
* Execute upgrades for the given $context
*
* When no $to or $from are given, the given $context will be upgraded from the current level
@@ -226,7 +169,6 @@
$this->addMessage(sprintf($this->_('Trying upgrade for %s to level %s: %s'), $context, $level, $this->_upgradeStack[$context][$level]['info']));
if (call_user_func($upgrade['upgrade'])) {
$success = $level;
- $this->addMessage('OK');
} else {
$this->addMessage('FAILED');
break;
@@ -373,19 +315,6 @@
}
/**
- * Convenience method for cleaning the cache as this is often needed during
- * upgrades
- */
- public function invalidateCache()
- {
- $cache = $this->escort->cache;
- if ($cache instanceof Zend_Cache_Core) {
- $cache->clean();
- $this->addMessage($this->_('Cache cleaned'));
- }
- }
-
- /**
* Register an upgrade in the stack, it can be executed by using $this->execute
*
* Index and context are optional and will be generated when omitted. For the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|