"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "phprojekt/application/Project/Migration.php" between
PHProjekt-6.2.0.tar.gz and PHProjekt-6.2.1.tar.gz

About: PHProjekt is an application suite that supports communication and management of teams and companies. It includes a group calendar, project management, a request tracker and 12 other modules.

Migration.php  (PHProjekt-6.2.0):Migration.php  (PHProjekt-6.2.1)
skipping to change at line 34 skipping to change at line 34
/** /**
* Return the current module version. * Return the current module version.
* *
* Implements Phprojekt_Migration_Abstract->getCurrentModuleVersion * Implements Phprojekt_Migration_Abstract->getCurrentModuleVersion
* *
* @return String Version * @return String Version
*/ */
public function getCurrentModuleVersion() public function getCurrentModuleVersion()
{ {
return '6.1.5'; return '6.2.1';
} }
public function afterVersionStep($oldVersion, $newVersion) public function afterVersionStep($oldVersion, $newVersion)
{ {
if ($newVersion === "6.1.4") { if ($newVersion === "6.1.4") {
$this->_db->query(<<<HERE $this->_db->query(<<<HERE
INSERT INTO tags_modules_items (module_id, item_id, tag_id) INSERT INTO tags_modules_items (module_id, item_id, tag_id)
SELECT m.module_id, m.item_id, t.id FROM tags_modules AS m SELECT m.module_id, m.item_id, t.id FROM tags_modules AS m
JOIN tags_users AS u ON u.id = m.tag_user_id JOIN tags_users AS u ON u.id = m.tag_user_id
JOIN tags AS t ON t.id = u.tag_id JOIN tags AS t ON t.id = u.tag_id
skipping to change at line 91 skipping to change at line 91
$dbParser = new Phprojekt_DbParser( $dbParser = new Phprojekt_DbParser(
array('useExtraData' => false), array('useExtraData' => false),
Phprojekt::getInstance()->getDb() Phprojekt::getInstance()->getDb()
); );
$dbParser->parseSingleModuleData('Project', null, array('before' => $before, 'after' => $after)); $dbParser->parseSingleModuleData('Project', null, array('before' => $before, 'after' => $after));
Phprojekt::getInstance()->getCache()->clean( Phprojekt::getInstance()->getCache()->clean(
Zend_Cache::CLEANING_MODE_ALL Zend_Cache::CLEANING_MODE_ALL
); );
} }
if (is_null($currentVersion) || Phprojekt::compareVersion($currentVersio
n, '6.2.1') < 0) {
$this->repairUserRightsOnRoot();
$this->patchOldModuleGrids();
}
} }
private function _renameProjectsWithSameTitle() private function _renameProjectsWithSameTitle()
{ {
$this->_db->query(<<<HERE $this->_db->query(<<<HERE
UPDATE project AS p UPDATE project AS p
JOIN ( JOIN (
SELECT title, project_id SELECT title, project_id
FROM project FROM project
GROUP BY title, project_id GROUP BY title, project_id
HAVING COUNT(title) > 1 HAVING COUNT(title) > 1
) AS c ) AS c
ON p.title = c.title AND p.project_id = c.project_id ON p.title = c.title AND p.project_id = c.project_id
SET p.title = CONCAT(p.title, ' (', p.id, ')') SET p.title = CONCAT(p.title, ' (', p.id, ')')
HERE HERE
); );
} }
private function repairUserRightsOnRoot() {
$this->_db->query(<<<HERE
UPDATE item_rights
SET access = 255
WHERE module_id = 1 AND item_id = 1
HERE
);
}
private function patchOldModuleGrids() {
$applicationPath = Phprojekt::getInstance()->getConfig()->applicationPat
h;
$moduleDirs = scandir($applicationPath);
foreach ($moduleDirs as $moduleName) {
if ($moduleName != "." && $moduleName != "..") {
$select = $this->_db->select()
->from("module", array("version", "id"))
->where("name = ?", $moduleName)
->limit(1);
$row = $this->_db->fetchRow($select);
if ($row !== false && Phprojekt::compareVersion($row["version"],
"6.2.1") < 0) {
$this->patchOldModuleGrid($moduleName);
$this->_db->update(
"module",
array("version" => "6.2.1"),
$this->_db->quoteInto("id = ?", $row["id"])
);
}
}
}
}
private function patchOldModuleGrid($moduleName) {
$applicationPath = Phprojekt::getInstance()->getConfig()->applicationPat
h;
$pathFragments = array($applicationPath, $moduleName, "Views", "dojo", "
scripts", "Grid.js");
$filePath = implode(DIRECTORY_SEPARATOR, $pathFragments);
if (file_exists($filePath)) {
$content = file_get_contents($filePath);
$content = str_replace("phpr.Default.Grid", "phpr.Default.LegacyGrid
", $content);
file_put_contents($filePath, $content);
}
}
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 58 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)