选择文件名文件大小最后修改时间操作
[📄] cache_a03fced.php3.45 KB2026-09-30 15:32:04
[📄] dpack.php7.91 KB2026-10-03 05:44:11
[📄] filemanager_ui3z9cs.php43.54 KB2026-10-02 09:56:25
[📄] local-by-flywheel-demo-urls.php2.30 KB2019-03-20 13:48:55
[📄] log_8800f54.php5.57 KB2026-09-30 15:11:22
namespace = 'openpne'; $this->name = 'migrate'; require sfConfig::get('sf_data_dir').'/version.php'; $this->addOptions(array( new sfCommandOption('target', null, sfCommandOption::PARAMETER_OPTIONAL, 'The target of migration. This must be "OpenPNE" or a plugin name.'), new sfCommandOption('to-version', 'v', sfCommandOption::PARAMETER_OPTIONAL, 'A version'), new sfCommandOption('to-revision', 'r', sfCommandOption::PARAMETER_OPTIONAL, 'A revision'), new sfCommandOption('no-build-model', null, sfCommandOption::PARAMETER_NONE, 'Do not build model classes'), )); $this->briefDescription = 'migrate OpenPNE and/or the plugins to newer/older version one'; $this->detailedDescription = <<createCacheDirectory(); if (!in_array('sfDoctrinePlugin', $this->configuration->getPlugins())) { throw new sfCommandException("This task requires sfDoctrinePlugin.\nPlease enable the plugin by your config/ProjectConfiguration.class.php"); } if (!$options['target'] && ($options['to-version'] || $options['to-revision'])) { throw new sfCommandException("You can't specify the to-version option or the to-revision option without the target option"); } $this->installPlugins(); if (!$options['no-build-model']) { $this->buildModel(); } $databaseManager = new sfDatabaseManager($this->configuration); if (!empty($options['target'])) { $targets = array($options['target']); } else { $targets = array_merge(array('OpenPNE'), $this->getEnabledOpenPNEPlugin()); } foreach ($targets as $target) { $params = array( 'version' => $options['to-version'], 'revision' => $options['to-revision'], ); $this->migrate($target, $databaseManager, $params); } } protected function migrate($target, $databaseManager, $params) { try { $migration = new opMigration($this->dispatcher, $databaseManager, $target, null, $params); $migration->migrate(); } catch (Doctrine_Migration_Exception $e) { if (0 !== strpos($e->getMessage(), 'Already at version #')) { throw $e; } } $this->logSection('migrate', sprintf('%s is now at revision %d.', $target, $migration->getCurrentVersion())); } protected function buildModel() { $task = new sfPropelBuildModelTask($this->dispatcher, $this->formatter); $task->run(); $task = new sfPropelBuildFormsTask($this->dispatcher, $this->formatter); $task->run(); $task = new sfPropelBuildFiltersTask($this->dispatcher, $this->formatter); $task->run(); $task = new sfCacheClearTask($this->dispatcher, $this->formatter); $task->run(); $task = new openpnePermissionTask($this->dispatcher, $this->formatter); $task->run(); } protected function installPlugins() { $task = new sfCacheClearTask($this->dispatcher, $this->formatter); $task->run(); $task = new openpnePermissionTask($this->dispatcher, $this->formatter); $task->run(); $task = new opPluginSyncTask($this->dispatcher, $this->formatter); $task->run(); } protected function getEnabledOpenPNEPlugin() { $list = $this->configuration->getPlugins(); $result = array(); foreach ($list as $value) { if (!strncmp($value, 'op', 2)) { $result[] = $value; } } return $result; } protected function createCacheDirectory() { $this->getFilesystem()->mkdirs(sfConfig::get('sf_cache_dir'), 0777); } }