From be34674fca3ab69c181384db52e70cafdd245ed1 Mon Sep 17 00:00:00 2001 From: k_ Date: Wed, 18 Jan 2017 15:54:15 -0500 Subject: [PATCH] Bump version number. --- CONTRIBUTING.md | 2 ++ bin/migration.php | 17 ++++++++++++----- docs/Upgrading.md | 3 +++ phplib/411bootstrap.php | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1f845b9..9e7effa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,8 @@ Contributing ------------ +All contributions are welcome! + 1. Open an issue to discuss the change. 1. Fork the repo and create a topic branch for your change. 2. Hack on the code! diff --git a/bin/migration.php b/bin/migration.php index 2904f70..d693361 100755 --- a/bin/migration.php +++ b/bin/migration.php @@ -40,9 +40,9 @@ function ver_cmp($a, $b) { if(ver_cmp($old_ver, '1.0.1') < 0) { // Add indices to speed up common queries. - FOO\DB::query('CREATE INDEX `jobs_target_date_idx` ON `jobs`(`target_date`)'); - FOO\DB::query('CREATE INDEX `type_target_id_site_id_archived_idx` ON `jobs`(type, target_id, site_id, archived)'); - FOO\DB::query('CREATE INDEX `jobs_type_target_id_site_id_archived_idx` ON `jobs`(type, target_id, site_id, archived)'); + FOO\DB::query('CREATE INDEX IF NOT EXISTS `jobs_target_date_idx` ON `jobs`(`target_date`)'); + FOO\DB::query('CREATE INDEX IF NOT EXISTS `type_target_id_site_id_archived_idx` ON `jobs`(type, target_id, site_id, archived)'); + FOO\DB::query('CREATE INDEX IF NOT EXISTS `jobs_type_target_id_site_id_archived_idx` ON `jobs`(type, target_id, site_id, archived)'); } if(ver_cmp($old_ver, '1.1.0') < 0) { @@ -51,16 +51,23 @@ function ver_cmp($a, $b) { foreach($user_ids as $user_id) { FOO\DB::query('UPDATE `users` SET `api_key`=? WHERE `user_id`=?', [FOO\Random::base64_bytes(FOO\User::API_KEY_LEN), $user_id]); } - FOO\DB::query('CREATE UNIQUE INDEX `users_site_id_api_key_idx` ON `users`(`site_id`, `api_key`);'); + FOO\DB::query('CREATE UNIQUE INDEX IF NOT EXISTS `users_site_id_api_key_idx` ON `users`(`site_id`, `api_key`);'); } if(ver_cmp($old_ver, '1.2.0') < 0) { FOO\DB::query('ALTER TABLE `sites` ADD COLUMN `secure` BOOLEAN NOT NULL DEFAULT 1'); FOO\DB::query('ALTER TABLE `searches` ADD COLUMN `source` VARCHAR(64) NOT NULL DEFAULT ""'); - FOO\DB::query('CREATE INDEX `searches_source_idx` ON `searches`(`source`)'); + FOO\DB::query('CREATE INDEX IF NOT EXISTS `searches_source_idx` ON `searches`(`source`)'); FOO\DB::query('UPDATE `searches` SET `source`="logstash", `type`="es" WHERE `type`="logstash"'); + + $gcfg = FOO\Config::get('graphite'); + $ecfg = FOO\Config::get('elasticsearch'); + + if(FOO\Util::exists($gcfg, 'host') || count(array_diff(array_keys($ecfg), ['alerts', 'logstash'])) > 0) { + printf("NOTE: There have been some config format changes. See Upgrading.md for details.\n"); + } } /** diff --git a/docs/Upgrading.md b/docs/Upgrading.md index e274d0a..175fd57 100644 --- a/docs/Upgrading.md +++ b/docs/Upgrading.md @@ -16,6 +16,8 @@ Migrating from A.B.C to D.E.F Migration complete! ``` +If you have any issues upgrading, you can open a ticket or get help on our Gitter. + ## v1.2 ## With the introduction of Search sources, changes were made to the following Searches: @@ -26,6 +28,7 @@ With the introduction of Search sources, changes were made to the following Sear If you're using any `Logstash` or `Graphite` Searches, you'll need to make some changes: + ### Graphite ### The config should now contain an associative array of sources. Ex: diff --git a/phplib/411bootstrap.php b/phplib/411bootstrap.php index deb9aa6..114f2d3 100644 --- a/phplib/411bootstrap.php +++ b/phplib/411bootstrap.php @@ -20,7 +20,7 @@ date_default_timezone_set("UTC"); define('BASE_DIR', realpath(__DIR__ . '/..')); -define('VERSION', '1.1.0'); +define('VERSION', '1.2.0'); // Set up autoloader for our classes. spl_autoload_register(function($class) {