From 7b00768f3a0c6682d453eacdb3f5bf2db1de5e48 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Thu, 27 Feb 2020 19:58:11 +1100 Subject: [PATCH] Remove local notes support --- modules/system/classes/UpdateManager.php | 50 ++++------------------- modules/system/classes/VersionManager.php | 38 ++--------------- 2 files changed, 12 insertions(+), 76 deletions(-) diff --git a/modules/system/classes/UpdateManager.php b/modules/system/classes/UpdateManager.php index 8fe43604d..2a2803d1c 100644 --- a/modules/system/classes/UpdateManager.php +++ b/modules/system/classes/UpdateManager.php @@ -29,11 +29,6 @@ class UpdateManager { use \October\Rain\Support\Traits\Singleton; - /** - * @var array The notes for the current operation. - */ - protected $notes = []; - /** * @var \Illuminate\Console\OutputStyle */ @@ -347,11 +342,11 @@ class UpdateManager /* * Rollback modules */ - while (true) { - if (isset($this->notesOutput)) { - $this->migrator->setOutput($this->notesOutput); - } + if (isset($this->notesOutput)) { + $this->migrator->setOutput($this->notesOutput); + } + while (true) { $rolledBack = $this->migrator->rollback($paths, ['pretend' => false]); if (count($rolledBack) == 0) { @@ -405,12 +400,12 @@ class UpdateManager */ public function migrateModule($module) { - $this->note($module); - if (isset($this->notesOutput)) { $this->migrator->setOutput($this->notesOutput); } + $this->note($module); + $this->migrator->run(base_path() . '/modules/'.strtolower($module).'/database/migrations'); return $this; @@ -520,13 +515,9 @@ class UpdateManager $this->note($name); - $this->versionManager->resetNotes()->setNotesOutput($this->notesOutput); + $this->versionManager->setNotesOutput($this->notesOutput); - if ($this->versionManager->updatePlugin($plugin) !== false) { - foreach ($this->versionManager->getNotes() as $note) { - $this->note($note); - } - } + $this->versionManager->updatePlugin($plugin); return $this; } @@ -797,31 +788,6 @@ class UpdateManager if ($this->notesOutput !== null) { $this->notesOutput->writeln($message); } - else { - $this->notes[] = $message; - } - - return $this; - } - - /** - * Get the notes for the last operation. - * @return array - */ - public function getNotes() - { - return $this->notes; - } - - /** - * Resets the notes store. - * @return self - */ - public function resetNotes() - { - $this->notesOutput = null; - - $this->notes = []; return $this; } diff --git a/modules/system/classes/VersionManager.php b/modules/system/classes/VersionManager.php index 55e8636fe..fac34d1b2 100644 --- a/modules/system/classes/VersionManager.php +++ b/modules/system/classes/VersionManager.php @@ -29,12 +29,6 @@ class VersionManager const HISTORY_TYPE_COMMENT = 'comment'; const HISTORY_TYPE_SCRIPT = 'script'; - /** - * The notes for the current operation. - * @var array - */ - protected $notes = []; - /** * @var \Illuminate\Console\OutputStyle */ @@ -412,6 +406,7 @@ class VersionManager * Execute the database PHP script */ $updateFile = $this->pluginManager->getPluginPath($code) . '/updates/' . $script; + $this->updater->packDown($updateFile); Db::table('system_plugin_history') @@ -481,31 +476,6 @@ class VersionManager if ($this->notesOutput !== null) { $this->notesOutput->writeln($message); } - else { - $this->notes[] = $message; - } - - return $this; - } - - /** - * Get the notes for the last operation. - * @return array - */ - public function getNotes() - { - return $this->notes; - } - - /** - * Resets the notes store. - * @return self - */ - public function resetNotes() - { - $this->notesOutput = null; - - $this->notes = []; return $this; } @@ -523,8 +493,7 @@ class VersionManager } /** - * @param $details - * + * Extract script and comments from version details * @return array */ protected function extractScriptsAndComments($details) @@ -539,7 +508,8 @@ class VersionManager $scripts = array_values(array_filter($details, function ($detail) use ($fileNamePattern) { return preg_match($fileNamePattern, $detail); })); - } else { + } + else { $comments = (array)$details; $scripts = []; }