From af7950b9d0e4d943990d2a44615d48096b5c5a8b Mon Sep 17 00:00:00 2001 From: joseph-d Date: Tue, 8 Nov 2016 09:46:27 +0000 Subject: [PATCH 1/5] Update Filter.php There is an addScopes function for extensibility but no way to remove scopes which are already there. --- modules/backend/widgets/Filter.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/backend/widgets/Filter.php b/modules/backend/widgets/Filter.php index 2a19a3e17..ae39fb375 100644 --- a/modules/backend/widgets/Filter.php +++ b/modules/backend/widgets/Filter.php @@ -477,6 +477,17 @@ class Filter extends WidgetBase $this->allScopes[$name] = $scopeObj; } } + + /** + * Programatically remove a scope, used for extensibility. + * @param string $scopeName Scope name + */ + public function removeScope($scopeName) + { + if (isset($this->allScopes[$scopeName])) { + unset($this->allScopes[$scopeName]); + } + } /** * Creates a filter scope object from name and configuration. From f10de2fc1061562907fa3f92493b9208379c028c Mon Sep 17 00:00:00 2001 From: Konstantin L Date: Thu, 15 Dec 2016 20:57:17 +0100 Subject: [PATCH 2/5] Respect database tables config. --- modules/system/classes/UpdateManager.php | 4 +-- .../migrations/2014_10_01_000010_Db_Jobs.php | 4 +-- .../2015_10_01_000018_Db_FailedJobs.php | 4 +-- ...6_10_01_000020_Db_System_Timestamp_Fix.php | 31 ++++++++++--------- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/modules/system/classes/UpdateManager.php b/modules/system/classes/UpdateManager.php index 6e6948ece..61beb0a65 100644 --- a/modules/system/classes/UpdateManager.php +++ b/modules/system/classes/UpdateManager.php @@ -119,7 +119,7 @@ class UpdateManager */ public function update() { - $firstUp = !Schema::hasTable('migrations'); + $firstUp = !Schema::hasTable(config('database.migrations')); if ($firstUp) { $this->repository->createRepository(); $this->note('Migration table created'); @@ -337,7 +337,7 @@ class UpdateManager } } - Schema::dropIfExists('migrations'); + Schema::dropIfExists(config('database.migrations')); return $this; } diff --git a/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php b/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php index d00239bd7..95667596d 100644 --- a/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php +++ b/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php @@ -7,7 +7,7 @@ class DbJobs extends Migration { public function up() { - Schema::create('jobs', function (Blueprint $table) { + Schema::create(config('queue.connections.database.table'), function (Blueprint $table) { $table->engine = 'InnoDB'; $table->bigIncrements('id'); $table->string('queue'); @@ -22,6 +22,6 @@ class DbJobs extends Migration public function down() { - Schema::dropIfExists('jobs'); + Schema::dropIfExists(config('queue.connections.database.table')); } } diff --git a/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php b/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php index 4c528d879..28ef6f1c5 100644 --- a/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php +++ b/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php @@ -7,7 +7,7 @@ class DbFailedJobs extends Migration { public function up() { - Schema::create('failed_jobs', function (Blueprint $table) { + Schema::create(config('queue.failed.table'), function (Blueprint $table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->text('connection'); @@ -19,6 +19,6 @@ class DbFailedJobs extends Migration public function down() { - Schema::dropIfExists('failed_jobs'); + Schema::dropIfExists(config('queue.failed.table')); } } diff --git a/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php b/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php index 5a2c8d4a9..c4b2edfb5 100644 --- a/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php +++ b/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php @@ -10,24 +10,11 @@ use October\Rain\Database\Updates\Migration; */ class DbSystemTimestampFix extends Migration { - protected $coreTables = [ - 'deferred_bindings', - 'failed_jobs' => 'failed_at', - 'system_files', - 'system_event_logs', - 'system_mail_layouts', - 'system_mail_templates', - 'system_plugin_history' => 'created_at', - 'system_plugin_versions' => 'created_at', - 'system_request_logs', - 'system_revisions', - ]; - public function up() { DbDongle::disableStrictMode(); - foreach ($this->coreTables as $table => $columns) { + foreach ($this->getCoreTables() as $table => $columns) { if (is_int($table)) { $table = $columns; $columns = ['created_at', 'updated_at']; @@ -41,4 +28,20 @@ class DbSystemTimestampFix extends Migration { // ... } + + private function getCoreTables() + { + return [ + 'deferred_bindings', + config('queue.failed.table') => 'failed_at', + 'system_files', + 'system_event_logs', + 'system_mail_layouts', + 'system_mail_templates', + 'system_plugin_history' => 'created_at', + 'system_plugin_versions' => 'created_at', + 'system_request_logs', + 'system_revisions', + ]; + } } From 2b5cf64ddf303499f4ee6a0bc6a0913539538693 Mon Sep 17 00:00:00 2001 From: Konstantin L Date: Tue, 10 Jan 2017 15:23:57 +0100 Subject: [PATCH 3/5] Use Config::get() instead of config() helper. --- modules/system/classes/UpdateManager.php | 4 ++-- .../system/database/migrations/2014_10_01_000010_Db_Jobs.php | 4 ++-- .../database/migrations/2015_10_01_000018_Db_FailedJobs.php | 4 ++-- .../migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/system/classes/UpdateManager.php b/modules/system/classes/UpdateManager.php index 61beb0a65..b95e92fac 100644 --- a/modules/system/classes/UpdateManager.php +++ b/modules/system/classes/UpdateManager.php @@ -119,7 +119,7 @@ class UpdateManager */ public function update() { - $firstUp = !Schema::hasTable(config('database.migrations')); + $firstUp = !Schema::hasTable(Config::get('database.migrations')); if ($firstUp) { $this->repository->createRepository(); $this->note('Migration table created'); @@ -337,7 +337,7 @@ class UpdateManager } } - Schema::dropIfExists(config('database.migrations')); + Schema::dropIfExists(Config::get('database.migrations')); return $this; } diff --git a/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php b/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php index 95667596d..681f61092 100644 --- a/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php +++ b/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php @@ -7,7 +7,7 @@ class DbJobs extends Migration { public function up() { - Schema::create(config('queue.connections.database.table'), function (Blueprint $table) { + Schema::create(Config::get('queue.connections.database.table'), function (Blueprint $table) { $table->engine = 'InnoDB'; $table->bigIncrements('id'); $table->string('queue'); @@ -22,6 +22,6 @@ class DbJobs extends Migration public function down() { - Schema::dropIfExists(config('queue.connections.database.table')); + Schema::dropIfExists(Config::get('queue.connections.database.table')); } } diff --git a/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php b/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php index 28ef6f1c5..6c7887251 100644 --- a/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php +++ b/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php @@ -7,7 +7,7 @@ class DbFailedJobs extends Migration { public function up() { - Schema::create(config('queue.failed.table'), function (Blueprint $table) { + Schema::create(Config::get('queue.failed.table'), function (Blueprint $table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->text('connection'); @@ -19,6 +19,6 @@ class DbFailedJobs extends Migration public function down() { - Schema::dropIfExists(config('queue.failed.table')); + Schema::dropIfExists(Config::get('queue.failed.table')); } } diff --git a/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php b/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php index c4b2edfb5..794182f25 100644 --- a/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php +++ b/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php @@ -33,7 +33,7 @@ class DbSystemTimestampFix extends Migration { return [ 'deferred_bindings', - config('queue.failed.table') => 'failed_at', + Config::get('queue.failed.table') => 'failed_at', 'system_files', 'system_event_logs', 'system_mail_layouts', From 1a267b8d031e9504835af2ff4e78029bb9db0220 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Fri, 13 Jan 2017 06:15:59 +1100 Subject: [PATCH 4/5] Code clean up from #2562 --- modules/system/classes/UpdateManager.php | 13 +++++++++++-- .../migrations/2014_10_01_000010_Db_Jobs.php | 9 +++++++-- .../migrations/2015_10_01_000018_Db_FailedJobs.php | 9 +++++++-- .../2016_10_01_000020_Db_System_Timestamp_Fix.php | 6 ++++-- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/modules/system/classes/UpdateManager.php b/modules/system/classes/UpdateManager.php index b95e92fac..0f1120687 100644 --- a/modules/system/classes/UpdateManager.php +++ b/modules/system/classes/UpdateManager.php @@ -119,7 +119,7 @@ class UpdateManager */ public function update() { - $firstUp = !Schema::hasTable(Config::get('database.migrations')); + $firstUp = !Schema::hasTable($this->getMigrationTableName()); if ($firstUp) { $this->repository->createRepository(); $this->note('Migration table created'); @@ -337,7 +337,7 @@ class UpdateManager } } - Schema::dropIfExists(Config::get('database.migrations')); + Schema::dropIfExists($this->getMigrationTableName()); return $this; } @@ -874,4 +874,13 @@ class UpdateManager { return base64_encode(hash_hmac('sha512', http_build_query($data, '', '&'), base64_decode($secret), true)); } + + // + // Internals + // + + protected function getMigrationTableName() + { + return Config::get('database.migrations', 'migrations'); + } } diff --git a/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php b/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php index 681f61092..c04fcc96f 100644 --- a/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php +++ b/modules/system/database/migrations/2014_10_01_000010_Db_Jobs.php @@ -7,7 +7,7 @@ class DbJobs extends Migration { public function up() { - Schema::create(Config::get('queue.connections.database.table'), function (Blueprint $table) { + Schema::create($this->getTableName(), function (Blueprint $table) { $table->engine = 'InnoDB'; $table->bigIncrements('id'); $table->string('queue'); @@ -22,6 +22,11 @@ class DbJobs extends Migration public function down() { - Schema::dropIfExists(Config::get('queue.connections.database.table')); + Schema::dropIfExists($this->getTableName()); + } + + protected function getTableName() + { + return Config::get('queue.connections.database.table', 'jobs'); } } diff --git a/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php b/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php index 6c7887251..ec9012d39 100644 --- a/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php +++ b/modules/system/database/migrations/2015_10_01_000018_Db_FailedJobs.php @@ -7,7 +7,7 @@ class DbFailedJobs extends Migration { public function up() { - Schema::create(Config::get('queue.failed.table'), function (Blueprint $table) { + Schema::create($this->getTableName(), function (Blueprint $table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->text('connection'); @@ -19,6 +19,11 @@ class DbFailedJobs extends Migration public function down() { - Schema::dropIfExists(Config::get('queue.failed.table')); + Schema::dropIfExists($this->getTableName()); + } + + protected function getTableName() + { + return Config::get('queue.failed.table', 'failed_jobs'); } } diff --git a/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php b/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php index 794182f25..c1ce81107 100644 --- a/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php +++ b/modules/system/database/migrations/2016_10_01_000020_Db_System_Timestamp_Fix.php @@ -29,11 +29,13 @@ class DbSystemTimestampFix extends Migration // ... } - private function getCoreTables() + protected function getCoreTables() { + $failedJobsTable = Config::get('queue.failed.table', 'failed_jobs'); + return [ 'deferred_bindings', - Config::get('queue.failed.table') => 'failed_at', + $failedJobsTable => 'failed_at', 'system_files', 'system_event_logs', 'system_mail_layouts', From 7894284409eb4f0f8122b8b3a2129a5ad51d0de4 Mon Sep 17 00:00:00 2001 From: Alexander Guth Date: Thu, 12 Jan 2017 22:02:41 +0100 Subject: [PATCH 5/5] Add afterUpdate event (#2574) Add afterUpdate event --- modules/system/assets/ui/js/input.preset.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/system/assets/ui/js/input.preset.js b/modules/system/assets/ui/js/input.preset.js index dbccc0172..495af6a03 100644 --- a/modules/system/assets/ui/js/input.preset.js +++ b/modules/system/assets/ui/js/input.preset.js @@ -247,14 +247,14 @@ if ($el.val().length && $el.val() != prefix) return - $el.val(prefix) + $el.val(prefix).trigger('oc.inputPreset.afterUpdate') this.$src = $(options.inputPreset, parent), this.$src.on('keyup', function() { if (self.cancelled) return - $el.val(prefix + self.formatValue()) + $el.val(prefix + self.formatValue()).trigger('oc.inputPreset.afterUpdate') }) this.$el.on('change', function() {