private static function convertLegacyMigrationTable() { $oConnection = Propel::getConnection(); $iCurrentMigration = null; try { $iCurrentMigration = (int) $oConnection->query('SELECT * FROM `propel_migration`', PDO::FETCH_COLUMN, 0)->fetch(); } catch (PDOException $e) { // Migration table removed already. Nothing to do. return; } if (!$iCurrentMigration) { return; } $aPaths = array_merge(array(DIRNAME_SITE, DIRNAME_BASE), array_keys(ResourceFinder::pluginFinder()->find())); foreach ($aPaths as $sPath) { $sTableName = '_migration_' . str_replace('/', '_', $sPath); $oConnection->exec("DROP TABLE IF EXISTS {$sTableName}"); $oConnection->exec("CREATE TABLE {$sTableName} (version int(11) DEFAULT '0')"); $oConnection->exec("INSERT INTO {$sTableName} (version) VALUES ({$iCurrentMigration})"); } $oConnection->exec("DROP TABLE propel_migration"); }
public static function allParts() { $oCache = new Cache("system_parts", DIRNAME_CONFIG, CachingStrategyFile::create()); if ($oCache->entryExists()) { return $oCache->getContentsAsVariable(); } $oBasePart = new BasePart(); $oSitePart = new SitePart(); $aParts = array(DIRNAME_BASE => $oBasePart); // Get all plugins foreach (ResourceFinder::pluginFinder()->returnObjects()->find() as $oPath) { $oPluginPart = SystemPart::getPart($oPath->getRelativePath()); // Plugins depend on base implicitly $oPluginPart->dependOn($oBasePart); // Site depends on plugins implicitly $oSitePart->dependOn($oPluginPart); $aParts[$oPath->getRelativePath()] = $oPluginPart; } $oSitePart->dependOn($oBasePart); $aParts[DIRNAME_SITE] = $oSitePart; // Add dependencies from info foreach ($aParts as $oPart) { $aInfo = $oPart->getInfo(); foreach ($aInfo['dependencies'] as $sDependencyPrefix => $sVersion) { if (isset($aParts[$sDependencyPrefix])) { $oPart->dependOn($aParts[$sDependencyPrefix]); } else { throw new Exception("Dependency of {$oPart->getPrefix()} on {$sDependencyPrefix} can not be satisfied"); } } foreach ($aInfo['optional_dependencies'] as $sDependencyPrefix => $sVersion) { if (isset($aParts[$sDependencyPrefix])) { $oPart->dependOn($aParts[$sDependencyPrefix]); } } } // Order list by dependencies $aParts = self::orderedParts($aParts); // Cache ordered list $oCache->setContents($aParts); return $aParts; }