/** * Prepare urls to run post upgrade tasks * * @param string $baseInstalUrl base install url (prepared by OX_Admin_UI_Controller_Request::getBaseUrl) * @param OA_Upgrade $oUpgrade optional * @return array array of arrays of 'name' and 'url' strings */ static function getTasksUrls($baseInstallUrl, OA_Upgrade $oUpgrade = null) { // init OA_Upgrade if needed if (!isset($oUpgrade)) { $oUpgrade = new OA_Upgrade(); } $aUpgradeTasks = $oUpgrade->getPostUpgradeTasks(); $aUrls = array(); foreach ($aUpgradeTasks as $task) { $aUrls[] = array('id' => 'task:' . $task, 'name' => $GLOBALS['strPostInstallTaskRunning'] . ': ' . $task, 'url' => $baseInstallUrl . 'install-runtask.php?task=' . $task); } return $aUrls; }
function testGetPostUpgradeTasks() { // create upgrade file $oUpgrade = new OA_Upgrade(); $oUpgrade->addPostUpgradeTask('Test_1'); $oUpgrade->addPostUpgradeTask('Test_2'); $oUpgrade->addPostUpgradeTask('Test_3'); $this->assertTrue($oUpgrade->_writePostUpgradeTasksFile()); $result = $oUpgrade->getPostUpgradeTasks(); $this->assertEqual($result, array('Test_1', 'Test_2', 'Test_3')); // clean upgrade file $this->assertTrue($oUpgrade->pickupPostUpgradeTasksFile()); }