diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f9779aa5..76921748 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -75,6 +75,7 @@ package: script: - apt-get update - apt-get install zip unzip + - cd api - composer install --no-dev - cd ../ci - bash build_zip.sh diff --git a/api/autoload.php b/api/autoload.php index 0712c2e1..0f14ff20 100644 --- a/api/autoload.php +++ b/api/autoload.php @@ -22,6 +22,5 @@ require_once(__DIR__ . '/../inc/custom_fields.inc.php'); // Load the ApplicationContext $builder = new \DI\ContainerBuilder(); -$builder->setDefinitionCache(new \Doctrine\Common\Cache\ArrayCache()); $applicationContext = $builder->build(); \ No newline at end of file diff --git a/api/composer.json b/api/composer.json index e4c083d0..af1cbfdf 100644 --- a/api/composer.json +++ b/api/composer.json @@ -1,7 +1,7 @@ { "name": "mike-koch/Mods-for-HESK", "description": "New UI and features for HESK, a free helpdesk solution", - "minimum-stability": "dev", + "minimum-stability": "stable", "license": "MIT", "authors": [ { @@ -19,6 +19,7 @@ "php-http/message": "^1.5", "php-http/curl-client": "^1.7", "guzzlehttp/psr7": "^1.3", - "mike-koch/php-di": "4.4.11" + "mike-koch/php-di": "4.4.11", + "doctrine/annotations": "1.2" } } diff --git a/api/composer.lock b/api/composer.lock index f8503360..2fdfc9ea 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f84b1b3e118e669dc5110809cbc86e4c", + "content-hash": "5259191309e50288eeb2370dd4f35c5f", "packages": [ { "name": "clue/stream-filter", @@ -91,35 +91,35 @@ }, { "name": "doctrine/annotations", - "version": "dev-master", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "2497b1f9db56278d3ad2248f9e4bdbbbaa271c3e" + "reference": "d9b1a37e9351ddde1f19f09a02e3d6ee92e82efd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/2497b1f9db56278d3ad2248f9e4bdbbbaa271c3e", - "reference": "2497b1f9db56278d3ad2248f9e4bdbbbaa271c3e", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/d9b1a37e9351ddde1f19f09a02e3d6ee92e82efd", + "reference": "d9b1a37e9351ddde1f19f09a02e3d6ee92e82efd", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": "^7.1" + "php": ">=5.3.2" }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "4.*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + "psr-0": { + "Doctrine\\Common\\Annotations\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", @@ -128,24 +128,29 @@ ], "authors": [ { - "name": "Roman Borschel", - "email": "roman@code-factory.org" + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/", + "role": "Creator" }, { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" }, { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" + "name": "Roman Borschel", + "email": "roman@code-factory.org" }, { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" }, { "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" } ], "description": "Docblock Annotations Parser", @@ -155,20 +160,20 @@ "docblock", "parser" ], - "time": "2017-07-22 11:08:38" + "time": "2014-07-06T15:52:21+00:00" }, { "name": "doctrine/cache", - "version": "dev-master", + "version": "v1.7.1", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "beb0fa35b61e9073f8612d9ffd34920bdaec406a" + "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/beb0fa35b61e9073f8612d9ffd34920bdaec406a", - "reference": "beb0fa35b61e9073f8612d9ffd34920bdaec406a", + "url": "https://api.github.com/repos/doctrine/cache/zipball/b3217d58609e9c8e661cd41357a54d926c4a2a1a", + "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a", "shasum": "" }, "require": { @@ -179,11 +184,9 @@ }, "require-dev": { "alcaeus/mongo-php-adapter": "^1.1", - "doctrine/coding-standard": "^1.0", "mongodb/mongodb": "^1.1", - "phpunit/phpunit": "^6.3", - "predis/predis": "~1.0", - "squizlabs/php_codesniffer": "^3.0" + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0" }, "suggest": { "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" @@ -191,7 +194,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -231,20 +234,20 @@ "cache", "caching" ], - "time": "2017-08-25 06:51:37" + "time": "2017-08-25T07:02:50+00:00" }, { "name": "doctrine/lexer", - "version": "dev-master", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "cc709ba91eee09540091ad5a5f2616727662e41b" + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/cc709ba91eee09540091ad5a5f2616727662e41b", - "reference": "cc709ba91eee09540091ad5a5f2616727662e41b", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", "shasum": "" }, "require": { @@ -257,8 +260,8 @@ } }, "autoload": { - "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", @@ -285,7 +288,7 @@ "lexer", "parser" ], - "time": "2017-07-24 09:37:08" + "time": "2014-09-09T13:34:57+00:00" }, { "name": "guzzlehttp/guzzle", @@ -354,16 +357,16 @@ }, { "name": "guzzlehttp/promises", - "version": "dev-master", + "version": "v1.3.1", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "09e549f5534380c68761260a71f847644d8f65aa" + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/09e549f5534380c68761260a71f847644d8f65aa", - "reference": "09e549f5534380c68761260a71f847644d8f65aa", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", "shasum": "" }, "require": { @@ -401,20 +404,20 @@ "keywords": [ "promise" ], - "time": "2017-05-20 23:14:18" + "time": "2016-12-20T10:07:11+00:00" }, { "name": "guzzlehttp/psr7", - "version": "dev-master", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "811b676fbab9c99e359885032e5ebc70e442f5b8" + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/811b676fbab9c99e359885032e5ebc70e442f5b8", - "reference": "811b676fbab9c99e359885032e5ebc70e442f5b8", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", "shasum": "" }, "require": { @@ -466,7 +469,7 @@ "uri", "url" ], - "time": "2017-07-17 09:11:21" + "time": "2017-03-20T17:10:46+00:00" }, { "name": "mailgun/mailgun-php", @@ -707,22 +710,22 @@ }, { "name": "php-http/client-common", - "version": "dev-master", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/php-http/client-common.git", - "reference": "600ea9a5d867a7bbe1c4e03722b8dc2ebc9bd3c8" + "reference": "1901ad36347227c14751a218d8f4ea1467d1f1ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/client-common/zipball/600ea9a5d867a7bbe1c4e03722b8dc2ebc9bd3c8", - "reference": "600ea9a5d867a7bbe1c4e03722b8dc2ebc9bd3c8", + "url": "https://api.github.com/repos/php-http/client-common/zipball/1901ad36347227c14751a218d8f4ea1467d1f1ed", + "reference": "1901ad36347227c14751a218d8f4ea1467d1f1ed", "shasum": "" }, "require": { "php": ">=5.4", "php-http/httplug": "^1.1", - "php-http/message": "^1.2", + "php-http/message": "^1.6", "php-http/message-factory": "^1.0", "symfony/options-resolver": "^2.6 || ^3.0" }, @@ -739,7 +742,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.7-dev" } }, "autoload": { @@ -765,7 +768,7 @@ "http", "httplug" ], - "time": "2017-08-05 15:50:10" + "time": "2017-10-16T16:16:36+00:00" }, { "name": "php-http/curl-client", @@ -825,16 +828,16 @@ }, { "name": "php-http/discovery", - "version": "dev-master", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "d39a8798c473b6b896059a8de576598e4d17d992" + "reference": "7b50ab4d6c9fdaa1ed53ae310c955900af6e3372" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/d39a8798c473b6b896059a8de576598e4d17d992", - "reference": "d39a8798c473b6b896059a8de576598e4d17d992", + "url": "https://api.github.com/repos/php-http/discovery/zipball/7b50ab4d6c9fdaa1ed53ae310c955900af6e3372", + "reference": "7b50ab4d6c9fdaa1ed53ae310c955900af6e3372", "shasum": "" }, "require": { @@ -883,25 +886,25 @@ "message", "psr7" ], - "time": "2017-09-13 14:06:45" + "time": "2017-08-03T10:12:53+00:00" }, { "name": "php-http/guzzle6-adapter", - "version": "dev-master", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/php-http/guzzle6-adapter.git", - "reference": "54181ff8455a4c2e1706a53e0d98060b93030321" + "reference": "a56941f9dc6110409cfcddc91546ee97039277ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/guzzle6-adapter/zipball/54181ff8455a4c2e1706a53e0d98060b93030321", - "reference": "54181ff8455a4c2e1706a53e0d98060b93030321", + "url": "https://api.github.com/repos/php-http/guzzle6-adapter/zipball/a56941f9dc6110409cfcddc91546ee97039277ab", + "reference": "a56941f9dc6110409cfcddc91546ee97039277ab", "shasum": "" }, "require": { "guzzlehttp/guzzle": "^6.0", - "php": "^5.5 || ^7.0", + "php": ">=5.5.0", "php-http/httplug": "^1.0" }, "provide": { @@ -910,7 +913,7 @@ }, "require-dev": { "ext-curl": "*", - "php-http/client-integration-tests": "^0.6" + "php-http/adapter-integration-tests": "^0.4" }, "type": "library", "extra": { @@ -943,20 +946,20 @@ "Guzzle", "http" ], - "time": "2017-05-29 15:06:15" + "time": "2016-05-10T06:13:32+00:00" }, { "name": "php-http/httplug", - "version": "dev-master", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/php-http/httplug.git", - "reference": "036f86f0cb1f37c13dd9b5e75b71866e7ab3f60b" + "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/036f86f0cb1f37c13dd9b5e75b71866e7ab3f60b", - "reference": "036f86f0cb1f37c13dd9b5e75b71866e7ab3f60b", + "url": "https://api.github.com/repos/php-http/httplug/zipball/1c6381726c18579c4ca2ef1ec1498fdae8bdf018", + "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018", "shasum": "" }, "require": { @@ -971,7 +974,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -999,11 +1002,11 @@ "client", "http" ], - "time": "2017-08-18 18:51:51" + "time": "2016-08-31T08:30:17+00:00" }, { "name": "php-http/message", - "version": "dev-master", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/php-http/message.git", @@ -1071,20 +1074,20 @@ "message", "psr-7" ], - "time": "2017-07-05 06:40:53" + "time": "2017-07-05T06:40:53+00:00" }, { "name": "php-http/message-factory", - "version": "dev-master", + "version": "v1.0.2", "source": { "type": "git", "url": "https://github.com/php-http/message-factory.git", - "reference": "a2809d4fe294ebe8879aec8d4d5bf21faa029344" + "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message-factory/zipball/a2809d4fe294ebe8879aec8d4d5bf21faa029344", - "reference": "a2809d4fe294ebe8879aec8d4d5bf21faa029344", + "url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1", + "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1", "shasum": "" }, "require": { @@ -1121,20 +1124,20 @@ "stream", "uri" ], - "time": "2016-02-03 08:16:31" + "time": "2015-12-19T14:08:53+00:00" }, { "name": "php-http/multipart-stream-builder", - "version": "dev-master", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/php-http/multipart-stream-builder.git", - "reference": "0f66890b095841c1606be107d68be250fe8ed768" + "reference": "1fa3c623fc813a43b39494b2a1612174e36e0fb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/0f66890b095841c1606be107d68be250fe8ed768", - "reference": "0f66890b095841c1606be107d68be250fe8ed768", + "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/1fa3c623fc813a43b39494b2a1612174e36e0fb0", + "reference": "1fa3c623fc813a43b39494b2a1612174e36e0fb0", "shasum": "" }, "require": { @@ -1151,7 +1154,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "0.3-dev" } }, "autoload": { @@ -1178,20 +1181,20 @@ "multipart stream", "stream" ], - "time": "2017-05-21 18:01:57" + "time": "2017-05-21T17:45:25+00:00" }, { "name": "php-http/promise", - "version": "dev-master", + "version": "v1.0.0", "source": { "type": "git", "url": "https://github.com/php-http/promise.git", - "reference": "810b30da8bcf69e4b82c4b9bc6b31518234293ab" + "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/promise/zipball/810b30da8bcf69e4b82c4b9bc6b31518234293ab", - "reference": "810b30da8bcf69e4b82c4b9bc6b31518234293ab", + "url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980", + "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980", "shasum": "" }, "require-dev": { @@ -1201,7 +1204,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -1228,7 +1231,7 @@ "keywords": [ "promise" ], - "time": "2016-01-28 07:54:12" + "time": "2016-01-26T13:27:02+00:00" }, { "name": "phpmailer/phpmailer", @@ -1309,16 +1312,16 @@ }, { "name": "psr/container", - "version": "dev-master", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "2cc4a01788191489dc7459446ba832fa79a216a7" + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/2cc4a01788191489dc7459446ba832fa79a216a7", - "reference": "2cc4a01788191489dc7459446ba832fa79a216a7", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "shasum": "" }, "require": { @@ -1354,11 +1357,11 @@ "container-interop", "psr" ], - "time": "2017-06-28 15:35:32" + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/http-message", - "version": "dev-master", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", @@ -1404,20 +1407,20 @@ "request", "response" ], - "time": "2016-08-06 14:39:51" + "time": "2016-08-06T14:39:51+00:00" }, { "name": "symfony/options-resolver", - "version": "3.4.x-dev", + "version": "v3.3.10", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "9e2ed813a4683bfa310a45d416b922fd7ede638c" + "reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/9e2ed813a4683bfa310a45d416b922fd7ede638c", - "reference": "9e2ed813a4683bfa310a45d416b922fd7ede638c", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/ee4e22978fe885b54ee5da8c7964f0a5301abfb6", + "reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6", "shasum": "" }, "require": { @@ -1426,7 +1429,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -1458,20 +1461,20 @@ "configuration", "options" ], - "time": "2017-08-03 09:34:20" + "time": "2017-07-29T21:54:42+00:00" }, { "name": "webmozart/assert", - "version": "dev-master", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "4a8bf11547e139e77b651365113fc12850c43d9a" + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/4a8bf11547e139e77b651365113fc12850c43d9a", - "reference": "4a8bf11547e139e77b651365113fc12850c43d9a", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", "shasum": "" }, "require": { @@ -1508,7 +1511,7 @@ "check", "validate" ], - "time": "2016-11-23 20:04:41" + "time": "2016-11-23T20:04:58+00:00" }, { "name": "zendframework/zend-code", @@ -1564,16 +1567,16 @@ }, { "name": "zendframework/zend-eventmanager", - "version": "dev-develop", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "071016ade1deee5b8346ec9d8d48935437746c37" + "reference": "9d72db10ceb6e42fb92350c0cb54460da61bd79c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/071016ade1deee5b8346ec9d8d48935437746c37", - "reference": "071016ade1deee5b8346ec9d8d48935437746c37", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/9d72db10ceb6e42fb92350c0cb54460da61bd79c", + "reference": "9d72db10ceb6e42fb92350c0cb54460da61bd79c", "shasum": "" }, "require": { @@ -1614,31 +1617,33 @@ "events", "zf2" ], - "time": "2017-07-11 19:19:12" + "time": "2017-07-11T19:17:22+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "dev-master", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "7af8066e48b8a4cbd90849bbe9234ab444057968" + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/7af8066e48b8a4cbd90849bbe9234ab444057968", - "reference": "7af8066e48b8a4cbd90849bbe9234ab444057968", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { + "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3" + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" }, "type": "library", "extra": { @@ -1668,41 +1673,44 @@ "constructor", "instantiate" ], - "time": "2017-09-19T12:41:22+00:00" + "time": "2017-07-22T11:58:36+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.x-dev", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": "^5.6 || ^7.0" }, "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.1" }, "type": "library", "autoload": { "psr-4": { "DeepCopy\\": "src/DeepCopy/" - } + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", "keywords": [ "clone", "copy", @@ -1710,20 +1718,20 @@ "object", "object graph" ], - "time": "2017-04-12 18:52:22" + "time": "2017-10-19T19:58:43+00:00" }, { "name": "phar-io/manifest", - "version": "dev-master", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "014feadb268809af7c8e2f7ccd396b8494901f58" + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/014feadb268809af7c8e2f7ccd396b8494901f58", - "reference": "014feadb268809af7c8e2f7ccd396b8494901f58", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", "shasum": "" }, "require": { @@ -1765,7 +1773,7 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-04-07 07:07:10" + "time": "2017-03-05T18:14:27+00:00" }, { "name": "phar-io/version", @@ -1816,7 +1824,7 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "dev-master", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", @@ -1962,7 +1970,7 @@ }, { "name": "phpspec/prophecy", - "version": "dev-master", + "version": "v1.7.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", @@ -2021,20 +2029,20 @@ "spy", "stub" ], - "time": "2017-09-04 11:05:03" + "time": "2017-09-04T11:05:03+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "dev-master", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "77a1ba8076365f943e2a3d75573b6c9822840ac6" + "reference": "8ed1902a57849e117b5651fc1a5c48110946c06b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/77a1ba8076365f943e2a3d75573b6c9822840ac6", - "reference": "77a1ba8076365f943e2a3d75573b6c9822840ac6", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8ed1902a57849e117b5651fc1a5c48110946c06b", + "reference": "8ed1902a57849e117b5651fc1a5c48110946c06b", "shasum": "" }, "require": { @@ -2043,7 +2051,7 @@ "php": "^7.0", "phpunit/php-file-iterator": "^1.4.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0", + "phpunit/php-token-stream": "^1.4.11 || ^2.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", "sebastian/environment": "^3.0", "sebastian/version": "^2.0.1", @@ -2085,11 +2093,11 @@ "testing", "xunit" ], - "time": "2017-08-25 06:32:04" + "time": "2017-08-03T12:40:43+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "dev-master", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", @@ -2132,7 +2140,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03 07:40:28" + "time": "2016-10-03T07:40:28+00:00" }, { "name": "phpunit/php-text-template", @@ -2177,16 +2185,16 @@ }, { "name": "phpunit/php-timer", - "version": "dev-master", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "d107f347d368dd8a384601398280c7c608390ab7" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/d107f347d368dd8a384601398280c7c608390ab7", - "reference": "d107f347d368dd8a384601398280c7c608390ab7", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { @@ -2222,11 +2230,11 @@ "keywords": [ "timer" ], - "time": "2017-03-07 15:42:04" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "dev-master", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", @@ -2271,7 +2279,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-08-20 05:47:52" + "time": "2017-08-20T05:47:52+00:00" }, { "name": "phpunit/phpunit", @@ -2359,7 +2367,7 @@ }, { "name": "phpunit/phpunit-mock-objects", - "version": "dev-master", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", @@ -2414,20 +2422,20 @@ "mock", "xunit" ], - "time": "2017-08-03 14:08:16" + "time": "2017-08-03T14:08:16+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "dev-master", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "3488be0a7b346cd6e5361510ed07e88f9bea2e88" + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/3488be0a7b346cd6e5361510ed07e88f9bea2e88", - "reference": "3488be0a7b346cd6e5361510ed07e88f9bea2e88", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "shasum": "" }, "require": { @@ -2459,20 +2467,20 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04 10:23:55" + "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", - "version": "dev-master", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fb3213355da37bf91569ca7a944af19bc57b80e9" + "reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fb3213355da37bf91569ca7a944af19bc57b80e9", - "reference": "fb3213355da37bf91569ca7a944af19bc57b80e9", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/ae068fede81d06e7bb9bb46a367210a3d3e1fe6a", + "reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a", "shasum": "" }, "require": { @@ -2486,7 +2494,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -2517,17 +2525,17 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", + "homepage": "http://www.github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-08-20 14:03:32" + "time": "2017-08-03T07:14:59+00:00" }, { "name": "sebastian/diff", - "version": "dev-master", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", @@ -2575,11 +2583,11 @@ "keywords": [ "diff" ], - "time": "2017-08-03 08:09:46" + "time": "2017-08-03T08:09:46+00:00" }, { "name": "sebastian/environment", - "version": "dev-master", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", @@ -2625,11 +2633,11 @@ "environment", "hhvm" ], - "time": "2017-07-01 08:51:00" + "time": "2017-07-01T08:51:00+00:00" }, { "name": "sebastian/exporter", - "version": "dev-master", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", @@ -2692,11 +2700,11 @@ "export", "exporter" ], - "time": "2017-04-03 13:19:02" + "time": "2017-04-03T13:19:02+00:00" }, { "name": "sebastian/global-state", - "version": "dev-master", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", @@ -2743,11 +2751,11 @@ "keywords": [ "global state" ], - "time": "2017-04-27 15:39:26" + "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", - "version": "dev-master", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", @@ -2790,11 +2798,11 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03 12:35:26" + "time": "2017-08-03T12:35:26+00:00" }, { "name": "sebastian/object-reflector", - "version": "dev-master", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", @@ -2835,20 +2843,20 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29 09:07:27" + "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", - "version": "dev-master", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "a0e54bc9bf04e2c5b302236984cebc277631f0f1" + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/a0e54bc9bf04e2c5b302236984cebc277631f0f1", - "reference": "a0e54bc9bf04e2c5b302236984cebc277631f0f1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { @@ -2888,20 +2896,20 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-07 15:09:59" + "time": "2017-03-03T06:23:57+00:00" }, { "name": "sebastian/resource-operations", - "version": "dev-master", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "fadc83f7c41fb2924e542635fea47ae546816ece" + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/fadc83f7c41fb2924e542635fea47ae546816ece", - "reference": "fadc83f7c41fb2924e542635fea47ae546816ece", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", "shasum": "" }, "require": { @@ -2930,11 +2938,11 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2016-10-03 07:43:09" + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", - "version": "dev-master", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", @@ -2973,7 +2981,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03 07:35:21" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "theseer/tokenizer", @@ -3017,7 +3025,7 @@ } ], "aliases": [], - "minimum-stability": "dev", + "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, diff --git a/css/mods-for-hesk-new.css b/css/mods-for-hesk-new.css index d1dec79a..ce36e59a 100644 --- a/css/mods-for-hesk-new.css +++ b/css/mods-for-hesk-new.css @@ -178,6 +178,11 @@ button.dropdown-submit { min-width: 350px; } +.installer-login-box { + width: 50%; + min-width: 350px; +} + .login-box-container { position: relative; } diff --git a/install/ajax/get-migration-ajax.php b/install/ajax/get-migration-ajax.php new file mode 100644 index 00000000..5e49928c --- /dev/null +++ b/install/ajax/get-migration-ajax.php @@ -0,0 +1,12 @@ + key($allMigrations))); \ No newline at end of file diff --git a/install/ajax/process-migration.php b/install/ajax/process-migration.php new file mode 100644 index 00000000..08c54fb3 --- /dev/null +++ b/install/ajax/process-migration.php @@ -0,0 +1,31 @@ +up($hesk_settings); +} elseif ($request['direction'] === 'down') { + $migration->down($hesk_settings); +} else { + output(array("message" => "Invalid direction provided"), 400); +} + +function output($data, $response = 200, $header = "Content-Type: application/json") { + http_response_code($response); + header($header); + print json_encode($data); +} \ No newline at end of file diff --git a/install/background.jpg b/install/background.jpg new file mode 100644 index 00000000..60401312 Binary files /dev/null and b/install/background.jpg differ diff --git a/install/database-validation.php b/install/database-validation.php new file mode 100644 index 00000000..4b2b14ef --- /dev/null +++ b/install/database-validation.php @@ -0,0 +1,290 @@ + + + + Mods For HESK Database Validation + + + + + + + + + + +
Mods for HESK Database Validation
+
+ + + +
+
+

Results

+
+ + + + + + + + + $('#all-good').show()"; + } else { + echo ""; + } + ?> + +
Database ChangeStatus
+
+
+ + + 0; + + output_result('Setting Exists: ' . $setting_name, $all_good); + + return $all_good !== false; +} + +function run_table_check($table_name) { + return run_column_check($table_name, '1'); +} + +function run_column_check($table_name, $column_name) { + global $hesk_settings; + + if ($column_name == '1') { + $all_good = run_check('SELECT ' . $column_name . ' FROM `' . $hesk_settings['db_pfix'] . $table_name . '` LIMIT 1'); + + output_result('Table Exists: ' . $table_name, + $all_good); + } else { + $all_good = run_check('SELECT `' . $column_name . '` FROM `' . $hesk_settings['db_pfix'] . $table_name . '` LIMIT 1'); + output_result('Column Exists: ' . $table_name . '.' . $column_name, + $all_good); + } + + return $all_good !== false; +} + +function run_check($sql) { + global $hesk_last_query; + global $hesk_db_link; + if (function_exists('mysqli_connect')) { + if (!$hesk_db_link && !hesk_dbConnect()) { + return false; + } + $hesk_last_query = $sql; + + return @mysqli_query($hesk_db_link, $sql); + } else { + if (!$hesk_db_link && !hesk_dbConnect()) { + return false; + } + $hesk_last_query = $sql; + + return $res = @mysql_query($sql, $hesk_db_link); + } +} + +function output_result($change_title, $success) { + $css_color = 'success'; + $text = ' Success'; + if (!$success) { + $css_color = 'danger'; + $text = ' Failure'; + } + + $formatted_text = sprintf('%s%s', $change_title, $css_color, $text); + + echo $formatted_text; +} + +function output_header_row($text) { + echo ' ' . $text . ''; +} \ No newline at end of file diff --git a/install/index.php b/install/index.php index 31b45f06..6ee2fc35 100644 --- a/install/index.php +++ b/install/index.php @@ -1,10 +1,204 @@ + 0) { + // They have installed at LEAST to version 1.6.0. Just pull the version number OR migration number + $migrationNumberSql = hesk_dbQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'migrationNumber'"); + if ($migrationRow = hesk_dbFetchAssoc($migrationNumberSql)) { + $startingMigrationNumber = intval($migrationRow['Value']) + 1; + } else { + $versionSql = hesk_dbQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'modsForHeskVersion'"); + $versionRow = hesk_dbFetchAssoc($versionSql); + + $migration_map = array( + // Pre-1.4.0 to 1.5.0 did not have a settings table + '1.6.0' => 22, '1.6.1' => 23, '1.7.0' => 27, '2.0.0' => 37, '2.0.1' => 38, '2.1.0' => 39, '2.1.1' => 42, + '2.2.0' => 47, '2.2.1' => 48, '2.3.0' => 68, '2.3.1' => 69, '2.3.2' => 70, '2.4.0' => 86, '2.4.1' => 87, + '2.4.2' => 88, '2.5.0' => 98, '2.5.1' => 99, '2.5.2' => 100, '2.5.3' => 101, '2.5.4' => 102, '2.5.5' => 103, + '2.6.0' => 121, '2.6.1' => 122, '2.6.2' => 125, '2.6.3' => 126, '2.6.4' => 127, '3.0.0' => 132, '3.0.1' => 133, + '3.0.2' => 135, '3.0.3' => 136, '3.0.4' => 137, '3.0.5' => 138, '3.0.6' => 139, '3.0.7' => 140, '3.1.0' => 153, + '3.1.1' => 154 + ); + $startingMigrationNumber = $migration_map[$versionRow['Value']]; + } +} else { + // migration # => sql for checking + $versionChecks = array( + // 1.5.0 -> users.active + 14 => "SHOW COLUMNS FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` LIKE 'active'", + // 1.4.1 -> denied_emails + 11 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails'", + // 1.4.0 -> denied ips + 9 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips'", + // Pre-1.4.0 but still something -> statuses + 7 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses'" + ); + + foreach ($versionChecks as $migrationNumber => $sql) { + $rs = hesk_dbQuery($sql); + if (hesk_dbNumRows($rs) > 0) { + $startingMigrationNumber = $migrationNumber; + break; + } + } +} + +$installMismatch = false; +if (HESK_NEW_VERSION != $hesk_settings['hesk_version']) { + $installMismatch = true; +} +?> - - Install | Redirecting... - - - - - + + Mods for HESK <?php echo MODS_FOR_HESK_NEW_VERSION; ?> Install / Upgrade + + + + + + + + + + + +
+
+ + +
+
+ + + + \ No newline at end of file diff --git a/install/install_functions.inc.php b/install/install_functions.inc.php index a498ab67..9606199e 100644 --- a/install/install_functions.inc.php +++ b/install/install_functions.inc.php @@ -16,7 +16,7 @@ if (!defined('IN_SCRIPT')) {die('Invalid attempt');} // We will be installing this HESK version: define('HESK_NEW_VERSION','2.7.3'); -define('MODS_FOR_HESK_NEW_VERSION','3.1.1'); +define('MODS_FOR_HESK_NEW_VERSION','3.2.0'); define('REQUIRE_PHP_VERSION','5.3.0'); define('REQUIRE_MYSQL_VERSION','5.0.7'); diff --git a/install/js/install-script.js b/install/js/install-script.js new file mode 100644 index 00000000..d7c94334 --- /dev/null +++ b/install/js/install-script.js @@ -0,0 +1,158 @@ +var steps = [ + { + name: 'intro', + text: 'Thanks for choosing Mods for HESK', + callback: undefined + }, + { + name: 'db-confirm', + text: 'Confirm the information below', + callback: undefined + }, + { + name: 'install-or-update', + text: 'Updating to the latest version...', + showBack: false, + showNext: false, + callback: installOrUpdate + }, + { + name: 'complete', + text: 'Installation / Upgrade Complete', + showBack: false, + callback: undefined + } +]; + +$(document).ready(function() { + var currentStep = 0; + + $('#next-button').click(function() { + goToStep(++currentStep); + }); + + $('#back-button').click(function() { + goToStep(--currentStep); + }); +}); + +function goToStep(step) { + $('[data-step]').hide(); + $('[data-step="' + steps[step].name + '"]').show(); + + if (step === 0) { + $('#tools-button').show(); + $('#back-button').hide(); + } else { + $('#tools-button').hide(); + $('#back-button').show(); + } + + if (step === steps.length - 1) { + $('#next-button').hide(); + } else { + $('#next-button').show(); + } + + // Back/Next button overrides + if (steps[step].showBack !== undefined && !steps[step].showBack) { + $('#back-button').hide(); + } + if (steps[step].showNext !== undefined && !steps[step].showNext) { + console.log('hiding this'); + $('#next-button').hide(); + } + + $('#header-text').text(steps[step].text); + + if (steps[step].callback !== undefined) { + steps[step].callback(); + } +} + +function installOrUpdate() { + var startingMigrationNumber = parseInt($('input[name="starting-migration-number"]').val()); + + var heskPath = $('p#hesk-path').text(); + + $.ajax({ + url: heskPath + 'install/ajax/get-migration-ajax.php', + method: 'GET', + success: function(data) { + data = JSON.parse(data); + + $('[data-step="install-or-update"] > #spinner').hide(); + $('[data-step="install-or-update"] > .progress').show(); + + // Recursive call that will increment by 1 each time + executeMigration(startingMigrationNumber, startingMigrationNumber, data.lastMigrationNumber, 'up'); + } + }) +} + +function executeMigration(startingMigrationNumber, migrationNumber, latestMigrationNumber, direction) { + var heskPath = $('p#hesk-path').text(); + + $.ajax({ + url: heskPath + 'install/ajax/process-migration.php', + method: 'POST', + data: JSON.stringify({ + migrationNumber: migrationNumber, + direction: direction + }), + success: function(data) { + console.log('migrationNumber: ' + migrationNumber); + console.log('latestMigrationNumber: ' + latestMigrationNumber); + console.info('---'); + if (migrationNumber === latestMigrationNumber || (migrationNumber === startingMigrationNumber && direction === 'down')) { + updateProgressBar(migrationNumber, latestMigrationNumber, direction === 'down', true); + console.log('%c Success! ', 'color: white; background-color: green; font-size: 2em'); + } else { + updateProgressBar(migrationNumber, latestMigrationNumber, false, false); + var newMigrationNumber = direction === 'up' ? migrationNumber + 1 : migrationNumber - 1; + executeMigration(startingMigrationNumber, newMigrationNumber, latestMigrationNumber, direction); + } + }, + error: function(response) { + try { + message = JSON.parse(response); + } catch (e) { + message = response.responseText; + } + $errorBlock = $('#error-block'); + $errorBlock.html($errorBlock.html() + "

An error occurred! (Error Code: " + migrationNumber + ")
" + message).show(); + + updateProgressBar(migrationNumber, latestMigrationNumber, true, false); + + if (direction === 'up') { + // Revert! + executeMigration(startingMigrationNumber, migrationNumber - 1, latestMigrationNumber, 'down'); + } else { + console.error("I even failed to roll back. Yikes! :'("); + } + console.error(message); + } + }) +} + +function updateProgressBar(migrationNumber, latestMigrationNumber, isError, isFinished) { + var $progressBar = $('#progress-bar'); + + if (isError === true) { + $progressBar.find('.progress-bar').removeClass('progress-bar-success') + .removeClass('active') + .addClass('progress-bar-danger'); + + if (isFinished) { + var $errorBlock = $('#error-block'); + $errorBlock.html($errorBlock.html() + '

Successfully reverted database to before the installation/update.'); + } + } else { + var percentage = Math.round(migrationNumber / latestMigrationNumber * 100); + $progressBar.find('.progress-bar').css('width', percentage + '%'); + } + + if (isFinished && !isError) { + goToStep(steps.length - 1); + } +} \ No newline at end of file diff --git a/install/js/migration-handler.js b/install/js/migration-handler.js new file mode 100644 index 00000000..ba3793c6 --- /dev/null +++ b/install/js/migration-handler.js @@ -0,0 +1,14 @@ +function executeMigration(migrationNumber, direction, success, error) { + var heskPath = $('p#hesk-path').text(); + + $.ajax({ + url: heskPath + 'install/ajax/process-migration.php', + method: 'POST', + data: JSON.stringify({ + migrationNumber: migrationNumber, + direction: direction + }), + success: success(data), + error: error(data) + }) +} \ No newline at end of file diff --git a/install/js/uninstall-script.js b/install/js/uninstall-script.js new file mode 100644 index 00000000..af0cad5c --- /dev/null +++ b/install/js/uninstall-script.js @@ -0,0 +1,151 @@ +var steps = [ + { + name: 'intro', + text: 'Uninstall', + callback: undefined + }, + { + name: 'db-confirm', + text: 'Confirm the information below', + callback: undefined + }, + { + name: 'uninstall', + text: 'Uninstalling...', + showBack: false, + showNext: false, + callback: uninstall + }, + { + name: 'complete', + text: 'Uninstall Process Complete', + showBack: false, + callback: undefined + } +]; + +$(document).ready(function() { + var currentStep = 0; + + $('#next-button').click(function() { + goToStep(++currentStep); + }); + + $('#back-button').click(function() { + goToStep(--currentStep); + }); +}); + +function goToStep(step) { + $('[data-step]').hide(); + $('[data-step="' + steps[step].name + '"]').show(); + + if (step === 0) { + $('#tools-button').show(); + $('#back-button').hide(); + } else { + $('#tools-button').hide(); + $('#back-button').show(); + } + + if (step === steps.length - 1) { + $('#next-button').hide(); + } else { + $('#next-button').show(); + } + + // Back/Next button overrides + if (steps[step].showBack !== undefined && !steps[step].showBack) { + $('#back-button').hide(); + } + if (steps[step].showNext !== undefined && !steps[step].showNext) { + console.log('hiding this'); + $('#next-button').hide(); + } + + $('#header-text').text(steps[step].text); + + if (steps[step].callback !== undefined) { + steps[step].callback(); + } +} + +function uninstall() { + var startingMigrationNumber = parseInt($('input[name="starting-migration-number"]').val()); + + var heskPath = $('p#hesk-path').text(); + + $.ajax({ + url: heskPath + 'install/ajax/get-migration-ajax.php', + method: 'GET', + success: function(data) { + data = JSON.parse(data); + + $('[data-step="uninstall"] > #spinner').hide(); + $('[data-step="uninstall"] > .progress').show(); + + // Recursive call that will increment by 1 each time + executeMigration(startingMigrationNumber, startingMigrationNumber, 1, 'down'); + } + }) +} + +function executeMigration(startingMigrationNumber, migrationNumber, latestMigrationNumber, direction) { + var heskPath = $('p#hesk-path').text(); + + $.ajax({ + url: heskPath + 'install/ajax/process-migration.php', + method: 'POST', + data: JSON.stringify({ + migrationNumber: migrationNumber, + direction: direction + }), + success: function(data) { + console.log('migrationNumber: ' + migrationNumber); + console.log('latestMigrationNumber: ' + latestMigrationNumber); + console.info('---'); + if (migrationNumber === latestMigrationNumber) { + updateProgressBar(startingMigrationNumber, migrationNumber, false, true); + console.log('%c Success! ', 'color: white; background-color: green; font-size: 2em'); + } else { + updateProgressBar(startingMigrationNumber, migrationNumber, false, false); + var newMigrationNumber = direction === 'up' ? migrationNumber + 1 : migrationNumber - 1; + executeMigration(startingMigrationNumber, newMigrationNumber, latestMigrationNumber, direction); + } + }, + error: function(response) { + try { + message = JSON.parse(response); + } catch (e) { + message = response.responseText; + } + $errorBlock = $('#error-block'); + $errorBlock.html($errorBlock.html() + "

An error occurred! (Error Code: " + migrationNumber + ")
" + message).show(); + + updateProgressBar(startingMigrationNumber, migrationNumber, true, false); + + console.error(message); + } + }) +} + +function updateProgressBar(startingMigrationNumber, migrationNumber, isError, isFinished) { + var $progressBar = $('#progress-bar'); + + if (isError === true) { + $progressBar.find('.progress-bar').removeClass('progress-bar-success') + .addClass('progress-bar-danger'); + + if (isFinished) { + var $errorBlock = $('#error-block'); + $errorBlock.html($errorBlock.html() + '

Successfully reverted database to before uninstalling.'); + } + } else { + var percentage = Math.round((startingMigrationNumber - migrationNumber) / startingMigrationNumber * 100); + $progressBar.find('.progress-bar').css('width', percentage + '%'); + } + + if (isFinished && !isError) { + goToStep(steps.length - 1); + } +} \ No newline at end of file diff --git a/install/logo.png b/install/logo.png new file mode 100644 index 00000000..5406b9ae Binary files /dev/null and b/install/logo.png differ diff --git a/install/migrations/AbstractMigration.php b/install/migrations/AbstractMigration.php new file mode 100644 index 00000000..ea650203 --- /dev/null +++ b/install/migrations/AbstractMigration.php @@ -0,0 +1,47 @@ +executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '{$version}' WHERE `Key` = 'modsForHeskVersion'"); + } +} \ No newline at end of file diff --git a/install/migrations/AbstractUpdatableMigration.php b/install/migrations/AbstractUpdatableMigration.php new file mode 100644 index 00000000..82dc6a3a --- /dev/null +++ b/install/migrations/AbstractUpdatableMigration.php @@ -0,0 +1,27 @@ +migrationNumber = $migrationNumber; + } + + function up($hesk_settings) { + $this->innerUp($hesk_settings); + + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '" . intval($this->migrationNumber) . "' + WHERE `Key` = 'migrationNumber'"); + } + + abstract function innerUp($hesk_settings); + + function down($hesk_settings) { + $this->innerDown($hesk_settings); + + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '" . (intval($this->migrationNumber) - 1) . "' + WHERE `Key` = 'migrationNumber'"); + } + + abstract function innerDown($hesk_settings); +} \ No newline at end of file diff --git a/install/migrations/LegacyUpdateMigration.php b/install/migrations/LegacyUpdateMigration.php new file mode 100644 index 00000000..ffbc9afb --- /dev/null +++ b/install/migrations/LegacyUpdateMigration.php @@ -0,0 +1,19 @@ +upVersion = $upVersion; + $this->downVersion = $downVersion; + } + + function up($hesk_settings) { + $this->updateVersion($this->upVersion, $hesk_settings); + } + + function down($hesk_settings) { + $this->updateVersion($this->downVersion, $hesk_settings); + } +} \ No newline at end of file diff --git a/install/migrations/Pre140/Statuses/AddIntColumnUpDropTableDown.php b/install/migrations/Pre140/Statuses/AddIntColumnUpDropTableDown.php new file mode 100644 index 00000000..b6bf841e --- /dev/null +++ b/install/migrations/Pre140/Statuses/AddIntColumnUpDropTableDown.php @@ -0,0 +1,16 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `status_int` INT NOT NULL DEFAULT 0 AFTER `status`;"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`"); + } +} \ No newline at end of file diff --git a/install/migrations/Pre140/Statuses/CreateStatusesTable.php b/install/migrations/Pre140/Statuses/CreateStatusesTable.php new file mode 100644 index 00000000..0d7dbef7 --- /dev/null +++ b/install/migrations/Pre140/Statuses/CreateStatusesTable.php @@ -0,0 +1,28 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ( + `ID` INT NOT NULL, + `ShortNameContentKey` TEXT NOT NULL, + `TicketViewContentKey` TEXT NOT NULL, + `TextColor` TEXT NOT NULL, + `IsNewTicketStatus` INT NOT NULL DEFAULT 0, + `IsClosed` INT NOT NULL DEFAULT 0, + `IsClosedByClient` INT NOT NULL DEFAULT 0, + `IsCustomerReplyStatus` INT NOT NULL DEFAULT 0, + `IsStaffClosedOption` INT NOT NULL DEFAULT 0, + `IsStaffReopenedStatus` INT NOT NULL DEFAULT 0, + `IsDefaultStaffReplyStatus` INT NOT NULL DEFAULT 0, + `LockedTicketStatus` INT NOT NULL DEFAULT 0, + PRIMARY KEY (`ID`))"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `status_int` INT NOT NULL AFTER `status`;"); + } +} \ No newline at end of file diff --git a/install/migrations/Pre140/Statuses/DropOldStatusColumn.php b/install/migrations/Pre140/Statuses/DropOldStatusColumn.php new file mode 100644 index 00000000..eb41f6b6 --- /dev/null +++ b/install/migrations/Pre140/Statuses/DropOldStatusColumn.php @@ -0,0 +1,21 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `status`"); + } + + function down($hesk_settings) { + $ticketsRS = $this->executeQuery("SELECT `id`, `status_int` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets`;"); + while ($currentResult = hesk_dbFetchAssoc($ticketsRS)) { + + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `status_int` = '" . intval($currentResult['status']) . "' WHERE `id` = " . $currentResult['id']); + } + } +} \ No newline at end of file diff --git a/install/migrations/Pre140/Statuses/InsertStatusRecords.php b/install/migrations/Pre140/Statuses/InsertStatusRecords.php new file mode 100644 index 00000000..37580121 --- /dev/null +++ b/install/migrations/Pre140/Statuses/InsertStatusRecords.php @@ -0,0 +1,33 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus, + IsStaffClosedOption, IsStaffReopenedStatus, IsDefaultStaffReplyStatus, LockedTicketStatus) + VALUES (0, 'open', 'open', '#FF0000', 1, 0, 0, 0, 0, 0, 0, 0);"); + + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus, + IsStaffClosedOption, IsStaffReopenedStatus, IsDefaultStaffReplyStatus, LockedTicketStatus) + VALUES (1, 'wait_reply', 'wait_staff_reply', '#FF9933', 0, 0, 0, 1, 0, 1, 0, 0);"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus, + IsStaffClosedOption, IsStaffReopenedStatus, IsDefaultStaffReplyStatus, LockedTicketStatus) + VALUES (2, 'replied', 'wait_cust_reply', '#0000FF', 0, 0, 0, 0, 0, 0, 1, 0);"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus, + IsStaffClosedOption, IsStaffReopenedStatus, IsDefaultStaffReplyStatus, LockedTicketStatus) + VALUES (3, 'resolved', 'resolved', '#008000', 0, 1, 1, 0, 1, 0, 0, 1);"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus, + IsStaffClosedOption, IsStaffReopenedStatus, IsDefaultStaffReplyStatus, LockedTicketStatus) + VALUES (4, 'in_progress', 'in_progress', '#000000', 0, 0, 0, 0, 0, 0, 0, 0);"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus, + IsStaffClosedOption, IsStaffReopenedStatus, IsDefaultStaffReplyStatus, LockedTicketStatus) + VALUES (5, 'on_hold', 'on_hold', '#000000', 0, 0, 0, 0, 0, 0, 0, 0);"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`"); + } +} \ No newline at end of file diff --git a/install/migrations/Pre140/Statuses/MoveStatusesToNewColumn.php b/install/migrations/Pre140/Statuses/MoveStatusesToNewColumn.php new file mode 100644 index 00000000..ce64aced --- /dev/null +++ b/install/migrations/Pre140/Statuses/MoveStatusesToNewColumn.php @@ -0,0 +1,20 @@ +executeQuery("SELECT `id`, `status` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets`;"); + while ($currentResult = hesk_dbFetchAssoc($ticketsRS)) { + + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `status_int` = " . $currentResult['status'] . " WHERE `id` = " . $currentResult['id']); + } + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` CHANGE COLUMN `status_int` `status` INT NOT NULL"); + } +} \ No newline at end of file diff --git a/install/migrations/Pre140/Statuses/RenameTempColumn.php b/install/migrations/Pre140/Statuses/RenameTempColumn.php new file mode 100644 index 00000000..d1eec50f --- /dev/null +++ b/install/migrations/Pre140/Statuses/RenameTempColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` CHANGE COLUMN `status_int` `status` INT NOT NULL"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `status`"); + } +} \ No newline at end of file diff --git a/install/migrations/UpdateMigration.php b/install/migrations/UpdateMigration.php new file mode 100644 index 00000000..2a585e69 --- /dev/null +++ b/install/migrations/UpdateMigration.php @@ -0,0 +1,21 @@ +upVersion = $upVersion; + $this->downVersion = $downVersion; + } + + function innerUp($hesk_settings) { + $this->updateVersion($this->upVersion, $hesk_settings); + } + + function innerDown($hesk_settings) { + $this->updateVersion($this->downVersion, $hesk_settings); + } +} \ No newline at end of file diff --git a/install/migrations/core.php b/install/migrations/core.php new file mode 100644 index 00000000..4ede382e --- /dev/null +++ b/install/migrations/core.php @@ -0,0 +1,217 @@ + "{$file} not found!", 500)); + } +}); + +function getAllMigrations() { + return array( + 1 => new \Pre140\Statuses\AddIntColumnUpDropTableDown(), + 2 => new \Pre140\Statuses\MoveStatusesToNewColumn(), + 3 => new \Pre140\Statuses\DropOldStatusColumn(), + 4 => new \Pre140\Statuses\RenameTempColumn(), + 5 => new \Pre140\Statuses\CreateStatusesTable(), + 6 => new \Pre140\Statuses\InsertStatusRecords(), + //1.4.0 + 7 => new \v140\AddAutorefreshColumn(), + 8 => new \v140\AddDeniedIpsTable(), + //1.4.1 + 9 => new \v141\AddDeniedEmailsTable(), + 10 => new \v141\AddTicketParentColumn(), + //1.5.0 + 11 => new \v150\AddActiveColumnToUser(), + 12 => new \v150\AddCanManSettingsPermissionToUser(), + 13 => new \v150\AddDefaultNotifyCustomerEmailPreference(), + //1.6.0 + 14 => new \v160\AddNotifyNoteUnassignedProperty(), + 15 => new \v160\AddCanChangeNotificationSettingsPermission(), + 16 => new \v160\AddEditInfoToNotes\AddEditDateColumn(), + 17 => new \v160\AddEditInfoToNotes\AddNumberOfEditsColumn(), + 18 => new \v160\AddNoteIdToAttachments(), + 19 => new \v160\ModifyTicketIdOnAttachments(), + 20 => new \v160\CreateSettingsTable(), + 21 => new \v160\InsertVersionRecord(), + //1.6.1 + 22 => new LegacyUpdateMigration('1.6.1', '1.6.0'), + //1.7.0 + 23 => new \v170\CreateVerifiedEmailsTable(), + 24 => new \v170\CreatePendingVerificationEmailsTable(), + 25 => new \v170\CreateStageTicketsTable(), + 26 => new LegacyUpdateMigration('1.7.0', '1.6.1'), + //2.0.0 + 27 => new \v200\RemoveNoteIdFromAttachments(), + 28 => new \v200\RemoveEditInfoFromNotes\DropEditDate(), + 29 => new \v200\RemoveEditInfoFromNotes\DropNumberOfEditsColumn(), + 30 => new \v200\RemoveDefaultNotifyCustomerEmailPreference(), + 31 => new \v200\AddMissingKeyToTickets(), + 32 => new \v200\MigrateIpAndEmailBans\InsertIpBans(), + 33 => new \v200\MigrateIpAndEmailBans\InsertEmailBans(), + 34 => new \v200\MigrateIpAndEmailBans\DropOldEmailBansTable(), + 35 => new \v200\MigrateIpAndEmailBans\DropOldIpBansTable(), + 36 => new LegacyUpdateMigration('2.0.0', '1.7.0'), + //2.0.1 + 37 => new LegacyUpdateMigration('2.0.1', '2.0.0'), + //2.1.0 + 38 => new LegacyUpdateMigration('2.1.0', '2.0.1'), + //2.1.1 + 39 => new \v211\FixStageTicketsTable\ChangeDtColumnType(), + 40 => new \v211\FixStageTicketsTable\FixStageTicketsTable(), + 41 => new LegacyUpdateMigration('2.1.1', '2.1.0'), + //2.2.0 + 42 => new \v220\AddIsAutocloseOptionToStatuses\AddNewColumn(), + 43 => new \v220\AddIsAutocloseOptionToStatuses\SetDefaultValue(), + 44 => new \v220\AddClosableColumnToStatuses\AddNewColumn(), + 45 => new \v220\AddClosableColumnToStatuses\SetDefaultValue(), + 46 => new LegacyUpdateMigration('2.2.0', '2.1.1'), + //2.2.1 + 47 => new LegacyUpdateMigration('2.2.1', '2.2.0'), + //2.3.0 + 48 => new \v230\AddIconToServiceMessages(), + 49 => new \v230\ConsolidateStatusColumns\AddKeyColumn(), + 50 => new \v230\ConsolidateStatusColumns\SetNewKeyColumnValue(), + 51 => new \v230\ConsolidateStatusColumns\DropShortNameColumn(), + 52 => new \v230\ConsolidateStatusColumns\DropTicketViewContentKeyColumn(), + 53 => new \v230\AddCoordinatesToTickets\AddLatitudeToTickets(), + 54 => new \v230\AddCoordinatesToTickets\AddLongitudeToTickets(), + 55 => new \v230\AddCoordinatesToTickets\AddLatitudeToStageTickets(), + 56 => new \v230\AddCoordinatesToTickets\AddLongitudeToStageTickets(), + 57 => new \v230\AddCategoryManager(), + 58 => new \v230\MovePermissionsToHeskPrivilegesColumn\CopyCanManSettings(), + 59 => new \v230\MovePermissionsToHeskPrivilegesColumn\CopyCanChangeNotificationSettings(), + 60 => new \v230\MovePermissionsToHeskPrivilegesColumn\DropCanManSettingsColumn(), + 61 => new \v230\MovePermissionsToHeskPrivilegesColumn\DropCanChangeNotificationSettingsColumn(), + 62 => new \v230\CreatePermissionTemplates\AddPermissionTemplateColumn(), + 63 => new \v230\CreatePermissionTemplates\CreatePermissionTemplatesTable(), + 64 => new \v230\CreatePermissionTemplates\InsertAdminPermissionTemplate(), + 65 => new \v230\CreatePermissionTemplates\InsertStaffPermissionTemplate(), + 66 => new \v230\CreatePermissionTemplates\UpdateAdminUsersTemplate(), + 67 => new LegacyUpdateMigration('2.3.0', '2.2.1'), + //2.3.1 + 68 => new LegacyUpdateMigration('2.3.1', '2.3.0'), + //2.3.2 + 69 => new LegacyUpdateMigration('2.3.2', '2.3.1'), + //2.4.0 + 70 => new \v240\CreateQuickHelpSections\CreateTable(), + 71 => new \v240\CreateQuickHelpSections\InsertCreateTicketRecord(), + 72 => new \v240\CreateQuickHelpSections\InsertKnowledgebaseRecord(), + 73 => new \v240\CreateQuickHelpSections\InsertStaffCreateTicketRecord(), + 74 => new \v240\CreateQuickHelpSections\InsertViewTicketFormRecord(), + 75 => new \v240\CreateQuickHelpSections\InsertViewTicketRecord(), + 76 => new \v240\CreateNewStatusNameTable\CreateTextToStatusXrefTable(), + 77 => new \v240\CreateNewStatusNameTable\AddSortColumnToStatuses(), + 78 => new \v240\CreateNewStatusNameTable\UpdateSortValues(), + 79 => new \v240\CreateNewStatusNameTable\InsertTextToStatusXrefValues(), + 80 => new \v240\AddDownloadCountToAttachments\AddToAttachmentsTable(), + 81 => new \v240\AddDownloadCountToAttachments\AddToKBAttachmentsTable(), + 82 => new \v240\AddHtmlColumnToTickets\UpdateTicketsTable(), + 83 => new \v240\AddHtmlColumnToTickets\UpdateStageTicketsTable(), + 84 => new \v240\AddHtmlColumnToTickets\UpdateRepliesTable(), + 85 => new LegacyUpdateMigration('2.4.0', '2.3.2'), + //2.4.1 + 86 => new LegacyUpdateMigration('2.4.1', '2.4.0'), + //2.4.2 + 87 => new LegacyUpdateMigration('2.4.2', '2.4.1'), + //2.5.0 + 88 => new \v250\MigrateSettingsToDatabase(), + 89 => new \v250\AddUserAgentAndScreenResToTickets\AddUserAgentToTickets(), + 90 => new \v250\AddUserAgentAndScreenResToTickets\AddUserAgentToStageTickets(), + 91 => new \v250\AddUserAgentAndScreenResToTickets\AddScreenResWidthToTickets(), + 92 => new \v250\AddUserAgentAndScreenResToTickets\AddScreenResHeightToTickets(), + 93 => new \v250\AddUserAgentAndScreenResToTickets\AddScreenResWidthToStageTickets(), + 94 => new \v250\AddUserAgentAndScreenResToTickets\AddScreenResHeightToStageTickets(), + 95 => new \v250\AddUserAgentAndScreenResToTickets\InsertSetting(), + 96 => new \v250\AddNavbarTitleUrl(), + 97 => new LegacyUpdateMigration('2.5.0', '2.4.2'), + //2.5.1 + 98 => new LegacyUpdateMigration('2.5.1', '2.5.0'), + //2.5.2 + 99 => new LegacyUpdateMigration('2.5.2', '2.5.1'), + //2.5.3 + 100 => new LegacyUpdateMigration('2.5.3', '2.5.2'), + //2.5.4 + 101 => new LegacyUpdateMigration('2.5.4', '2.5.3'), + //2.5.5 + 102 => new LegacyUpdateMigration('2.5.5', '2.5.4'), + //2.6.0 + 103 => new \v260\AddApiTables\CreateTable(), + 104 => new \v260\AddApiTables\InsertSetting(), + 105 => new \v260\AddLoggingTable(), + 106 => new \v260\AddTempAttachmentTable(), + 107 => new \v260\AddCalendarModule\CreateCalendarEventTable(), + 108 => new \v260\AddCalendarModule\CreateCalendarEventReminderTable(), + 109 => new \v260\AddCalendarModule\AddDueDateColumnToTickets(), + 110 => new \v260\AddCalendarModule\AddOverdueEmailSentColumnToTickets(), + 111 => new \v260\AddCalendarModule\AddColorColumnToCategories(), + 112 => new \v260\AddCalendarModule\AddUsageColumnToCategories(), + 113 => new \v260\AddCalendarModule\AddNotifyOverdueUnassignedColumnToUsers(), + 114 => new \v260\AddCalendarModule\AddDefaultCalendarViewToUsers(), + 115 => new \v260\AddCalendarModule\InsertEnableCalendarSetting(), + 116 => new \v260\AddCalendarModule\InsertFirstDayOfWeekSetting(), + 117 => new \v260\AddCalendarModule\InsertDefaultCalendarViewSetting(), + 118 => new \v260\AddPrimaryKeyToSettings(), + 119 => new \v260\ConvertStatusPropertiesToInts(), + 120 => new LegacyUpdateMigration('2.6.0', '2.5.5'), + //2.6.1 + 121 => new LegacyUpdateMigration('2.6.1', '2.6.0'), + //2.6.2 + 122 => new \v262\AddMissingColumnsToStageTickets\AddDueDateColumn(), + 123 => new \v262\AddMissingColumnsToStageTickets\AddOverdueEmailSentColumn(), + 124 => new LegacyUpdateMigration('2.6.2', '2.6.1'), + //2.6.3 + 125 => new LegacyUpdateMigration('2.6.3', '2.6.2'), + //2.6.4 + 126 => new LegacyUpdateMigration('2.6.4', '2.6.3'), + //3.0.0 + 127 => new \v300\MigrateHeskCustomStatuses(), + 128 => new \v300\MigrateAutorefreshOption\UpdateFromOldValue(), + 129 => new \v300\MigrateAutorefreshOption\DropOldColumn(), + 130 => new \v300\AddColorSchemeSetting(), + 131 => new LegacyUpdateMigration('3.0.0', '2.6.4'), + //3.0.1 + 132 => new LegacyUpdateMigration('3.0.1', '3.0.0'), + //3.0.2 + 133 => new \v302\AddMissingCustomFields(), + 134 => new LegacyUpdateMigration('3.0.2', '3.0.1'), + //3.0.3 - 3.0.7 + 135 => new LegacyUpdateMigration('3.0.3', '3.0.2'), + 136 => new LegacyUpdateMigration('3.0.4', '3.0.3'), + 137 => new LegacyUpdateMigration('3.0.5', '3.0.4'), + 138 => new LegacyUpdateMigration('3.0.6', '3.0.5'), + 139 => new LegacyUpdateMigration('3.0.7', '3.0.6'), + //3.1.0 + 140 => new \v310\AddStackTraceToLogs(), + 141 => new \v310\AddCustomNavElements\CreateCustomNavElementTable(), + 142 => new \v310\AddCustomNavElements\CreateCustomNavElementToTextTable(), + 143 => new \v310\AddMoreColorOptionsToCategories\AddForegroundColor(), + 144 => new \v310\AddMoreColorOptionsToCategories\AddDisplayBorderOutline(), + 145 => new \v310\AddMoreColorOptionsToCategories\AddBackgroundColor(), + 146 => new \v310\AddNewLoginSettings\AddLoginBackgroundType(), + 147 => new \v310\AddNewLoginSettings\AddLoginBackground(), + 148 => new \v310\AddNewLoginSettings\AddLoginBoxHeader(), + 149 => new \v310\AddNewLoginSettings\AddLoginBoxHeaderImage(), + 150 => new \v310\AddApiUrlRewriteSetting(), + 151 => new \v310\ConvertPresetToIndividualColors(), + 152 => new LegacyUpdateMigration('3.1.0', '3.0.7'), + //3.1.1 + 153 => new LegacyUpdateMigration('3.1.1', '3.1.0'), + //3.2.0 + 154 => new \v320\AddDescriptionToCategoriesAndCustomFields\AddDescriptionToCategories(), + 155 => new \v320\AddDescriptionToCategoriesAndCustomFields\AddDescriptionToCustomFields(), + 156 => new \v320\AddAuditTrail\CreateAuditTrailTable(), + 157 => new \v320\AddAuditTrail\CreateAuditTrailToReplacementValuesTable(), + 158 => new \v320\AddMigrationSetting(), + 159 => new UpdateMigration('3.2.0', '3.1.1', 159), + ); +} \ No newline at end of file diff --git a/install/migrations/v140/AddAutorefreshColumn.php b/install/migrations/v140/AddAutorefreshColumn.php new file mode 100644 index 00000000..19efc3cd --- /dev/null +++ b/install/migrations/v140/AddAutorefreshColumn.php @@ -0,0 +1,16 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `autorefresh` BIGINT NOT NULL DEFAULT 0 AFTER `replies`;"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `autorefresh`;"); + } +} \ No newline at end of file diff --git a/install/migrations/v140/AddDeniedIpsTable.php b/install/migrations/v140/AddDeniedIpsTable.php new file mode 100644 index 00000000..7d6f702e --- /dev/null +++ b/install/migrations/v140/AddDeniedIpsTable.php @@ -0,0 +1,17 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips` ( + `ID` INT NOT NULL PRIMARY KEY AUTO_INCREMENT, + `RangeStart` VARCHAR(100) NOT NULL, + `RangeEnd` VARCHAR(100) NOT NULL)"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips`"); + } +} \ No newline at end of file diff --git a/install/migrations/v141/AddDeniedEmailsTable.php b/install/migrations/v141/AddDeniedEmailsTable.php new file mode 100644 index 00000000..0f5d804c --- /dev/null +++ b/install/migrations/v141/AddDeniedEmailsTable.php @@ -0,0 +1,16 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails` ( + ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, + Email VARCHAR(100) NOT NULL);"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails`"); + } +} \ No newline at end of file diff --git a/install/migrations/v141/AddTicketParentColumn.php b/install/migrations/v141/AddTicketParentColumn.php new file mode 100644 index 00000000..91e0f422 --- /dev/null +++ b/install/migrations/v141/AddTicketParentColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `parent` MEDIUMINT(8) NULL AFTER `custom20`;"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `parent`"); + } +} \ No newline at end of file diff --git a/install/migrations/v150/AddActiveColumnToUser.php b/install/migrations/v150/AddActiveColumnToUser.php new file mode 100644 index 00000000..efad4777 --- /dev/null +++ b/install/migrations/v150/AddActiveColumnToUser.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `active` ENUM('0', '1') NOT NULL DEFAULT '1'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `active`"); + } +} \ No newline at end of file diff --git a/install/migrations/v150/AddCanManSettingsPermissionToUser.php b/install/migrations/v150/AddCanManSettingsPermissionToUser.php new file mode 100644 index 00000000..ca726a4c --- /dev/null +++ b/install/migrations/v150/AddCanManSettingsPermissionToUser.php @@ -0,0 +1,14 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `can_manage_settings` ENUM('0', '1') NOT NULL DEFAULT '1'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `can_manage_settings`"); + } +} \ No newline at end of file diff --git a/install/migrations/v150/AddDefaultNotifyCustomerEmailPreference.php b/install/migrations/v150/AddDefaultNotifyCustomerEmailPreference.php new file mode 100644 index 00000000..9bbcf5fe --- /dev/null +++ b/install/migrations/v150/AddDefaultNotifyCustomerEmailPreference.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `default_notify_customer_email` ENUM ('0', '1') NOT NULL DEFAULT '1'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `default_notify_customer_email`"); + } +} \ No newline at end of file diff --git a/install/migrations/v160/AddCanChangeNotificationSettingsPermission.php b/install/migrations/v160/AddCanChangeNotificationSettingsPermission.php new file mode 100644 index 00000000..32a30b4b --- /dev/null +++ b/install/migrations/v160/AddCanChangeNotificationSettingsPermission.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `can_change_notification_settings` ENUM('0', '1') NOT NULL DEFAULT '1'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `can_change_notification_settings`"); + } +} \ No newline at end of file diff --git a/install/migrations/v160/AddEditInfoToNotes/AddEditDateColumn.php b/install/migrations/v160/AddEditInfoToNotes/AddEditDateColumn.php new file mode 100644 index 00000000..d802396a --- /dev/null +++ b/install/migrations/v160/AddEditInfoToNotes/AddEditDateColumn.php @@ -0,0 +1,14 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` ADD COLUMN `edit_date` DATETIME NULL"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` DROP COLUMN `edit_date`"); + } +} \ No newline at end of file diff --git a/install/migrations/v160/AddEditInfoToNotes/AddNumberOfEditsColumn.php b/install/migrations/v160/AddEditInfoToNotes/AddNumberOfEditsColumn.php new file mode 100644 index 00000000..865670dd --- /dev/null +++ b/install/migrations/v160/AddEditInfoToNotes/AddNumberOfEditsColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` ADD COLUMN `number_of_edits` INT NOT NULL DEFAULT 0"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` DROP COLUMN `number_of_edits`"); + } +} \ No newline at end of file diff --git a/install/migrations/v160/AddNoteIdToAttachments.php b/install/migrations/v160/AddNoteIdToAttachments.php new file mode 100644 index 00000000..eb7fb080 --- /dev/null +++ b/install/migrations/v160/AddNoteIdToAttachments.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` ADD COLUMN `note_id` INT NULL AFTER `ticket_id`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` DROP COLUMN `note_id`"); + } +} \ No newline at end of file diff --git a/install/migrations/v160/AddNotifyNoteUnassignedProperty.php b/install/migrations/v160/AddNotifyNoteUnassignedProperty.php new file mode 100644 index 00000000..92f39262 --- /dev/null +++ b/install/migrations/v160/AddNotifyNoteUnassignedProperty.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `notify_note_unassigned` ENUM('0', '1') NOT NULL DEFAULT '0'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `notify_note_unassigned`"); + } +} \ No newline at end of file diff --git a/install/migrations/v160/CreateSettingsTable.php b/install/migrations/v160/CreateSettingsTable.php new file mode 100644 index 00000000..d7ee32c6 --- /dev/null +++ b/install/migrations/v160/CreateSettingsTable.php @@ -0,0 +1,15 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key` NVARCHAR(200) NOT NULL, `Value` NVARCHAR(200) NOT NULL)"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings`"); + } +} \ No newline at end of file diff --git a/install/migrations/v160/InsertVersionRecord.php b/install/migrations/v160/InsertVersionRecord.php new file mode 100644 index 00000000..c99b47d8 --- /dev/null +++ b/install/migrations/v160/InsertVersionRecord.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('modsForHeskVersion', '1.6.0')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'modsForHeskVersion'"); + } +} \ No newline at end of file diff --git a/install/migrations/v160/ModifyTicketIdOnAttachments.php b/install/migrations/v160/ModifyTicketIdOnAttachments.php new file mode 100644 index 00000000..65cf4f16 --- /dev/null +++ b/install/migrations/v160/ModifyTicketIdOnAttachments.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` MODIFY COLUMN `ticket_id` VARCHAR(13) NULL"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` MODIFY COLUMN `ticket_id` VARCHAR(13) NOT NULL DEFAULT ''"); + } +} \ No newline at end of file diff --git a/install/migrations/v170/CreatePendingVerificationEmailsTable.php b/install/migrations/v170/CreatePendingVerificationEmailsTable.php new file mode 100644 index 00000000..4b9af7b7 --- /dev/null +++ b/install/migrations/v170/CreatePendingVerificationEmailsTable.php @@ -0,0 +1,15 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "pending_verification_emails` (`Email` VARCHAR(255) NOT NULL, `ActivationKey` VARCHAR(500) NOT NULL)"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "pending_verification_emails`"); + } +} \ No newline at end of file diff --git a/install/migrations/v170/CreateStageTicketsTable.php b/install/migrations/v170/CreateStageTicketsTable.php new file mode 100644 index 00000000..17b62a26 --- /dev/null +++ b/install/migrations/v170/CreateStageTicketsTable.php @@ -0,0 +1,65 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `trackid` varchar(13) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `category` smallint(5) unsigned NOT NULL DEFAULT '1', + `priority` enum('0','1','2','3') COLLATE utf8_unicode_ci NOT NULL DEFAULT '3', + `subject` varchar(70) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `message` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `dt` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00', + `lastchange` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ip` varchar(46) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `language` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `status` int(11) NOT NULL DEFAULT '0', + `owner` smallint(5) unsigned NOT NULL DEFAULT '0', + `time_worked` time NOT NULL DEFAULT '00:00:00', + `lastreplier` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `replierid` smallint(5) unsigned DEFAULT NULL, + `archive` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `locked` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `attachments` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `merged` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `history` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom1` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom2` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom3` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom4` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom5` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom6` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom7` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom8` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom9` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom10` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom11` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom12` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom13` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom14` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom15` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom16` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom17` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom18` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom19` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `custom20` mediumtext COLLATE utf8_unicode_ci NOT NULL, + `parent` mediumint(8) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `trackid` (`trackid`), + KEY `archive` (`archive`), + KEY `categories` (`category`), + KEY `statuses` (`status`), + KEY `owner` (`owner`) + )"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets`"); + } +} \ No newline at end of file diff --git a/install/migrations/v170/CreateVerifiedEmailsTable.php b/install/migrations/v170/CreateVerifiedEmailsTable.php new file mode 100644 index 00000000..4f0e5a13 --- /dev/null +++ b/install/migrations/v170/CreateVerifiedEmailsTable.php @@ -0,0 +1,15 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "verified_emails` (`Email` VARCHAR(255) NOT NULL)"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "verified_emails`"); + } + +} \ No newline at end of file diff --git a/install/migrations/v200/AddMissingKeyToTickets.php b/install/migrations/v200/AddMissingKeyToTickets.php new file mode 100644 index 00000000..75c32d9a --- /dev/null +++ b/install/migrations/v200/AddMissingKeyToTickets.php @@ -0,0 +1,19 @@ +executeQuery("SHOW KEYS FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE Key_name='statuses'"); + if (hesk_dbNumRows($keyRs) == 0) { + //-- Add the key + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD KEY `statuses` (`status`)"); + } + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP INDEX `statuses`"); + } +} \ No newline at end of file diff --git a/install/migrations/v200/MigrateIpAndEmailBans/DropOldEmailBansTable.php b/install/migrations/v200/MigrateIpAndEmailBans/DropOldEmailBansTable.php new file mode 100644 index 00000000..b1b43be9 --- /dev/null +++ b/install/migrations/v200/MigrateIpAndEmailBans/DropOldEmailBansTable.php @@ -0,0 +1,17 @@ +executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails`"); + } + + function down($hesk_settings) { + $this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails` ( + ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, + Email VARCHAR(100) NOT NULL);"); + } +} \ No newline at end of file diff --git a/install/migrations/v200/MigrateIpAndEmailBans/DropOldIpBansTable.php b/install/migrations/v200/MigrateIpAndEmailBans/DropOldIpBansTable.php new file mode 100644 index 00000000..fa4b3ebf --- /dev/null +++ b/install/migrations/v200/MigrateIpAndEmailBans/DropOldIpBansTable.php @@ -0,0 +1,18 @@ +executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips`"); + } + + function down($hesk_settings) { + $this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips` ( + `ID` INT NOT NULL PRIMARY KEY AUTO_INCREMENT, + `RangeStart` VARCHAR(100) NOT NULL, + `RangeEnd` VARCHAR(100) NOT NULL)"); + } +} \ No newline at end of file diff --git a/install/migrations/v200/MigrateIpAndEmailBans/InsertEmailBans.php b/install/migrations/v200/MigrateIpAndEmailBans/InsertEmailBans.php new file mode 100644 index 00000000..e41840e7 --- /dev/null +++ b/install/migrations/v200/MigrateIpAndEmailBans/InsertEmailBans.php @@ -0,0 +1,21 @@ +executeQuery("SELECT `Email` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails`"); + while ($row = hesk_dbFetchAssoc($emailBanRS)) { + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "banned_emails` (`email`, `banned_by`, `dt`) + VALUES ('" . hesk_dbEscape($row['Email']) . "', 1, NOW())"); + } + } + + function down($hesk_settings) { + $emails = $this->executeQuery("SELECT `email` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "banned_emails`"); + while ($row = hesk_dbFetchAssoc($emails)) { + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails` (Email) VALUES ('" . hesk_dbEscape($row['email']) . "')"); + } + } +} \ No newline at end of file diff --git a/install/migrations/v200/MigrateIpAndEmailBans/InsertIpBans.php b/install/migrations/v200/MigrateIpAndEmailBans/InsertIpBans.php new file mode 100644 index 00000000..66d76b8c --- /dev/null +++ b/install/migrations/v200/MigrateIpAndEmailBans/InsertIpBans.php @@ -0,0 +1,25 @@ +executeQuery("SELECT `RangeStart`, `RangeEnd` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips`"); + while ($row = hesk_dbFetchAssoc($ipBanRS)) { + $ipFrom = long2ip($row['RangeStart']); + $ipTo = long2ip($row['RangeEnd']); + $ipDisplay = $ipFrom == $ipTo ? $ipFrom : $ipFrom . ' - ' . $ipTo; + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "banned_ips` (`ip_from`, `ip_to`, `ip_display`, `banned_by`, `dt`) + VALUES (" . $row['RangeStart'] . ", " . $row['RangeEnd'] . ", '" . $ipDisplay . "', 1, NOW())"); + } + } + + function down($hesk_settings) { + $ips = $this->executeQuery("SELECT `ip_from`, `ip_to` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "banned_ips`"); + while ($row = hesk_dbFetchAssoc($ips)) { + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips` (`RangeStart`, `RangeEnd`) VALUES (" . $row['ip_from'] . ", " . $row['ip_to'] . ")"); + } + } +} \ No newline at end of file diff --git a/install/migrations/v200/RemoveDefaultNotifyCustomerEmailPreference.php b/install/migrations/v200/RemoveDefaultNotifyCustomerEmailPreference.php new file mode 100644 index 00000000..93f42941 --- /dev/null +++ b/install/migrations/v200/RemoveDefaultNotifyCustomerEmailPreference.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `default_notify_customer_email`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `default_notify_customer_email` ENUM ('0', '1') NOT NULL DEFAULT '1'"); + } +} \ No newline at end of file diff --git a/install/migrations/v200/RemoveEditInfoFromNotes/DropEditDate.php b/install/migrations/v200/RemoveEditInfoFromNotes/DropEditDate.php new file mode 100644 index 00000000..6ceef94d --- /dev/null +++ b/install/migrations/v200/RemoveEditInfoFromNotes/DropEditDate.php @@ -0,0 +1,14 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` DROP COLUMN `edit_date`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` ADD COLUMN `edit_date` DATETIME NULL"); + } +} \ No newline at end of file diff --git a/install/migrations/v200/RemoveEditInfoFromNotes/DropNumberOfEditsColumn.php b/install/migrations/v200/RemoveEditInfoFromNotes/DropNumberOfEditsColumn.php new file mode 100644 index 00000000..198a5718 --- /dev/null +++ b/install/migrations/v200/RemoveEditInfoFromNotes/DropNumberOfEditsColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` DROP COLUMN `number_of_edits`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` ADD COLUMN `number_of_edits` INT NOT NULL DEFAULT 0"); + } +} \ No newline at end of file diff --git a/install/migrations/v200/RemoveNoteIdFromAttachments.php b/install/migrations/v200/RemoveNoteIdFromAttachments.php new file mode 100644 index 00000000..3c07a1c8 --- /dev/null +++ b/install/migrations/v200/RemoveNoteIdFromAttachments.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` DROP COLUMN `note_id`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` ADD COLUMN `note_id` INT NULL AFTER `ticket_id`"); + } +} \ No newline at end of file diff --git a/install/migrations/v211/FixStageTicketsTable/ChangeDtColumnType.php b/install/migrations/v211/FixStageTicketsTable/ChangeDtColumnType.php new file mode 100644 index 00000000..9f03915f --- /dev/null +++ b/install/migrations/v211/FixStageTicketsTable/ChangeDtColumnType.php @@ -0,0 +1,14 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` CHANGE `dt` `dt` TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00'"); + } + + function down($hesk_settings) { + // NOOP + } +} \ No newline at end of file diff --git a/install/migrations/v211/FixStageTicketsTable/FixStageTicketsTable.php b/install/migrations/v211/FixStageTicketsTable/FixStageTicketsTable.php new file mode 100644 index 00000000..e581c4eb --- /dev/null +++ b/install/migrations/v211/FixStageTicketsTable/FixStageTicketsTable.php @@ -0,0 +1,35 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` + CHANGE `email` `email` VARCHAR( 1000 ) NOT NULL DEFAULT '', + CHANGE `ip` `ip` VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + ADD `firstreply` TIMESTAMP NULL DEFAULT NULL AFTER `lastchange`, + ADD `closedat` TIMESTAMP NULL DEFAULT NULL AFTER `firstreply`, + ADD `articles` VARCHAR(255) NULL DEFAULT NULL AFTER `closedat`, + ADD `openedby` MEDIUMINT(8) DEFAULT '0' AFTER `status`, + ADD `firstreplyby` SMALLINT(5) UNSIGNED NULL DEFAULT NULL AFTER `openedby`, + ADD `closedby` MEDIUMINT(8) NULL DEFAULT NULL AFTER `firstreplyby`, + ADD `replies` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `closedby`, + ADD `staffreplies` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `replies`, + ADD INDEX ( `openedby` , `firstreplyby` , `closedby` ), + ADD INDEX(`dt`)"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` + CHANGE `email` `email` VARCHAR(255) NOT NULL DEFAULT '', + CHANGE `ip` `ip` VARCHAR(46) NOT NULL DEFAULT '', + DROP `firstreply`, + DROP `closedat`, + DROP `articles`, + DROP `firstreplyby`, + DROP `closedby`, + DROP `replies`, + DROP `staffreplies`"); + } +} \ No newline at end of file diff --git a/install/migrations/v220/AddClosableColumnToStatuses/AddNewColumn.php b/install/migrations/v220/AddClosableColumnToStatuses/AddNewColumn.php new file mode 100644 index 00000000..4fa70f90 --- /dev/null +++ b/install/migrations/v220/AddClosableColumnToStatuses/AddNewColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `Closable` VARCHAR(10) NOT NULL"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `Closable`"); + } +} \ No newline at end of file diff --git a/install/migrations/v220/AddClosableColumnToStatuses/SetDefaultValue.php b/install/migrations/v220/AddClosableColumnToStatuses/SetDefaultValue.php new file mode 100644 index 00000000..30cf5300 --- /dev/null +++ b/install/migrations/v220/AddClosableColumnToStatuses/SetDefaultValue.php @@ -0,0 +1,15 @@ +executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `Closable` = 'yes'"); + } + + function down($hesk_settings) { + // no-op + } +} \ No newline at end of file diff --git a/install/migrations/v220/AddIsAutocloseOptionToStatuses/AddNewColumn.php b/install/migrations/v220/AddIsAutocloseOptionToStatuses/AddNewColumn.php new file mode 100644 index 00000000..4a0ae9c3 --- /dev/null +++ b/install/migrations/v220/AddIsAutocloseOptionToStatuses/AddNewColumn.php @@ -0,0 +1,14 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `IsAutocloseOption` INT NOT NULL DEFAULT 0"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `IsAutocloseOption`"); + } +} \ No newline at end of file diff --git a/install/migrations/v220/AddIsAutocloseOptionToStatuses/SetDefaultValue.php b/install/migrations/v220/AddIsAutocloseOptionToStatuses/SetDefaultValue.php new file mode 100644 index 00000000..62389aac --- /dev/null +++ b/install/migrations/v220/AddIsAutocloseOptionToStatuses/SetDefaultValue.php @@ -0,0 +1,14 @@ +executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `IsAutocloseOption` = 1 WHERE `IsStaffClosedOption` = 1"); + } + + function down($hesk_settings) { + // no-op + } +} \ No newline at end of file diff --git a/install/migrations/v230/AddCategoryManager.php b/install/migrations/v230/AddCategoryManager.php new file mode 100644 index 00000000..a0b3daa8 --- /dev/null +++ b/install/migrations/v230/AddCategoryManager.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `manager` INT NOT NULL DEFAULT 0"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `manager`"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/AddCoordinatesToTickets/AddLatitudeToStageTickets.php b/install/migrations/v230/AddCoordinatesToTickets/AddLatitudeToStageTickets.php new file mode 100644 index 00000000..5f5ae562 --- /dev/null +++ b/install/migrations/v230/AddCoordinatesToTickets/AddLatitudeToStageTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `latitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `latitude`"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/AddCoordinatesToTickets/AddLatitudeToTickets.php b/install/migrations/v230/AddCoordinatesToTickets/AddLatitudeToTickets.php new file mode 100644 index 00000000..62c17e03 --- /dev/null +++ b/install/migrations/v230/AddCoordinatesToTickets/AddLatitudeToTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `latitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `latitude`"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/AddCoordinatesToTickets/AddLongitudeToStageTickets.php b/install/migrations/v230/AddCoordinatesToTickets/AddLongitudeToStageTickets.php new file mode 100644 index 00000000..e89c1b5b --- /dev/null +++ b/install/migrations/v230/AddCoordinatesToTickets/AddLongitudeToStageTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `longitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `longitude`"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/AddCoordinatesToTickets/AddLongitudeToTickets.php b/install/migrations/v230/AddCoordinatesToTickets/AddLongitudeToTickets.php new file mode 100644 index 00000000..7ccd743f --- /dev/null +++ b/install/migrations/v230/AddCoordinatesToTickets/AddLongitudeToTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `longitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `longitude`"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/AddIconToServiceMessages.php b/install/migrations/v230/AddIconToServiceMessages.php new file mode 100644 index 00000000..c7fad46e --- /dev/null +++ b/install/migrations/v230/AddIconToServiceMessages.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` ADD COLUMN `icon` VARCHAR(150)"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` DROP COLUMN `icon`"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/ConsolidateStatusColumns/AddKeyColumn.php b/install/migrations/v230/ConsolidateStatusColumns/AddKeyColumn.php new file mode 100644 index 00000000..5d264114 --- /dev/null +++ b/install/migrations/v230/ConsolidateStatusColumns/AddKeyColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `Key` TEXT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `Key`"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/ConsolidateStatusColumns/DropShortNameColumn.php b/install/migrations/v230/ConsolidateStatusColumns/DropShortNameColumn.php new file mode 100644 index 00000000..40fb00c2 --- /dev/null +++ b/install/migrations/v230/ConsolidateStatusColumns/DropShortNameColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `ShortNameContentKey`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `ShortNameContentKey` TEXT"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/ConsolidateStatusColumns/DropTicketViewContentKeyColumn.php b/install/migrations/v230/ConsolidateStatusColumns/DropTicketViewContentKeyColumn.php new file mode 100644 index 00000000..85353c04 --- /dev/null +++ b/install/migrations/v230/ConsolidateStatusColumns/DropTicketViewContentKeyColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `TicketViewContentKey`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `TicketViewContentKey` TEXT"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/ConsolidateStatusColumns/SetNewKeyColumnValue.php b/install/migrations/v230/ConsolidateStatusColumns/SetNewKeyColumnValue.php new file mode 100644 index 00000000..8c69d486 --- /dev/null +++ b/install/migrations/v230/ConsolidateStatusColumns/SetNewKeyColumnValue.php @@ -0,0 +1,15 @@ +executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `Key` = `ShortNameContentKey`"); + } + + function down($hesk_settings) { + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `TicketViewContentKey` = `Key`, `ShortNameContentKey` = `Key`"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/CreatePermissionTemplates/AddPermissionTemplateColumn.php b/install/migrations/v230/CreatePermissionTemplates/AddPermissionTemplateColumn.php new file mode 100644 index 00000000..4463e88f --- /dev/null +++ b/install/migrations/v230/CreatePermissionTemplates/AddPermissionTemplateColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `permission_template` INT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `permission_template`"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/CreatePermissionTemplates/CreatePermissionTemplatesTable.php b/install/migrations/v230/CreatePermissionTemplates/CreatePermissionTemplatesTable.php new file mode 100644 index 00000000..e8b19aed --- /dev/null +++ b/install/migrations/v230/CreatePermissionTemplates/CreatePermissionTemplatesTable.php @@ -0,0 +1,18 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `name` VARCHAR(255) NOT NULL, + `heskprivileges` VARCHAR(1000), + `categories` VARCHAR(500))"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates`"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/CreatePermissionTemplates/InsertAdminPermissionTemplate.php b/install/migrations/v230/CreatePermissionTemplates/InsertAdminPermissionTemplate.php new file mode 100644 index 00000000..39a563c9 --- /dev/null +++ b/install/migrations/v230/CreatePermissionTemplates/InsertAdminPermissionTemplate.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates` (`name`, `heskprivileges`, `categories`) + VALUES ('Administrator', 'ALL', 'ALL')"); + } + + function down($hesk_settings) { + } +} \ No newline at end of file diff --git a/install/migrations/v230/CreatePermissionTemplates/InsertStaffPermissionTemplate.php b/install/migrations/v230/CreatePermissionTemplates/InsertStaffPermissionTemplate.php new file mode 100644 index 00000000..031ea394 --- /dev/null +++ b/install/migrations/v230/CreatePermissionTemplates/InsertStaffPermissionTemplate.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates` (`name`, `heskprivileges`, `categories`) + VALUES ('Staff', 'can_view_tickets,can_reply_tickets,can_change_cat,can_assign_self,can_view_unassigned,can_view_online', '1')"); + } + + function down($hesk_settings) { + } +} \ No newline at end of file diff --git a/install/migrations/v230/CreatePermissionTemplates/UpdateAdminUsersTemplate.php b/install/migrations/v230/CreatePermissionTemplates/UpdateAdminUsersTemplate.php new file mode 100644 index 00000000..60743f3e --- /dev/null +++ b/install/migrations/v230/CreatePermissionTemplates/UpdateAdminUsersTemplate.php @@ -0,0 +1,14 @@ +executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `permission_template` = 1 WHERE `isadmin` = '1'"); + } + + function down($hesk_settings) { + } +} \ No newline at end of file diff --git a/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/CopyCanChangeNotificationSettings.php b/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/CopyCanChangeNotificationSettings.php new file mode 100644 index 00000000..a98dbac2 --- /dev/null +++ b/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/CopyCanChangeNotificationSettings.php @@ -0,0 +1,30 @@ +executeQuery("SELECT `id`, `heskprivileges` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `isadmin` = '0' + AND `can_change_notification_settings` = '1'"); + while ($row = hesk_dbFetchAssoc($res)) { + if ($row['heskprivileges'] != '') { + $currentPrivileges = explode(',', $row['heskprivileges']); + array_push($currentPrivileges, 'can_change_notification_settings'); + $newPrivileges = implode(',', $currentPrivileges); + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = '" . hesk_dbEscape($newPrivileges) . "' + WHERE `id` = " . intval($row['id'])); + } else { + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = 'can_change_notification_settings' + WHERE `id` = " . intval($row['id'])); + } + } + } + + function down($hesk_settings) { + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` + SET `can_change_notification_settings` = '0' + WHERE `heskprivileges` NOT LIKE '%can_change_notification_settings%'"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/CopyCanManSettings.php b/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/CopyCanManSettings.php new file mode 100644 index 00000000..a1c81052 --- /dev/null +++ b/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/CopyCanManSettings.php @@ -0,0 +1,31 @@ +executeQuery("SELECT `id`, `heskprivileges` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `isadmin` = '0' + AND `can_manage_settings` = '1'"); + while ($row = hesk_dbFetchAssoc($res)) { + if ($row['heskprivileges'] != '') { + $currentPrivileges = explode(',', $row['heskprivileges']); + array_push($currentPrivileges, 'can_man_settings'); + $newPrivileges = implode(',', $currentPrivileges); + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = '" . hesk_dbEscape($newPrivileges) . "' + WHERE `id` = " . intval($row['id'])); + } else { + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = 'can_man_settings' + WHERE `id` = " . intval($row['id'])); + } + } + } + + function down($hesk_settings) { + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` + SET `can_manage_settings` = '0' + WHERE `heskprivileges` NOT LIKE '%can_man_settings%'"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/DropCanChangeNotificationSettingsColumn.php b/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/DropCanChangeNotificationSettingsColumn.php new file mode 100644 index 00000000..882a7f5c --- /dev/null +++ b/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/DropCanChangeNotificationSettingsColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `can_change_notification_settings`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `can_change_notification_settings` ENUM('0', '1') NOT NULL DEFAULT '1'"); + } +} \ No newline at end of file diff --git a/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/DropCanManSettingsColumn.php b/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/DropCanManSettingsColumn.php new file mode 100644 index 00000000..d2d26771 --- /dev/null +++ b/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn/DropCanManSettingsColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `can_manage_settings`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `can_manage_settings` ENUM ('0', '1') NOT NULL DEFAULT '1'"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/AddDownloadCountToAttachments/AddToAttachmentsTable.php b/install/migrations/v240/AddDownloadCountToAttachments/AddToAttachmentsTable.php new file mode 100644 index 00000000..62fdf930 --- /dev/null +++ b/install/migrations/v240/AddDownloadCountToAttachments/AddToAttachmentsTable.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` ADD COLUMN `download_count` INT NOT NULL DEFAULT 0"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` DROP COLUMN `download_count`"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/AddDownloadCountToAttachments/AddToKBAttachmentsTable.php b/install/migrations/v240/AddDownloadCountToAttachments/AddToKBAttachmentsTable.php new file mode 100644 index 00000000..1fa9336e --- /dev/null +++ b/install/migrations/v240/AddDownloadCountToAttachments/AddToKBAttachmentsTable.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_attachments` ADD COLUMN `download_count` INT NOT NULL DEFAULT 0"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_attachments` DROP COLUMN `download_count`"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/AddHtmlColumnToTickets/UpdateRepliesTable.php b/install/migrations/v240/AddHtmlColumnToTickets/UpdateRepliesTable.php new file mode 100644 index 00000000..f9979951 --- /dev/null +++ b/install/migrations/v240/AddHtmlColumnToTickets/UpdateRepliesTable.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` ADD COLUMN `html` ENUM('0','1') NOT NULL DEFAULT '0'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` DROP COLUMN `html`"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/AddHtmlColumnToTickets/UpdateStageTicketsTable.php b/install/migrations/v240/AddHtmlColumnToTickets/UpdateStageTicketsTable.php new file mode 100644 index 00000000..7dc434eb --- /dev/null +++ b/install/migrations/v240/AddHtmlColumnToTickets/UpdateStageTicketsTable.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `html` ENUM('0','1') NOT NULL DEFAULT '0'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `html`"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/AddHtmlColumnToTickets/UpdateTicketsTable.php b/install/migrations/v240/AddHtmlColumnToTickets/UpdateTicketsTable.php new file mode 100644 index 00000000..29111331 --- /dev/null +++ b/install/migrations/v240/AddHtmlColumnToTickets/UpdateTicketsTable.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `html` ENUM('0','1') NOT NULL DEFAULT '0'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `html`"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/CreateNewStatusNameTable/AddSortColumnToStatuses.php b/install/migrations/v240/CreateNewStatusNameTable/AddSortColumnToStatuses.php new file mode 100644 index 00000000..47aa7554 --- /dev/null +++ b/install/migrations/v240/CreateNewStatusNameTable/AddSortColumnToStatuses.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `sort` INT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `sort`"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/CreateNewStatusNameTable/CreateTextToStatusXrefTable.php b/install/migrations/v240/CreateNewStatusNameTable/CreateTextToStatusXrefTable.php new file mode 100644 index 00000000..b9ad5bec --- /dev/null +++ b/install/migrations/v240/CreateNewStatusNameTable/CreateTextToStatusXrefTable.php @@ -0,0 +1,19 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `language` VARCHAR(200) NOT NULL, + `text` VARCHAR(200) NOT NULL, + `status_id` INT NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref`"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/CreateNewStatusNameTable/InsertTextToStatusXrefValues.php b/install/migrations/v240/CreateNewStatusNameTable/InsertTextToStatusXrefValues.php new file mode 100644 index 00000000..b2ef866d --- /dev/null +++ b/install/migrations/v240/CreateNewStatusNameTable/InsertTextToStatusXrefValues.php @@ -0,0 +1,34 @@ + $value) { + $languages[$key] = $hesk_settings['languages'][$key]['folder']; + } + + $statusesRs = $this->executeQuery("SELECT `ID`, `Key` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`"); + $oldSetting = $hesk_settings['can_sel_lang']; + $hesk_settings['can_sel_lang'] = 1; + while ($row = hesk_dbFetchAssoc($statusesRs)) { + foreach ($languages as $language => $languageCode) { + hesk_setLanguage($language); + $sql = "INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref` (`language`, `text`, `status_id`) + VALUES ('" . hesk_dbEscape($language) . "', '" . hesk_dbEscape($hesklang[$row['Key']]) . "', " . intval($row['ID']) . ")"; + $this->executeQuery($sql); + } + } + $hesk_settings['can_sel_lang'] = $oldSetting; + hesk_resetLanguage(); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref`"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/CreateNewStatusNameTable/UpdateSortValues.php b/install/migrations/v240/CreateNewStatusNameTable/UpdateSortValues.php new file mode 100644 index 00000000..7601d70e --- /dev/null +++ b/install/migrations/v240/CreateNewStatusNameTable/UpdateSortValues.php @@ -0,0 +1,20 @@ +executeQuery("SELECT `ID` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ORDER BY `ID` ASC"); + $i = 10; + while ($myStatus = hesk_dbFetchAssoc($statusesRs)) { + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `sort`=" . intval($i) . " + WHERE `id`='" . intval($myStatus['ID']) . "' LIMIT 1"); + $i += 10; + } + } + + function down($hesk_settings) { + } +} \ No newline at end of file diff --git a/install/migrations/v240/CreateQuickHelpSections/CreateTable.php b/install/migrations/v240/CreateQuickHelpSections/CreateTable.php new file mode 100644 index 00000000..1b55a786 --- /dev/null +++ b/install/migrations/v240/CreateQuickHelpSections/CreateTable.php @@ -0,0 +1,30 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `location` VARCHAR(100) NOT NULL, + `show` ENUM('0','1') NOT NULL + ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); + + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`) + VALUES ('create_ticket', '1')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`) + VALUES ('view_ticket_form', '1')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`) + VALUES ('view_ticket', '1')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`) + VALUES ('knowledgebase', '1')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`) + VALUES ('staff_create_ticket', '1')"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections`"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/CreateQuickHelpSections/InsertCreateTicketRecord.php b/install/migrations/v240/CreateQuickHelpSections/InsertCreateTicketRecord.php new file mode 100644 index 00000000..1c2398bf --- /dev/null +++ b/install/migrations/v240/CreateQuickHelpSections/InsertCreateTicketRecord.php @@ -0,0 +1,17 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`) + VALUES ('create_ticket', '1')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` + WHERE `location` = 'create_ticket'"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/CreateQuickHelpSections/InsertKnowledgebaseRecord.php b/install/migrations/v240/CreateQuickHelpSections/InsertKnowledgebaseRecord.php new file mode 100644 index 00000000..eaa58459 --- /dev/null +++ b/install/migrations/v240/CreateQuickHelpSections/InsertKnowledgebaseRecord.php @@ -0,0 +1,17 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`) + VALUES ('knowledgebase', '1')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` + WHERE `location` = 'knowledgebase'"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/CreateQuickHelpSections/InsertStaffCreateTicketRecord.php b/install/migrations/v240/CreateQuickHelpSections/InsertStaffCreateTicketRecord.php new file mode 100644 index 00000000..475a6d1f --- /dev/null +++ b/install/migrations/v240/CreateQuickHelpSections/InsertStaffCreateTicketRecord.php @@ -0,0 +1,17 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`) + VALUES ('staff_create_ticket', '1')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` + WHERE `location` = 'staff_create_ticket'"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/CreateQuickHelpSections/InsertViewTicketFormRecord.php b/install/migrations/v240/CreateQuickHelpSections/InsertViewTicketFormRecord.php new file mode 100644 index 00000000..62dcd45e --- /dev/null +++ b/install/migrations/v240/CreateQuickHelpSections/InsertViewTicketFormRecord.php @@ -0,0 +1,17 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`) + VALUES ('view_ticket_form', '1')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` + WHERE `location` = 'view_ticket_form'"); + } +} \ No newline at end of file diff --git a/install/migrations/v240/CreateQuickHelpSections/InsertViewTicketRecord.php b/install/migrations/v240/CreateQuickHelpSections/InsertViewTicketRecord.php new file mode 100644 index 00000000..7c3b3cdb --- /dev/null +++ b/install/migrations/v240/CreateQuickHelpSections/InsertViewTicketRecord.php @@ -0,0 +1,17 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`) + VALUES ('view_ticket', '1')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` + WHERE `location` = 'view_ticket'"); + } +} \ No newline at end of file diff --git a/install/migrations/v250/AddNavbarTitleUrl.php b/install/migrations/v250/AddNavbarTitleUrl.php new file mode 100644 index 00000000..e117e135 --- /dev/null +++ b/install/migrations/v250/AddNavbarTitleUrl.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('navbar_title_url', '" . hesk_dbEscape($hesk_settings['hesk_url']) . "')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'navbar_title_url'"); + } +} \ No newline at end of file diff --git a/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResHeightToStageTickets.php b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResHeightToStageTickets.php new file mode 100644 index 00000000..26ffb307 --- /dev/null +++ b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResHeightToStageTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `screen_resolution_height` INT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `screen_resolution_height`"); + } +} \ No newline at end of file diff --git a/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResHeightToTickets.php b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResHeightToTickets.php new file mode 100644 index 00000000..39ca596e --- /dev/null +++ b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResHeightToTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `screen_resolution_height` INT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `screen_resolution_height`"); + } +} \ No newline at end of file diff --git a/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResWidthToStageTickets.php b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResWidthToStageTickets.php new file mode 100644 index 00000000..da2b0255 --- /dev/null +++ b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResWidthToStageTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `screen_resolution_width` INT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `screen_resolution_width`"); + } +} \ No newline at end of file diff --git a/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResWidthToTickets.php b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResWidthToTickets.php new file mode 100644 index 00000000..d9763b8a --- /dev/null +++ b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddScreenResWidthToTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `screen_resolution_width` INT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `screen_resolution_width`"); + } +} \ No newline at end of file diff --git a/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddUserAgentToStageTickets.php b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddUserAgentToStageTickets.php new file mode 100644 index 00000000..7d48cbc6 --- /dev/null +++ b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddUserAgentToStageTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `user_agent` TEXT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `user_agent`"); + } +} \ No newline at end of file diff --git a/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddUserAgentToTickets.php b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddUserAgentToTickets.php new file mode 100644 index 00000000..9ab96b0c --- /dev/null +++ b/install/migrations/v250/AddUserAgentAndScreenResToTickets/AddUserAgentToTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `user_agent` TEXT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `user_agent`"); + } +} \ No newline at end of file diff --git a/install/migrations/v250/AddUserAgentAndScreenResToTickets/InsertSetting.php b/install/migrations/v250/AddUserAgentAndScreenResToTickets/InsertSetting.php new file mode 100644 index 00000000..6810fe06 --- /dev/null +++ b/install/migrations/v250/AddUserAgentAndScreenResToTickets/InsertSetting.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('display_user_agent_information', '0')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'display_user_agent_information'"); + } +} \ No newline at end of file diff --git a/install/migrations/v250/MigrateSettingsToDatabase.php b/install/migrations/v250/MigrateSettingsToDatabase.php new file mode 100644 index 00000000..38c0a553 --- /dev/null +++ b/install/migrations/v250/MigrateSettingsToDatabase.php @@ -0,0 +1,122 @@ +getSettingValue($modsForHesk_settings, 'rtl', 0); + $show_icons = $this->getSettingValue($modsForHesk_settings, 'show_icons', 0); + $custom_field_setting = $this->getSettingValue($modsForHesk_settings, 'custom_field_setting', 0); + $customer_email_verification_required = $this->getSettingValue($modsForHesk_settings, 'customer_email_verification_required', 0); + $html_emails = $this->getSettingValue($modsForHesk_settings, 'html_emails', 1); + $use_mailgun = $this->getSettingValue($modsForHesk_settings, 'use_mailgun', 0); + $mailgun_api_key = $this->getSettingValue($modsForHesk_settings, 'mailgun_api_key', ''); + $mailgun_domain = $this->getSettingValue($modsForHesk_settings, 'mailgun_domain', ''); + $use_bootstrap_theme = $this->getSettingValue($modsForHesk_settings, 'use_bootstrap_theme', 1); + $new_kb_article_visibility = $this->getSettingValue($modsForHesk_settings, 'new_kb_article_visibility', 0); + $attachments = $this->getSettingValue($modsForHesk_settings, 'attachments', 0); + $show_number_merged = $this->getSettingValue($modsForHesk_settings, 'show_number_merged', 1); + $request_location = $this->getSettingValue($modsForHesk_settings, 'request_location', 0); + $category_order_column = $this->getSettingValue($modsForHesk_settings, 'category_order_column', 'cat_order'); + $rich_text_for_tickets = $this->getSettingValue($modsForHesk_settings, 'rich_text_for_tickets', 0); + $statuses_order_column = $this->getSettingValue($modsForHesk_settings, 'statuses_order_column', 'sort'); + $kb_attach_dir = $this->getSettingValue($modsForHesk_settings, 'kb_attach_dir', 'attachments'); + $rich_text_for_tickets_for_customers = $this->getSettingValue($modsForHesk_settings, 'rich_text_for_tickets_for_customers', 0); + + $navbar_background_color = $this->getSettingValue($modsForHesk_settings, 'navbarBackgroundColor', '#414a5c'); + $navbar_brand_color = $this->getSettingValue($modsForHesk_settings, 'navbarBrandColor', '#d4dee7'); + $navbar_brand_hover_color = $this->getSettingValue($modsForHesk_settings, 'navbarBrandHoverColor', '#ffffff'); + $navbar_item_text_color = $this->getSettingValue($modsForHesk_settings, 'navbarItemTextColor', '#d4dee7'); + $navbar_item_text_hover_color = $this->getSettingValue($modsForHesk_settings, 'navbarItemTextHoverColor', '#ffffff'); + $navbar_item_text_selected_color = $this->getSettingValue($modsForHesk_settings, 'navbarItemTextSelectedColor', '#ffffff'); + $navbar_item_selected_background_color = $this->getSettingValue($modsForHesk_settings, 'navbarItemSelectedBackgroundColor', '#2d3646'); + $dropdown_item_text_color = $this->getSettingValue($modsForHesk_settings, 'dropdownItemTextColor', '#333333'); + $dropdown_item_text_hover_color = $this->getSettingValue($modsForHesk_settings, 'dropdownItemTextHoverColor', '#262626'); + $dropdown_item_text_hover_background_color = $this->getSettingValue($modsForHesk_settings, 'dropdownItemTextHoverBackgroundColor', '#f5f5f5'); + $question_mark_color = $this->getSettingValue($modsForHesk_settings, 'questionMarkColor', '#000000'); + + + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('rtl', " . intval($rtl) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('show_icons', " . intval($show_icons) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('custom_field_setting', " . intval($custom_field_setting) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('customer_email_verification_required', " . intval($customer_email_verification_required) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('html_emails', " . intval($html_emails) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('use_mailgun', " . intval($use_mailgun) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('mailgun_api_key', '" . hesk_dbEscape($mailgun_api_key) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('mailgun_domain', '" . hesk_dbEscape($mailgun_domain) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('use_bootstrap_theme', " . intval($use_bootstrap_theme) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('new_kb_article_visibility', " . intval($new_kb_article_visibility) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('attachments', " . intval($attachments) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('show_number_merged', " . intval($show_number_merged) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('request_location', " . intval($request_location) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('category_order_column', '" . hesk_dbEscape($category_order_column) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('rich_text_for_tickets', " . intval($rich_text_for_tickets) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('statuses_order_column', '" . hesk_dbEscape($statuses_order_column) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('kb_attach_dir', '" . hesk_dbEscape($kb_attach_dir) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('rich_text_for_tickets_for_customers', " . intval($rich_text_for_tickets_for_customers) . ")"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('navbarBackgroundColor', '" . hesk_dbEscape($navbar_background_color) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('navbarBrandColor', '" . hesk_dbEscape($navbar_brand_color) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('navbarBrandHoverColor', '" . hesk_dbEscape($navbar_brand_hover_color) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('navbarItemTextColor', '" . hesk_dbEscape($navbar_item_text_color) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('navbarItemTextHoverColor', '" . hesk_dbEscape($navbar_item_text_hover_color) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('navbarItemTextSelectedColor', '" . hesk_dbEscape($navbar_item_text_selected_color) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('navbarItemSelectedBackgroundColor', '" . hesk_dbEscape($navbar_item_selected_background_color) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('dropdownItemTextColor', '" . hesk_dbEscape($dropdown_item_text_color) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('dropdownItemTextHoverColor', '" . hesk_dbEscape($dropdown_item_text_hover_color) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('dropdownItemTextHoverBackgroundColor', '" . hesk_dbEscape($dropdown_item_text_hover_background_color) . "')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('questionMarkColor', '" . hesk_dbEscape($question_mark_color) . "')"); + } + + + + function getSettingValue($settings, $setting, $default) { + return isset($settings[$setting]) ? $settings[$setting] : $default; + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` + WHERE `Key` IN ('rtl', 'show_icons', 'custom_field_setting', 'customer_email_verification_required', 'html_emails', + 'use_mailgun', 'mailgun_api_key', 'mailgun_domain', 'use_bootstrap_theme', 'new_kb_article_visibility', + 'attachments', 'show_number_merged', 'request_location', 'category_order_column', 'rich_text_for_tickets', + 'statuses_order_column', 'kb_attach_dir', 'rich_text_for_tickets_for_customers', 'navbarBackgroundColor', + 'navbarBrandColor', 'navbarBrandHoverColor', 'navbarItemTextColor', 'navbarItemTextHoverColor', + 'navbarItemTextSelectedColor', 'navbarItemSelectedBackgroundColor', 'dropdownItemTextColor', + 'dropdownItemTextHoverColor', 'dropdownItemTextHoverBackgroundColor', 'questionMarkColor')"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddApiTables/CreateTable.php b/install/migrations/v260/AddApiTables/CreateTable.php new file mode 100644 index 00000000..93b0f927 --- /dev/null +++ b/install/migrations/v260/AddApiTables/CreateTable.php @@ -0,0 +1,18 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "user_api_tokens` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `user_id` INT NOT NULL, + `token` VARCHAR(500) NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "user_api_tokens`"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddApiTables/InsertSetting.php b/install/migrations/v260/AddApiTables/InsertSetting.php new file mode 100644 index 00000000..c4ad2fe0 --- /dev/null +++ b/install/migrations/v260/AddApiTables/InsertSetting.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('public_api', '0')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'public_api'"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddCalendarModule/AddColorColumnToCategories.php b/install/migrations/v260/AddCalendarModule/AddColorColumnToCategories.php new file mode 100644 index 00000000..fa54da12 --- /dev/null +++ b/install/migrations/v260/AddCalendarModule/AddColorColumnToCategories.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `color` VARCHAR(7)"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `color`"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddCalendarModule/AddDefaultCalendarViewToUsers.php b/install/migrations/v260/AddCalendarModule/AddDefaultCalendarViewToUsers.php new file mode 100644 index 00000000..f4837384 --- /dev/null +++ b/install/migrations/v260/AddCalendarModule/AddDefaultCalendarViewToUsers.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `default_calendar_view` INT NOT NULL DEFAULT '0' AFTER `notify_note_unassigned`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `default_calendar_view`"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddCalendarModule/AddDueDateColumnToTickets.php b/install/migrations/v260/AddCalendarModule/AddDueDateColumnToTickets.php new file mode 100644 index 00000000..fad0c46d --- /dev/null +++ b/install/migrations/v260/AddCalendarModule/AddDueDateColumnToTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `due_date` DATETIME"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `due_date`"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddCalendarModule/AddNotifyOverdueUnassignedColumnToUsers.php b/install/migrations/v260/AddCalendarModule/AddNotifyOverdueUnassignedColumnToUsers.php new file mode 100644 index 00000000..beccebd7 --- /dev/null +++ b/install/migrations/v260/AddCalendarModule/AddNotifyOverdueUnassignedColumnToUsers.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `notify_overdue_unassigned` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `notify_note_unassigned`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `notify_overdue_unassigned`"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddCalendarModule/AddOverdueEmailSentColumnToTickets.php b/install/migrations/v260/AddCalendarModule/AddOverdueEmailSentColumnToTickets.php new file mode 100644 index 00000000..192b6292 --- /dev/null +++ b/install/migrations/v260/AddCalendarModule/AddOverdueEmailSentColumnToTickets.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `overdue_email_sent` ENUM('0','1')"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `overdue_email_sent`"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddCalendarModule/AddUsageColumnToCategories.php b/install/migrations/v260/AddCalendarModule/AddUsageColumnToCategories.php new file mode 100644 index 00000000..98b1acb5 --- /dev/null +++ b/install/migrations/v260/AddCalendarModule/AddUsageColumnToCategories.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `usage` INT NOT NULL DEFAULT 0"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `usage`"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddCalendarModule/CreateCalendarEventReminderTable.php b/install/migrations/v260/AddCalendarModule/CreateCalendarEventReminderTable.php new file mode 100644 index 00000000..f0ce9030 --- /dev/null +++ b/install/migrations/v260/AddCalendarModule/CreateCalendarEventReminderTable.php @@ -0,0 +1,21 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `user_id` INT NOT NULL, + `event_id` INT NOT NULL, + `amount` INT NOT NULL, + `unit` INT NOT NULL, + `email_sent` ENUM('0', '1') NOT NULL DEFAULT '0') ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder`"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddCalendarModule/CreateCalendarEventTable.php b/install/migrations/v260/AddCalendarModule/CreateCalendarEventTable.php new file mode 100644 index 00000000..46e37eab --- /dev/null +++ b/install/migrations/v260/AddCalendarModule/CreateCalendarEventTable.php @@ -0,0 +1,23 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `start` DATETIME, + `end` DATETIME, + `all_day` ENUM('0','1') NOT NULL, + `name` VARCHAR(255) NOT NULL, + `location` VARCHAR(255), + `comments` MEDIUMTEXT, + `category` INT NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event`"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddCalendarModule/InsertDefaultCalendarViewSetting.php b/install/migrations/v260/AddCalendarModule/InsertDefaultCalendarViewSetting.php new file mode 100644 index 00000000..2c6edd5d --- /dev/null +++ b/install/migrations/v260/AddCalendarModule/InsertDefaultCalendarViewSetting.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('default_calendar_view', 'month')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'default_calendar_view'"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddCalendarModule/InsertEnableCalendarSetting.php b/install/migrations/v260/AddCalendarModule/InsertEnableCalendarSetting.php new file mode 100644 index 00000000..18d16733 --- /dev/null +++ b/install/migrations/v260/AddCalendarModule/InsertEnableCalendarSetting.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('enable_calendar', '1')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'enable_calendar'"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddCalendarModule/InsertFirstDayOfWeekSetting.php b/install/migrations/v260/AddCalendarModule/InsertFirstDayOfWeekSetting.php new file mode 100644 index 00000000..a157bbc0 --- /dev/null +++ b/install/migrations/v260/AddCalendarModule/InsertFirstDayOfWeekSetting.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('first_day_of_week', '0')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'first_day_of_week'"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddLoggingTable.php b/install/migrations/v260/AddLoggingTable.php new file mode 100644 index 00000000..b1f55305 --- /dev/null +++ b/install/migrations/v260/AddLoggingTable.php @@ -0,0 +1,21 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `username` VARCHAR(200), + `message` MEDIUMTEXT NOT NULL, + `severity` INT NOT NULL, + `location` MEDIUMTEXT, + `timestamp` TIMESTAMP NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging`"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddPrimaryKeyToSettings.php b/install/migrations/v260/AddPrimaryKeyToSettings.php new file mode 100644 index 00000000..7298cbac --- /dev/null +++ b/install/migrations/v260/AddPrimaryKeyToSettings.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` ADD PRIMARY KEY (`Key`)"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` DROP PRIMARY KEY"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/AddTempAttachmentTable.php b/install/migrations/v260/AddTempAttachmentTable.php new file mode 100644 index 00000000..b66d7b70 --- /dev/null +++ b/install/migrations/v260/AddTempAttachmentTable.php @@ -0,0 +1,21 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "temp_attachment` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `file_name` VARCHAR(255) NOT NULL, + `saved_name` VARCHAR(255) NOT NULL, + `size` INT(10) UNSIGNED NOT NULL, + `type` ENUM('0','1') NOT NULL, + `date_uploaded` TIMESTAMP NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "temp_attachment`"); + } +} \ No newline at end of file diff --git a/install/migrations/v260/ConvertStatusPropertiesToInts.php b/install/migrations/v260/ConvertStatusPropertiesToInts.php new file mode 100644 index 00000000..7f04f9b3 --- /dev/null +++ b/install/migrations/v260/ConvertStatusPropertiesToInts.php @@ -0,0 +1,29 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` CHANGE `IsNewTicketStatus` `IsNewTicketStatus` INT( 1 ) NOT NULL DEFAULT '0', + CHANGE `IsClosed` `IsClosed` INT( 1 ) NOT NULL DEFAULT '0', + CHANGE `IsClosedByClient` `IsClosedByClient` INT( 1 ) NOT NULL DEFAULT '0', + CHANGE `IsCustomerReplyStatus` `IsCustomerReplyStatus` INT( 1 ) NOT NULL DEFAULT '0', + CHANGE `IsStaffClosedOption` `IsStaffClosedOption` INT( 1 ) NOT NULL DEFAULT '0', + CHANGE `IsStaffReopenedStatus` `IsStaffReopenedStatus` INT( 1 ) NOT NULL DEFAULT '0', + CHANGE `IsDefaultStaffReplyStatus` `IsDefaultStaffReplyStatus` INT( 1 ) NOT NULL DEFAULT '0', + CHANGE `LockedTicketStatus` `LockedTicketStatus` INT( 1 ) NOT NULL DEFAULT '0'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` CHANGE `IsNewTicketStatus` `IsNewTicketStatus` INT( 1 ) NOT NULL DEFAULT '0', + CHANGE `IsClosed` `IsClosed` ENUM('0','1') NOT NULL DEFAULT '0', + CHANGE `IsClosedByClient` `IsClosedByClient` ENUM('0','1') NOT NULL DEFAULT '0', + CHANGE `IsCustomerReplyStatus` `IsCustomerReplyStatus` ENUM('0','1') NOT NULL DEFAULT '0', + CHANGE `IsStaffClosedOption` `IsStaffClosedOption` ENUM('0','1') NOT NULL DEFAULT '0', + CHANGE `IsStaffReopenedStatus` `IsStaffReopenedStatus` ENUM('0','1') NOT NULL DEFAULT '0', + CHANGE `IsDefaultStaffReplyStatus` `IsDefaultStaffReplyStatus` ENUM('0','1') NOT NULL DEFAULT '0', + CHANGE `LockedTicketStatus` `LockedTicketStatus` ENUM('0','1') NOT NULL DEFAULT '0'"); + } +} \ No newline at end of file diff --git a/install/migrations/v262/AddMissingColumnsToStageTickets/AddDueDateColumn.php b/install/migrations/v262/AddMissingColumnsToStageTickets/AddDueDateColumn.php new file mode 100644 index 00000000..06989103 --- /dev/null +++ b/install/migrations/v262/AddMissingColumnsToStageTickets/AddDueDateColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `due_date` DATETIME"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `due_date`"); + } +} \ No newline at end of file diff --git a/install/migrations/v262/AddMissingColumnsToStageTickets/AddOverdueEmailSentColumn.php b/install/migrations/v262/AddMissingColumnsToStageTickets/AddOverdueEmailSentColumn.php new file mode 100644 index 00000000..9e8d9ac1 --- /dev/null +++ b/install/migrations/v262/AddMissingColumnsToStageTickets/AddOverdueEmailSentColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `overdue_email_sent` ENUM('0','1')"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `overdue_email_sent`"); + } +} \ No newline at end of file diff --git a/install/migrations/v300/AddColorSchemeSetting.php b/install/migrations/v300/AddColorSchemeSetting.php new file mode 100644 index 00000000..e488350b --- /dev/null +++ b/install/migrations/v300/AddColorSchemeSetting.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('admin_color_scheme', 'skin-blue')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'admin_color_scheme'"); + } +} \ No newline at end of file diff --git a/install/migrations/v300/MigrateAutorefreshOption/DropOldColumn.php b/install/migrations/v300/MigrateAutorefreshOption/DropOldColumn.php new file mode 100644 index 00000000..76fa0305 --- /dev/null +++ b/install/migrations/v300/MigrateAutorefreshOption/DropOldColumn.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `autorefresh`"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `autorefresh` BIGINT NOT NULL DEFAULT 0"); + } +} \ No newline at end of file diff --git a/install/migrations/v300/MigrateAutorefreshOption/UpdateFromOldValue.php b/install/migrations/v300/MigrateAutorefreshOption/UpdateFromOldValue.php new file mode 100644 index 00000000..7ea1bb57 --- /dev/null +++ b/install/migrations/v300/MigrateAutorefreshOption/UpdateFromOldValue.php @@ -0,0 +1,15 @@ +executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `autoreload` = `autorefresh` / 10"); + } + + function down($hesk_settings) { + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `autorefresh` = `autoreload` * 10"); + } +} \ No newline at end of file diff --git a/install/migrations/v300/MigrateHeskCustomStatuses.php b/install/migrations/v300/MigrateHeskCustomStatuses.php new file mode 100644 index 00000000..5f2a5132 --- /dev/null +++ b/install/migrations/v300/MigrateHeskCustomStatuses.php @@ -0,0 +1,65 @@ +executeQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_statuses` ORDER BY `order`"); + + $next_status_id_rs = $this->executeQuery("SELECT MAX(`ID`) AS `last_id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`"); + $next_status_id_row = hesk_dbFetchAssoc($next_status_id_rs); + $next_status_id = intval($next_status_id_row['last_id']) + 1; + + $next_sort_rs = $this->executeQuery("SELECT MAX(`sort`) AS `last_sort` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`"); + $next_sort_row = hesk_dbFetchAssoc($next_sort_rs); + $next_sort = intval($next_sort_row['last_sort']) + 10; + + while ($row = hesk_dbFetchAssoc($hesk_statuses)) { + $closable = $row['can_customers_change'] == '1' ? 'yes' : 'sonly'; + + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` (`ID`, + `TextColor`, + `IsNewTicketStatus`, + `IsClosed`, + `IsClosedByClient`, + `IsCustomerReplyStatus`, + `IsStaffClosedOption`, + `IsStaffReopenedStatus`, + `IsDefaultStaffReplyStatus`, + `LockedTicketStatus`, + `IsAutocloseOption`, + `Closable`, + `Key`, + `sort`) + VALUES (" . $next_status_id . ", + '#" . $row['color'] . "', + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + '" . $closable . "', + 'STORED IN XREF TABLE', + " . $next_sort . ")"); + + $languages = json_decode($row['name']); + foreach ($languages as $language => $text) { + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref` (`language`, `text`, `status_id`) + VALUES ('" . $language . "', '" . $text . "', " . $next_status_id . ")"); + } + + // Increment the next ID and sort + $next_status_id++; + $next_sort += 10; + } + } + + function down($hesk_settings) { + } +} \ No newline at end of file diff --git a/install/migrations/v302/AddMissingCustomFields.php b/install/migrations/v302/AddMissingCustomFields.php new file mode 100644 index 00000000..9975c831 --- /dev/null +++ b/install/migrations/v302/AddMissingCustomFields.php @@ -0,0 +1,75 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` + ADD COLUMN `custom21` MEDIUMTEXT, + ADD COLUMN `custom22` MEDIUMTEXT, + ADD COLUMN `custom23` MEDIUMTEXT, + ADD COLUMN `custom24` MEDIUMTEXT, + ADD COLUMN `custom25` MEDIUMTEXT, + ADD COLUMN `custom26` MEDIUMTEXT, + ADD COLUMN `custom27` MEDIUMTEXT, + ADD COLUMN `custom28` MEDIUMTEXT, + ADD COLUMN `custom29` MEDIUMTEXT, + ADD COLUMN `custom30` MEDIUMTEXT, + ADD COLUMN `custom31` MEDIUMTEXT, + ADD COLUMN `custom32` MEDIUMTEXT, + ADD COLUMN `custom33` MEDIUMTEXT, + ADD COLUMN `custom34` MEDIUMTEXT, + ADD COLUMN `custom35` MEDIUMTEXT, + ADD COLUMN `custom36` MEDIUMTEXT, + ADD COLUMN `custom37` MEDIUMTEXT, + ADD COLUMN `custom38` MEDIUMTEXT, + ADD COLUMN `custom39` MEDIUMTEXT, + ADD COLUMN `custom40` MEDIUMTEXT, + ADD COLUMN `custom41` MEDIUMTEXT, + ADD COLUMN `custom42` MEDIUMTEXT, + ADD COLUMN `custom43` MEDIUMTEXT, + ADD COLUMN `custom44` MEDIUMTEXT, + ADD COLUMN `custom45` MEDIUMTEXT, + ADD COLUMN `custom46` MEDIUMTEXT, + ADD COLUMN `custom47` MEDIUMTEXT, + ADD COLUMN `custom48` MEDIUMTEXT, + ADD COLUMN `custom49` MEDIUMTEXT, + ADD COLUMN `custom50` MEDIUMTEXT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` + DROP COLUMN `custom21`, + DROP COLUMN `custom22`, + DROP COLUMN `custom23`, + DROP COLUMN `custom24`, + DROP COLUMN `custom25`, + DROP COLUMN `custom26`, + DROP COLUMN `custom27`, + DROP COLUMN `custom28`, + DROP COLUMN `custom29`, + DROP COLUMN `custom30`, + DROP COLUMN `custom31`, + DROP COLUMN `custom32`, + DROP COLUMN `custom33`, + DROP COLUMN `custom34`, + DROP COLUMN `custom35`, + DROP COLUMN `custom36`, + DROP COLUMN `custom37`, + DROP COLUMN `custom38`, + DROP COLUMN `custom39`, + DROP COLUMN `custom40`, + DROP COLUMN `custom41`, + DROP COLUMN `custom42`, + DROP COLUMN `custom43`, + DROP COLUMN `custom44`, + DROP COLUMN `custom45`, + DROP COLUMN `custom46`, + DROP COLUMN `custom47`, + DROP COLUMN `custom48`, + DROP COLUMN `custom49`, + DROP COLUMN `custom50`"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddApiUrlRewriteSetting.php b/install/migrations/v310/AddApiUrlRewriteSetting.php new file mode 100644 index 00000000..cf1d6846 --- /dev/null +++ b/install/migrations/v310/AddApiUrlRewriteSetting.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('api_url_rewrite', '0')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'api_url_rewrite'"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddCustomNavElements/CreateCustomNavElementTable.php b/install/migrations/v310/AddCustomNavElements/CreateCustomNavElementTable.php new file mode 100644 index 00000000..ff2bc037 --- /dev/null +++ b/install/migrations/v310/AddCustomNavElements/CreateCustomNavElementTable.php @@ -0,0 +1,21 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_nav_element` + (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + image_url TEXT, + font_icon VARCHAR(200), + place INT NOT NULL, + url VARCHAR(500) NOT NULL, + sort INT NOT NULL)"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_nav_element`"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddCustomNavElements/CreateCustomNavElementToTextTable.php b/install/migrations/v310/AddCustomNavElements/CreateCustomNavElementToTextTable.php new file mode 100644 index 00000000..87eff45e --- /dev/null +++ b/install/migrations/v310/AddCustomNavElements/CreateCustomNavElementToTextTable.php @@ -0,0 +1,20 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_nav_element_to_text` + (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + nav_element_id INT NOT NULL, + language VARCHAR(200) NOT NULL, + text VARCHAR(200) NOT NULL, + subtext VARCHAR(200))"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_nav_element_to_text`"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddMoreColorOptionsToCategories/AddBackgroundColor.php b/install/migrations/v310/AddMoreColorOptionsToCategories/AddBackgroundColor.php new file mode 100644 index 00000000..c8d819b5 --- /dev/null +++ b/install/migrations/v310/AddMoreColorOptionsToCategories/AddBackgroundColor.php @@ -0,0 +1,16 @@ +executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `color` = '#FFFFFF' WHERE `color` IS NULL"); + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` CHANGE `color` `background_color` VARCHAR(7) NOT NULL DEFAULT '#FFFFFF'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` CHANGE `background_color` `color` VARCHAR(7) NOT NULL DEFAULT '#FFFFFF'"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddMoreColorOptionsToCategories/AddDisplayBorderOutline.php b/install/migrations/v310/AddMoreColorOptionsToCategories/AddDisplayBorderOutline.php new file mode 100644 index 00000000..87855a3e --- /dev/null +++ b/install/migrations/v310/AddMoreColorOptionsToCategories/AddDisplayBorderOutline.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `display_border_outline` ENUM('0','1') NOT NULL DEFAULT '0'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `display_border_outline`"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddMoreColorOptionsToCategories/AddForegroundColor.php b/install/migrations/v310/AddMoreColorOptionsToCategories/AddForegroundColor.php new file mode 100644 index 00000000..fcef4303 --- /dev/null +++ b/install/migrations/v310/AddMoreColorOptionsToCategories/AddForegroundColor.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `foreground_color` VARCHAR(7) NOT NULL DEFAULT 'AUTO'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `foreground_color`"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddNewLoginSettings/AddLoginBackground.php b/install/migrations/v310/AddNewLoginSettings/AddLoginBackground.php new file mode 100644 index 00000000..6f67ac4f --- /dev/null +++ b/install/migrations/v310/AddNewLoginSettings/AddLoginBackground.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_background', '#d2d6de')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'login_background'"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddNewLoginSettings/AddLoginBackgroundType.php b/install/migrations/v310/AddNewLoginSettings/AddLoginBackgroundType.php new file mode 100644 index 00000000..ffd82f0a --- /dev/null +++ b/install/migrations/v310/AddNewLoginSettings/AddLoginBackgroundType.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_background_type', 'color')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'login_background_type'"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddNewLoginSettings/AddLoginBoxHeader.php b/install/migrations/v310/AddNewLoginSettings/AddLoginBoxHeader.php new file mode 100644 index 00000000..624a741f --- /dev/null +++ b/install/migrations/v310/AddNewLoginSettings/AddLoginBoxHeader.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_box_header', 'helpdesk-title')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'login_box_header'"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddNewLoginSettings/AddLoginBoxHeaderImage.php b/install/migrations/v310/AddNewLoginSettings/AddLoginBoxHeaderImage.php new file mode 100644 index 00000000..f0859cdf --- /dev/null +++ b/install/migrations/v310/AddNewLoginSettings/AddLoginBoxHeaderImage.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_box_header_image', '')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'login_box_header_image'"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddStackTraceToLogs.php b/install/migrations/v310/AddStackTraceToLogs.php new file mode 100644 index 00000000..ec89b916 --- /dev/null +++ b/install/migrations/v310/AddStackTraceToLogs.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging` ADD COLUMN `stack_trace` TEXT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging` DROP COLUMN `stack_trace`"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/ConvertPresetToIndividualColors.php b/install/migrations/v310/ConvertPresetToIndividualColors.php new file mode 100644 index 00000000..c0d8461d --- /dev/null +++ b/install/migrations/v310/ConvertPresetToIndividualColors.php @@ -0,0 +1,125 @@ +executeQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'admin_color_scheme'"); + if (hesk_dbNumRows($theme_preset_rs) === 0) { + $theme = 'skin-blue'; + } else { + $theme_preset_row = hesk_dbFetchAssoc($theme_preset_rs); + $theme = $theme_preset_row['Value']; + } + + $light_theme = preg_match_all('/.*-light/', $theme); + $navbar = array( + 'background' => '', + 'text' => '#fff', + 'text_hover' => '#fff', + 'background_hover' => '' + ); + $navbar_brand = array( + 'background' => '', + 'text' => '#fff', + 'text_hover' => '#fff', + 'background_hover' => '' + ); + $sidebar = array( + 'background' => $light_theme ? '#f9fafc' : '#222d32', + 'text' => $light_theme ? '#444' : '#b8c7ce', + 'text_hover' => $light_theme ? '#444' : '#fff', + 'background_hover' => $light_theme ? '#f4f4f5' : '#1e282c', + 'font_weight' => $light_theme ? 'bold' : 'normal' + ); + $sidebar_header = array( + 'background' => $light_theme ? '#f9fafc' : '#1a2226', + 'text' => $light_theme ? '#848484' : '#4b646f', + ); + if (preg_match('/skin-blue.*/', $theme)) { + $navbar['background'] = '#3c8dbc'; + $navbar['background_hover'] = '#367fa9'; + + $navbar_brand['background'] = $light_theme ? '#3c8dbc' : '#367fa9'; + $navbar_brand['background_hover'] = $light_theme ? '#3b8ab8' : '#357ca5'; + } elseif (preg_match('/skin-yellow.*/', $theme)) { + $navbar['background'] = '#f39c12'; + $navbar['background_hover'] = '#da8c10'; + + $navbar_brand['background'] = $light_theme ? '#f39c12' : '#e08e0b'; + $navbar_brand['background_hover'] = $light_theme ? '#f39a0d' : '#db8b0b'; + } elseif (preg_match('/skin-green.*/', $theme)) { + $navbar['background'] = '#00a65a'; + $navbar['background_hover'] = '#009551'; + + $navbar_brand['background'] = $light_theme ? '#00a65a' : '#008d4c'; + $navbar_brand['background_hover'] = $light_theme ? '#00a157' : '#008749'; + } elseif (preg_match('/skin-purple.*/', $theme)) { + $navbar['background'] = '#605ca8'; + $navbar['background_hover'] = '#565397'; + + $navbar_brand['background'] = $light_theme ? '#605ca8' : '#555299'; + $navbar_brand['background_hover'] = $light_theme ? '#5d59a6' : '#545096'; + } elseif (preg_match('/skin-red.*/', $theme)) { + $navbar['background'] = '#dd4b39'; + $navbar['background_hover'] = '#c64333'; + + $navbar_brand['background'] = $light_theme ? '#dd4b39' : '#d73925'; + $navbar_brand['background_hover'] = $light_theme ? '#dc4735' : '#d33724'; + } else { + $navbar['background'] = '#fff'; + $navbar['background_hover'] = '#eee'; + $navbar['text_color'] = '#333'; + $navbar['text_hover'] = '#333'; + + $navbar_brand['background'] = '#fff'; + $navbar_brand['background_hover'] = '#fcfcfc'; + $navbar_brand['text'] = '#333'; + $navbar_brand['text_hover'] = '#333'; + } + + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_background', '{$navbar['background']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_background_hover', '{$navbar['background_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_text', '{$navbar['text']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_text_hover', '{$navbar['text_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_brand_background', '{$navbar_brand['background']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_brand_background_hover', '{$navbar_brand['background_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_brand_text', '{$navbar_brand['text']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_brand_text_hover', '{$navbar_brand['text_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_background', '{$sidebar['background']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_background_hover', '{$sidebar['background_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_text', '{$sidebar['text']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_text_hover', '{$sidebar['text_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_font_weight', '{$sidebar['font_weight']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_header_background', '{$sidebar_header['background']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_header_text', '{$sidebar_header['text']}')"); + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` IN ('rtl', 'admin_color_scheme')"); + } + + function down($hesk_settings) { + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_color_scheme', 'skin-blue')"); + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` IN ('admin_navbar_background', + 'admin_navbar_background_hover', 'admin_navbar_text', 'admin_navbar_text_hover', 'admin_navbar_brand_background', + 'admin_navbar_brand_background_hover', 'admin_navbar_brand_text', 'admin_navbar_brand_text_hover', 'admin_sidebar_background', + 'admin_sidebar_background_hover', 'admin_sidebar_text', 'admin_sidebar_text_hover', 'admin_sidebar_font_weight', + 'admin_sidebar_header_background', 'admin_sidebar_header_text')"); + } +} \ No newline at end of file diff --git a/install/migrations/v320/AddAuditTrail/CreateAuditTrailTable.php b/install/migrations/v320/AddAuditTrail/CreateAuditTrailTable.php new file mode 100644 index 00000000..3dadf4be --- /dev/null +++ b/install/migrations/v320/AddAuditTrail/CreateAuditTrailTable.php @@ -0,0 +1,20 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `entity_id` INT NOT NULL, + `entity_type` VARCHAR(50) NOT NULL, + `language_key` VARCHAR(100) NOT NULL, + `date` TIMESTAMP NOT NULL)"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail`"); + } +} \ No newline at end of file diff --git a/install/migrations/v320/AddAuditTrail/CreateAuditTrailToReplacementValuesTable.php b/install/migrations/v320/AddAuditTrail/CreateAuditTrailToReplacementValuesTable.php new file mode 100644 index 00000000..93a009bb --- /dev/null +++ b/install/migrations/v320/AddAuditTrail/CreateAuditTrailToReplacementValuesTable.php @@ -0,0 +1,19 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail_to_replacement_values` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `audit_trail_id` INT NOT NULL, + `replacement_index` INT NOT NULL, + `replacement_value` TEXT NOT NULL)"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail_to_replacement_values`"); + } +} \ No newline at end of file diff --git a/install/migrations/v320/AddDescriptionToCategoriesAndCustomFields/AddDescriptionToCategories.php b/install/migrations/v320/AddDescriptionToCategoriesAndCustomFields/AddDescriptionToCategories.php new file mode 100644 index 00000000..aba2ffc5 --- /dev/null +++ b/install/migrations/v320/AddDescriptionToCategoriesAndCustomFields/AddDescriptionToCategories.php @@ -0,0 +1,17 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` + ADD COLUMN `mfh_description` TEXT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` + DROP COLUMN `mfh_description`"); + } +} \ No newline at end of file diff --git a/install/migrations/v320/AddDescriptionToCategoriesAndCustomFields/AddDescriptionToCustomFields.php b/install/migrations/v320/AddDescriptionToCategoriesAndCustomFields/AddDescriptionToCustomFields.php new file mode 100644 index 00000000..bac58528 --- /dev/null +++ b/install/migrations/v320/AddDescriptionToCategoriesAndCustomFields/AddDescriptionToCustomFields.php @@ -0,0 +1,29 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_fields` + ADD COLUMN `mfh_description` TEXT"); + + // Purge the custom field caches as we're adding a new field + foreach ($hesk_settings['languages'] as $key => $value) { + $language_hash = sha1($key); + hesk_unlink(HESK_PATH . "cache/cf_{$language_hash}.cache.php"); + } + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_fields` + DROP COLUMN `mfh_description`"); + + // Purge the custom field caches as we're adding a new field + foreach ($hesk_settings['languages'] as $key => $value) { + $language_hash = sha1($key); + hesk_unlink(HESK_PATH . "cache/cf_{$language_hash}.cache.php"); + } + } +} \ No newline at end of file diff --git a/install/migrations/v320/AddMigrationSetting.php b/install/migrations/v320/AddMigrationSetting.php new file mode 100644 index 00000000..c28cc17a --- /dev/null +++ b/install/migrations/v320/AddMigrationSetting.php @@ -0,0 +1,16 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('migrationNumber', '158')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'migrationNumber'"); + } +} \ No newline at end of file diff --git a/install/mods-for-hesk/ajax/install-database-ajax.php b/install/mods-for-hesk/ajax/install-database-ajax.php deleted file mode 100644 index 77aed493..00000000 --- a/install/mods-for-hesk/ajax/install-database-ajax.php +++ /dev/null @@ -1,100 +0,0 @@ - 0) { - $jsonToSend['status'] = 'ATTENTION'; - $jsonToSend['users'] = array(); - $users = getUsers(); - foreach ($users as $user) { - array_push($jsonToSend['users'], $user); - } - } else { - $jsonToSend['status'] = 'SUCCESS'; - } - print json_encode($jsonToSend); -} elseif ($task == 'migrate-bans') { - migrateBans($_POST['user']); -} elseif ($task == 'initialize-statuses') { - initializeXrefTable(); -} else { - $response = 'The task "' . $task . '" was not recognized. Check your spelling and try again.'; - print $response; - http_response_code(400); -} \ No newline at end of file diff --git a/install/mods-for-hesk/ajax/uninstall-database-ajax.php b/install/mods-for-hesk/ajax/uninstall-database-ajax.php deleted file mode 100644 index 92c3af7c..00000000 --- a/install/mods-for-hesk/ajax/uninstall-database-ajax.php +++ /dev/null @@ -1,17 +0,0 @@ - - - - Mods For HESK Database Validation - - - - - - - - - - -
Mods for HESK Database Validation
-
- - - -
-
-

Results

-
- - - - - - - - - $('#all-good').show()"; - } else { - echo ""; - } - ?> - -
Database ChangeStatus
-
-
- - - 0; - - output_result('Setting Exists: ' . $setting_name, $all_good); - - return $all_good !== false; -} - -function run_table_check($table_name) { - return run_column_check($table_name, '1'); -} - -function run_column_check($table_name, $column_name) { - global $hesk_settings; - - if ($column_name == '1') { - $all_good = run_check('SELECT ' . $column_name . ' FROM `' . $hesk_settings['db_pfix'] . $table_name . '` LIMIT 1'); - - output_result('Table Exists: ' . $table_name, - $all_good); - } else { - $all_good = run_check('SELECT `' . $column_name . '` FROM `' . $hesk_settings['db_pfix'] . $table_name . '` LIMIT 1'); - output_result('Column Exists: ' . $table_name . '.' . $column_name, - $all_good); - } - - return $all_good !== false; -} - -function run_check($sql) { - global $hesk_last_query; - global $hesk_db_link; - if (function_exists('mysqli_connect')) { - if (!$hesk_db_link && !hesk_dbConnect()) { - return false; - } - $hesk_last_query = $sql; - - return @mysqli_query($hesk_db_link, $sql); - } else { - if (!$hesk_db_link && !hesk_dbConnect()) { - return false; - } - $hesk_last_query = $sql; - - return $res = @mysql_query($sql, $hesk_db_link); - } -} - -function output_result($change_title, $success) { - $css_color = 'green'; - $text = ' Success'; - if (!$success) { - $css_color = 'red'; - $text = ' Failure'; - } - - $formatted_text = sprintf('%s%s', $change_title, $css_color, $text); - - echo $formatted_text; -} - -function output_header_row($text) { - echo ' ' . $text . ''; -} \ No newline at end of file diff --git a/install/mods-for-hesk/index.html b/install/mods-for-hesk/index.html deleted file mode 100644 index cf048141..00000000 --- a/install/mods-for-hesk/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/install/mods-for-hesk/installModsForHesk.php b/install/mods-for-hesk/installModsForHesk.php deleted file mode 100644 index cae36a82..00000000 --- a/install/mods-for-hesk/installModsForHesk.php +++ /dev/null @@ -1,182 +0,0 @@ - 'Pre-1.4.0', - 3 => '1.4.0', - 4 => '1.4.1', - 5 => '1.5.0', - 6 => '1.6.0', - 7 => '1.6.1', - 8 => '1.7.0', - 9 => '2.0.0', - 10 => '2.0.1', - 11 => '2.1.0', - 12 => '2.1.1', - 13 => '2.2.0', - 14 => '2.2.1', - 15 => '2.3.0', - 16 => '2.3.1', - 17 => '2.3.2', - 18 => '2.4.0', - 19 => '2.4.1', - 20 => '2.4.2', - 21 => '2.5.0', - 22 => '2.5.1', - 23 => '2.5.2', - 24 => '2.5.3', - 25 => '2.5.4', - 26 => '2.5.5', - 27 => '2.6.0', - 28 => '2.6.1', - 29 => '2.6.2', - 30 => '2.6.3', - 31 => '2.6.4', - 32 => '3.0.0 beta 1', - 33 => '3.0.0 RC 1', - 34 => '3.0.0', - 35 => '3.0.1', - 36 => '3.0.2', - 37 => '3.0.3', - 38 => '3.0.4', - 39 => '3.0.5', - 40 => '3.0.6', - 41 => '3.0.7', - 42 => '3.1.0', - 43 => '3.1.1', -); - -function echoInitialVersionRows($version, $build_to_version_map) -{ - foreach ($build_to_version_map as $build => $display_text) { - if ($version < $build) { - printRow($display_text); - } - } -} - -function printRow($version) -{ - $versionId = str_replace('.', '', $version); - $versionId = str_replace('Pre-', 'p', $versionId); - $versionId = str_replace(' beta ', 'b', $versionId); - $versionId = str_replace(' RC ', 'rc', $versionId); - echo ''; - echo '' . $version . ''; - echo ' Waiting...'; - echo ''; -} - -?> - - - Installing / Updating Mods for HESK - - - - - - - - - - - - - -
Installing / Updating Mods for HESK
-
- -
-
-
-
Installation Progress
-
- - - - - - - - - - -
VersionStatus
- - - - - - - - - - - - - - - - - - - - -
TaskStatus
Migrate IP / Email Bans Waiting...
Initialize Statuses Waiting...
- -
-
-
-
- -
-
-
-
Console
-
- - - - - - - - -
SeverityMessage
-
-
-
-
-
- - - \ No newline at end of file diff --git a/install/mods-for-hesk/js/ui-scripts.js b/install/mods-for-hesk/js/ui-scripts.js deleted file mode 100644 index 2d061c64..00000000 --- a/install/mods-for-hesk/js/ui-scripts.js +++ /dev/null @@ -1,109 +0,0 @@ -function disableAllDisablable(exclusion) { - $('.disablable').attr('disabled', 'disabled'); - $('#' + exclusion).removeAttr('disabled'); -} - -function enableAllDisablable() { - $('.disablable').removeAttr('disabled'); - $('#updateText').hide(); -} - -function updateLink() { - var version = $('select[name="current-version"]').val(); - var format = 'installModsForHesk.php?v={0}'; - - var formattedLink = format.replace('{0}', version); - $('#upgrade-link').attr('href', formattedLink); -} - -function startVersionUpgrade(version) { - $('#spinner-' + version) - .removeClass('fa-exclamation-triangle') - .addClass('fa-spinner') - .addClass('fa-pulse'); - changeRowTo('row', version, 'info'); - changeTextTo('span', version, 'In Progress'); -} - -function markUpdateAsSuccess(version, formattedVersion) { - removeSpinner(version); - $('#spinner-' + version).addClass('fa-check-circle'); - changeTextTo('span', version, 'Completed Successfully'); - changeRowTo('row', version, 'success'); - appendToInstallConsole('SUCCESSUpdates for ' + formattedVersion + ' complete'); -} - -function removeSpinner(version) { - $('#spinner-' + version) - .removeClass('fa-pulse') - .removeClass('fa-spinner'); -} - -function markUpdateAsAttention(version) { - removeSpinner(version); - $('#spinner-' + version).addClass('fa-exclamation-triangle'); - changeRowTo('row', version, 'warning'); - changeTextTo('span', version, 'Attention! See below for more information'); -} - -function markUpdateAsFailure(version) { - removeSpinner(version); - $('#spinner-' + version).addClass('fa-times-circle'); - changeRowTo('row', version, 'danger'); - changeTextTo('span', version, 'Update failed! Check the console for more information'); -} - -function changeTextTo(prefix, version, text) { - $('#' + prefix + '-' + version).text(text); -} - -function changeRowTo(prefix, version, clazz) { - //-- Remove all classes - $('#' + prefix + '-' + version) - .removeClass('info') - .removeClass('warning') - .removeClass('danger') - .removeClass('success'); - - //-- Re-add the requested class - $('#' + prefix + '-' + version).addClass(clazz); -} - -function appendToInstallConsole(text) { - $('#consoleBody').append(text); -} - -function installationFinished() { - appendToInstallConsole('SUCCESSInstallation complete'); - var output = '
' + - '
' + - '

' + - '

Awesome! The installation / upgrade has completed. Please delete the install directory and then proceed to your helpdesk!

' + - '
' + - '
'; - $('#install-information').html(output); -} - -function getContentForMigratePrompt(users) { - var beginningText = '

Migrating IP / E-mail Bans

Mods for HESK has detected that you have added IP address ' + - 'and/or email bans using Mods for HESK. As part of the upgrade process, Mods for HESK will migrate these bans ' + - 'for you to HESK 2.6.0\'s IP/email ban feature. Select the user below that will be the "creator" of the bans, ' + - 'then click "Submit".

'; - var selectMarkup = '
User:
' + - '

'; - var submitMarkup = '
' + - 'Don\'t Migrate
'; - - return beginningText + selectMarkup + submitMarkup; -} - -function prepareAttentionPanel(content) { - $('#attention-body').html(content); - $('#attention-row').show(); -} - -jQuery(document).ready(loadJquery); \ No newline at end of file diff --git a/install/mods-for-hesk/js/uninstall-scripts.js b/install/mods-for-hesk/js/uninstall-scripts.js deleted file mode 100644 index bf896f34..00000000 --- a/install/mods-for-hesk/js/uninstall-scripts.js +++ /dev/null @@ -1,102 +0,0 @@ -function getTasks() { - return ['status-change', 'drop-columns']; -} - -function processUninstallation() { - var tasks = getTasks(); - //-- Change status column to default HESK values - tasks.forEach(function (task) { - startUninstallation(task); - executeUninstallation(task); - }); -} -function startUninstallation(task) { - $('#spinner-' + task) - .removeClass('fa-exclamation-triangle') - .addClass('fa-spinner') - .addClass('fa-pulse'); - changeRowTo('row', task, 'info'); - changeTextTo('span', task, 'In Progress'); -} - -function changeTextTo(prefix, task, text) { - $('#' + prefix + '-' + task).text(text); -} - -function changeRowTo(prefix, task, clazz) { - //-- Remove all classes - $('#' + prefix + '-' + task) - .removeClass('info') - .removeClass('warning') - .removeClass('danger') - .removeClass('success'); - - //-- Re-add the requested class - $('#' + prefix + '-' + task).addClass(clazz); -} - -function executeUninstallation(task) { - appendToInstallConsole('INFOStarting task code: ' + task + ''); - $.ajax({ - type: 'POST', - url: 'ajax/uninstall-database-ajax.php', - data: {task: task}, - success: function (data) { - markUninstallAsSuccess(task); - checkForCompletion(); - }, - error: function (data) { - if (data.status == 400) { - appendToInstallConsole('ERRORThe task ' + task + ' was not recognized. Check the value submitted and try again.'); - } else { - appendToInstallConsole('ERROR' + data.responseText + ''); - } - markUninstallAsFailure(task); - } - }); -} - -function checkForCompletion() { - // If all rows have a .success row, installation is finished - var numberOfTasks = getTasks().length; - var numberOfCompletions = $('tr.success').length; - if (numberOfTasks == numberOfCompletions) { - uninstallationFinished(); - } -} - -function uninstallationFinished() { - appendToInstallConsole('SUCCESSUninstallation complete'); - var output = '
' + - '
' + - '

' + - '

Awesome! The automated portion of uninstalling Mods for HESK has completed. ' + - 'Please follow these instructions ' + - 'on the Mods for HESK website to finish uninstallation.

' + - '
' + - '
'; - $('#uninstall-information').html(output); -} - -function markUninstallAsSuccess(task) { - removeSpinner(task); - $('#spinner-' + task).addClass('fa-check-circle'); - changeTextTo('span', task, 'Completed Successfully'); - changeRowTo('row', task, 'success'); - appendToInstallConsole('SUCCESSUninstall for task code: ' + task + ' complete'); -} - -function markUninstallAsFailure(task) { - removeSpinner(task); - $('#spinner-' + task).addClass('fa-times-circle'); - changeRowTo('row', task, 'danger'); - changeTextTo('span', task, 'Uninstall failed! Check the console for more information'); -} - -function removeSpinner(task) { - $('#spinner-' + task) - .removeClass('fa-pulse') - .removeClass('fa-spinner'); -} - -jQuery(document).ready(loadJquery); \ No newline at end of file diff --git a/install/mods-for-hesk/js/version-scripts.js b/install/mods-for-hesk/js/version-scripts.js deleted file mode 100644 index a7a9d1fc..00000000 --- a/install/mods-for-hesk/js/version-scripts.js +++ /dev/null @@ -1,230 +0,0 @@ -function processUpdates(startingVersion) { - if (startingVersion < 2) { - startVersionUpgrade('p140'); - executeUpdate(2, 'p140', 'Pre 1.4.0'); - } else if (startingVersion < 3) { - startVersionUpgrade('140'); - executeUpdate(3, '140', '1.4.0'); - } else if (startingVersion < 4) { - startVersionUpgrade('141'); - executeUpdate(4, '141', '1.4.1'); - } else if (startingVersion < 5) { - startVersionUpgrade('150'); - executeUpdate(5, '150', '1.5.0'); - } else if (startingVersion < 6) { - startVersionUpgrade('160'); - executeUpdate(6, '160', '1.6.0'); - } else if (startingVersion < 7) { - startVersionUpgrade('161'); - executeUpdate(7, '161', '1.6.1'); - } else if (startingVersion < 8) { - startVersionUpgrade('170'); - executeUpdate(8, '170', '1.7.0'); - } else if (startingVersion < 9) { - startVersionUpgrade('200'); - executeUpdate(9, '200', '2.0.0'); - } else if (startingVersion < 10) { - startVersionUpgrade('201'); - executeUpdate(10, '201', '2.0.1'); - } else if (startingVersion < 11) { - startVersionUpgrade('210'); - executeUpdate(11, '210', '2.1.0'); - } else if (startingVersion < 12) { - startVersionUpgrade('211'); - executeUpdate(12, '211', '2.1.1'); - } else if (startingVersion < 13) { - startVersionUpgrade('220'); - executeUpdate(13, '220', '2.2.0'); - } else if (startingVersion < 14) { - startVersionUpgrade('221'); - executeUpdate(14, '221', '2.2.1'); - } else if (startingVersion < 15) { - startVersionUpgrade('230'); - executeUpdate(15, '230', '2.3.0'); - } else if (startingVersion < 16) { - startVersionUpgrade('231'); - executeUpdate(16, '231', '2.3.1'); - } else if (startingVersion < 17) { - startVersionUpgrade('232'); - executeUpdate(17, '232', '2.3.2'); - } else if (startingVersion < 18) { - startVersionUpgrade('240'); - executeUpdate(18, '240', '2.4.0'); - } else if (startingVersion < 19) { - startVersionUpgrade('241'); - executeUpdate(19, '241', '2.4.1'); - } else if (startingVersion < 20) { - startVersionUpgrade('242'); - executeUpdate(20, '242', '2.4.2'); - } else if (startingVersion < 21) { - startVersionUpgrade('250'); - executeUpdate(21, '250', '2.5.0'); - } else if (startingVersion < 22) { - startVersionUpgrade('251'); - executeUpdate(22, '251', '2.5.1'); - } else if (startingVersion < 23) { - startVersionUpgrade('252'); - executeUpdate(23, '252', '2.5.2'); - } else if (startingVersion < 24) { - startVersionUpgrade('253'); - executeUpdate(24, '253', '2.5.3'); - } else if (startingVersion < 25) { - startVersionUpgrade('254'); - executeUpdate(25, '254', '2.5.4'); - } else if (startingVersion < 26) { - startVersionUpgrade('255'); - executeUpdate(26, '255', '2.5.5'); - } else if (startingVersion < 27) { - startVersionUpgrade('260'); - executeUpdate(27, '260', '2.6.0'); - } else if (startingVersion < 28) { - startVersionUpgrade('261'); - executeUpdate(28, '261', '2.6.1'); - } else if (startingVersion < 29) { - startVersionUpgrade('262'); - executeUpdate(29, '262', '2.6.2'); - } else if (startingVersion < 30) { - startVersionUpgrade('263'); - executeUpdate(30, '263', '2.6.3'); - } else if (startingVersion < 31) { - startVersionUpgrade('264'); - executeUpdate(31, '264', '2.6.4'); - } else if (startingVersion < 32) { - startVersionUpgrade('300b1'); - executeUpdate(32, '300b1', '3.0.0 beta 1'); - } else if (startingVersion < 33) { - startVersionUpgrade('300rc1'); - executeUpdate(33, '300rc1', '3.0.0 RC 1'); - } else if (startingVersion < 34) { - startVersionUpgrade('300'); - executeUpdate(34, '300', '3.0.0'); - } else if (startingVersion < 35) { - startVersionUpgrade('301'); - executeUpdate(35, '301', '3.0.1'); - } else if (startingVersion < 36) { - startVersionUpgrade('302'); - executeUpdate(36, '302', '3.0.2'); - } else if (startingVersion < 37) { - startVersionUpgrade('303'); - executeUpdate(37, '303', '3.0.3'); - } else if (startingVersion < 38) { - startVersionUpgrade('304'); - executeUpdate(38, '304', '3.0.4'); - } else if (startingVersion < 39) { - startVersionUpgrade('305'); - executeUpdate(39, '305', '3.0.5'); - } else if (startingVersion < 40) { - startVersionUpgrade('306'); - executeUpdate(40, '306', '3.0.6'); - } else if (startingVersion < 41) { - startVersionUpgrade('307'); - executeUpdate(41, '307', '3.0.7'); - } else if (startingVersion < 42) { - startVersionUpgrade('310'); - executeUpdate(42, '310', '3.1.0'); - } else if (startingVersion < 43) { - startVersionUpgrade('311'); - executeUpdate(43, '311', '3.1.1'); - } else { - installationFinished(); - } -} - - -function executeUpdate(version, cssclass, formattedVersion) { - appendToInstallConsole('INFOStarting updates for ' + formattedVersion + ''); - $.ajax({ - type: 'POST', - url: 'ajax/install-database-ajax.php', - data: {version: version}, - success: function () { - markUpdateAsSuccess(cssclass, formattedVersion); - if (version == 9) { - migrateIpEmailBans('banmigrate', 'banmigrate'); - } else if (version == 18) { - initializeStatuses('initialize-statuses', 'initialize-statuses'); - } else { - processUpdates(version); - } - }, - error: function (data) { - appendToInstallConsole('ERROR' + data.responseText + ''); - markUpdateAsFailure(cssclass); - } - }); -} - -function migrateIpEmailBans(version, cssclass) { - startVersionUpgrade(version); - appendToInstallConsole('INFOChecking for IP / Email address bans to migrate'); - $.ajax({ - type: 'POST', - url: 'ajax/task-ajax.php', - data: {task: 'ip-email-bans'}, - success: function (data) { - var parsedData = $.parseJSON(data); - if (parsedData.status == 'ATTENTION') { - appendToInstallConsole('WARNINGYour response is needed. Please check above.'); - markUpdateAsAttention(version); - prepareAttentionPanel(getContentForMigratePrompt(parsedData.users)); - } else { - migrateComplete(); - } - }, - error: function (data) { - appendToInstallConsole('ERROR' + data.responseText + ''); - markUpdateAsFailure(version); - } - }); -} - -function initializeStatuses(version, cssclass) { - startVersionUpgrade(version); - appendToInstallConsole('INFOInitializing Statuses'); - $.ajax({ - type: 'POST', - url: 'ajax/task-ajax.php', - data: {task: 'initialize-statuses'}, - success: function (data) { - markUpdateAsSuccess(cssclass, 'Initializing Statuses'); - statusesInitialized(); - }, - error: function (data) { - appendToInstallConsole('ERROR' + data.responseText + ''); - markUpdateAsFailure(version); - } - }); -} - -function statusesInitialized() { - processUpdates(18); -} - - -function runMigration() { - // Get user ID that is selected - var userId = $('#user-dropdown').val(); - // Hide the div, switch back to in progress - $('#attention-row').hide(); - startVersionUpgrade('banmigrate'); - $.ajax({ - type: 'POST', - url: 'ajax/task-ajax.php', - data: {task: 'migrate-bans', user: userId}, - success: function (data) { - migrateComplete(); - }, - error: function (data) { - appendToInstallConsole('ERROR: ' + data.responseText); - markUpdateAsFailure('banmigrate'); - } - }) -} - -function migrateComplete() { - $('#attention-row').hide(); - markUpdateAsSuccess('banmigrate', 'IP and Email address bans'); - processUpdates(9); -} - -jQuery(document).ready(loadJquery); \ No newline at end of file diff --git a/install/mods-for-hesk/modsForHesk.php b/install/mods-for-hesk/modsForHesk.php deleted file mode 100644 index 4496bc49..00000000 --- a/install/mods-for-hesk/modsForHesk.php +++ /dev/null @@ -1,245 +0,0 @@ - - - - Mods For HESK <?php echo MODS_FOR_HESK_NEW_VERSION; ?> Install / Upgrade - - - - - - - - - - - - - -
Mods for HESK Install / Upgrade
-
- - -
-
-
-
Database/File Requirements
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Database Information / File Permissions
Database Host:
Database Name:
Database User:
Database Password:
Database Prefix:
-
-
- 0) { - $versionRS = hesk_dbQuery('SELECT `Value` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'settings` WHERE `Key` = \'modsForHeskVersion\''); - $versionArray = hesk_dbFetchAssoc($versionRS); - $version = $versionArray['Value']; - } - ?> -
-
-
Install / Upgrade
-
- -
-
-

You cannot install/upgrade Mods for HESK until the - requirements on the left have been met.

- -

Refresh

-
-
-
-
-

Make sure that you have updated / installed - HESK first; otherwise installation will fail!

-
-

Select your current Mods for HESK version and click "Upgrade" to upgrade your installation. - If you have never installed Mods for HESK before, click "No previous installation".

-
-
-
- - -
-
- -
-
- Upgrade -
-
-
-
-
-
-
- No - previous installation - - - Validate Database - -
-
-
-
- -
-
- By proceeding, you agree to the terms of the MIT License. -
-
-
-
-
-
-
-
- - -disableAllDisablable(\'' . $disableAllExcept . '\')'; -} -?> - - - diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php deleted file mode 100644 index 19991d8c..00000000 --- a/install/mods-for-hesk/sql/installSql.php +++ /dev/null @@ -1,1163 +0,0 @@ - $value) { - $languages[$key] = $hesk_settings['languages'][$key]['folder']; - } - - $statusesRs = executeQuery("SELECT `ID`, `Key` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`"); - $oldSetting = $hesk_settings['can_sel_lang']; - $hesk_settings['can_sel_lang'] = 1; - while ($row = hesk_dbFetchAssoc($statusesRs)) { - foreach ($languages as $language => $languageCode) { - hesk_setLanguage($language); - $sql = "INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref` (`language`, `text`, `status_id`) - VALUES ('" . hesk_dbEscape($language) . "', '" . hesk_dbEscape($hesklang[$row['Key']]) . "', " . intval($row['ID']) . ")"; - executeQuery($sql); - } - } - $hesk_settings['can_sel_lang'] = $oldSetting; - hesk_resetLanguage(); -} -// END Version 2.4.0 - -// BEGIN Version 2.4.1 -function execute241Scripts() -{ - global $hesk_settings; - - hesk_dbConnect(); - - executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.4.1' WHERE `Key` = 'modsForHeskVersion'"); -} -// END Version 2.4.1 - -// Version 2.4.2 -function execute242Scripts() -{ - global $hesk_settings; - - hesk_dbConnect(); - - executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.4.2' WHERE `Key` = 'modsForHeskVersion'"); -} - -// BEGIN Version 2.5.0 -function migrateSettings() -{ - global $hesk_settings; - - hesk_dbConnect(); - - $modsForHesk_settings = array(); - if (file_exists(HESK_PATH . 'modsForHesk_settings.inc.php')) { - require_once(HESK_PATH . 'modsForHesk_settings.inc.php'); - } - - $rtl = getSettingValue($modsForHesk_settings, 'rtl', 0); - $show_icons = getSettingValue($modsForHesk_settings, 'show_icons', 0); - $custom_field_setting = getSettingValue($modsForHesk_settings, 'custom_field_setting', 0); - $customer_email_verification_required = getSettingValue($modsForHesk_settings, 'customer_email_verification_required', 0); - $html_emails = getSettingValue($modsForHesk_settings, 'html_emails', 1); - $use_mailgun = getSettingValue($modsForHesk_settings, 'use_mailgun', 0); - $mailgun_api_key = getSettingValue($modsForHesk_settings, 'mailgun_api_key', ''); - $mailgun_domain = getSettingValue($modsForHesk_settings, 'mailgun_domain', ''); - $use_bootstrap_theme = getSettingValue($modsForHesk_settings, 'use_bootstrap_theme', 1); - $new_kb_article_visibility = getSettingValue($modsForHesk_settings, 'new_kb_article_visibility', 0); - $attachments = getSettingValue($modsForHesk_settings, 'attachments', 0); - $show_number_merged = getSettingValue($modsForHesk_settings, 'show_number_merged', 1); - $request_location = getSettingValue($modsForHesk_settings, 'request_location', 0); - $category_order_column = getSettingValue($modsForHesk_settings, 'category_order_column', 'cat_order'); - $rich_text_for_tickets = getSettingValue($modsForHesk_settings, 'rich_text_for_tickets', 0); - $statuses_order_column = getSettingValue($modsForHesk_settings, 'statuses_order_column', 'sort'); - $kb_attach_dir = getSettingValue($modsForHesk_settings, 'kb_attach_dir', 'attachments'); - $rich_text_for_tickets_for_customers = getSettingValue($modsForHesk_settings, 'rich_text_for_tickets_for_customers', 0); - - $navbar_background_color = getSettingValue($modsForHesk_settings, 'navbarBackgroundColor', '#414a5c'); - $navbar_brand_color = getSettingValue($modsForHesk_settings, 'navbarBrandColor', '#d4dee7'); - $navbar_brand_hover_color = getSettingValue($modsForHesk_settings, 'navbarBrandHoverColor', '#ffffff'); - $navbar_item_text_color = getSettingValue($modsForHesk_settings, 'navbarItemTextColor', '#d4dee7'); - $navbar_item_text_hover_color = getSettingValue($modsForHesk_settings, 'navbarItemTextHoverColor', '#ffffff'); - $navbar_item_text_selected_color = getSettingValue($modsForHesk_settings, 'navbarItemTextSelectedColor', '#ffffff'); - $navbar_item_selected_background_color = getSettingValue($modsForHesk_settings, 'navbarItemSelectedBackgroundColor', '#2d3646'); - $dropdown_item_text_color = getSettingValue($modsForHesk_settings, 'dropdownItemTextColor', '#333333'); - $dropdown_item_text_hover_color = getSettingValue($modsForHesk_settings, 'dropdownItemTextHoverColor', '#262626'); - $dropdown_item_text_hover_background_color = getSettingValue($modsForHesk_settings, 'dropdownItemTextHoverBackgroundColor', '#f5f5f5'); - $question_mark_color = getSettingValue($modsForHesk_settings, 'questionMarkColor', '#000000'); - - - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('rtl', " . intval($rtl) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('show_icons', " . intval($show_icons) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('custom_field_setting', " . intval($custom_field_setting) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('customer_email_verification_required', " . intval($customer_email_verification_required) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('html_emails', " . intval($html_emails) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('use_mailgun', " . intval($use_mailgun) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('mailgun_api_key', '" . hesk_dbEscape($mailgun_api_key) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('mailgun_domain', '" . hesk_dbEscape($mailgun_domain) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('use_bootstrap_theme', " . intval($use_bootstrap_theme) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('new_kb_article_visibility', " . intval($new_kb_article_visibility) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('attachments', " . intval($attachments) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('show_number_merged', " . intval($show_number_merged) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('request_location', " . intval($request_location) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('category_order_column', '" . hesk_dbEscape($category_order_column) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('rich_text_for_tickets', " . intval($rich_text_for_tickets) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('statuses_order_column', '" . hesk_dbEscape($statuses_order_column) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('kb_attach_dir', '" . hesk_dbEscape($kb_attach_dir) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('rich_text_for_tickets_for_customers', " . intval($rich_text_for_tickets_for_customers) . ")"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('navbarBackgroundColor', '" . hesk_dbEscape($navbar_background_color) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('navbarBrandColor', '" . hesk_dbEscape($navbar_brand_color) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('navbarBrandHoverColor', '" . hesk_dbEscape($navbar_brand_hover_color) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('navbarItemTextColor', '" . hesk_dbEscape($navbar_item_text_color) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('navbarItemTextHoverColor', '" . hesk_dbEscape($navbar_item_text_hover_color) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('navbarItemTextSelectedColor', '" . hesk_dbEscape($navbar_item_text_selected_color) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('navbarItemSelectedBackgroundColor', '" . hesk_dbEscape($navbar_item_selected_background_color) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('dropdownItemTextColor', '" . hesk_dbEscape($dropdown_item_text_color) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('dropdownItemTextHoverColor', '" . hesk_dbEscape($dropdown_item_text_hover_color) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('dropdownItemTextHoverBackgroundColor', '" . hesk_dbEscape($dropdown_item_text_hover_background_color) . "')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('questionMarkColor', '" . hesk_dbEscape($question_mark_color) . "')"); -} - -function getSettingValue($settings, $setting, $default) -{ - return isset($settings[$setting]) ? $settings[$setting] : $default; -} - -function execute250Scripts() -{ - global $hesk_settings; - - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `user_agent` TEXT"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `screen_resolution_width` INT"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `screen_resolution_height` INT"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `user_agent` TEXT"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `screen_resolution_width` INT"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `screen_resolution_height` INT"); - - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('display_user_agent_information', '0')"); - - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('navbar_title_url', '" . hesk_dbEscape($hesk_settings['hesk_url']) . "')"); - - executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.5.0' WHERE `Key` = 'modsForHeskVersion'"); -} -// END Version 2.5.0 - -// Version 2.5.1 -function execute251Scripts() -{ - global $hesk_settings; - hesk_dbConnect(); - - executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.5.1' WHERE `Key` = 'modsForHeskVersion'"); -} - -// Version 2.5.2 -function execute252Scripts() -{ - global $hesk_settings; - hesk_dbConnect(); - - executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.5.2' WHERE `Key` = 'modsForHeskVersion'"); -} - -// Version 2.5.3 -function execute253Scripts() -{ - global $hesk_settings; - hesk_dbConnect(); - - executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.5.3' WHERE `Key` = 'modsForHeskVersion'"); -} - -// Version 2.5.4 -function execute254Scripts() -{ - global $hesk_settings; - hesk_dbConnect(); - - executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.5.4' WHERE `Key` = 'modsForHeskVersion'"); -} - -// Version 2.5.5 -function execute255Scripts() -{ - updateVersion('2.5.5'); -} - -function updateVersion($version) { - global $hesk_settings; - - hesk_dbConnect(); - - executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '{$version}' WHERE `Key` = 'modsForHeskVersion'"); -} - -// Version 2.6.0 -function execute260Scripts() -{ - global $hesk_settings; - hesk_dbConnect(); - - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('public_api', '0')"); - executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging` ( - `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `username` VARCHAR(200), - `message` MEDIUMTEXT NOT NULL, - `severity` INT NOT NULL, - `location` MEDIUMTEXT, - `timestamp` TIMESTAMP NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); - executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "user_api_tokens` ( - `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `user_id` INT NOT NULL, - `token` VARCHAR(500) NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); - executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "temp_attachment` ( - `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `file_name` VARCHAR(255) NOT NULL, - `saved_name` VARCHAR(255) NOT NULL, - `size` INT(10) UNSIGNED NOT NULL, - `type` ENUM('0','1') NOT NULL, - `date_uploaded` TIMESTAMP NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); - executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event` ( - `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `start` DATETIME, - `end` DATETIME, - `all_day` ENUM('0','1') NOT NULL, - `name` VARCHAR(255) NOT NULL, - `location` VARCHAR(255), - `comments` MEDIUMTEXT, - `category` INT NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); - executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder` ( - `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `user_id` INT NOT NULL, - `event_id` INT NOT NULL, - `amount` INT NOT NULL, - `unit` INT NOT NULL, - `email_sent` ENUM('0', '1') NOT NULL DEFAULT '0') ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `due_date` DATETIME"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `overdue_email_sent` ENUM('0','1')"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `color` VARCHAR(7)"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `usage` INT NOT NULL DEFAULT 0"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `notify_overdue_unassigned` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `notify_note_unassigned`"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `default_calendar_view` INT NOT NULL DEFAULT '0' AFTER `notify_note_unassigned`"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('enable_calendar', '1')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('first_day_of_week', '0')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('default_calendar_view', 'month')"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` ADD PRIMARY KEY ( `Key` )"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` CHANGE `IsNewTicketStatus` `IsNewTicketStatus` INT( 1 ) NOT NULL DEFAULT '0', - CHANGE `IsClosed` `IsClosed` INT( 1 ) NOT NULL DEFAULT '0', - CHANGE `IsClosedByClient` `IsClosedByClient` INT( 1 ) NOT NULL DEFAULT '0', - CHANGE `IsCustomerReplyStatus` `IsCustomerReplyStatus` INT( 1 ) NOT NULL DEFAULT '0', - CHANGE `IsStaffClosedOption` `IsStaffClosedOption` INT( 1 ) NOT NULL DEFAULT '0', - CHANGE `IsStaffReopenedStatus` `IsStaffReopenedStatus` INT( 1 ) NOT NULL DEFAULT '0', - CHANGE `IsDefaultStaffReplyStatus` `IsDefaultStaffReplyStatus` INT( 1 ) NOT NULL DEFAULT '0', - CHANGE `LockedTicketStatus` `LockedTicketStatus` INT( 1 ) NOT NULL DEFAULT '0'"); - - updateVersion('2.6.0'); -} - -// Version 2.6.1 -function execute261Scripts() { - updateVersion('2.6.1'); -} - -// Version 2.6.2 -function execute262Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `due_date` DATETIME"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `overdue_email_sent` ENUM('0','1')"); - - updateVersion('2.6.2'); -} - -// Version 2.6.3 -function execute263Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - updateVersion('2.6.3'); -} - -// Version 2.6.4 -function execute264Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - updateVersion('2.6.4'); -} - -// Verison 3.0.0 Beta 1 -function execute300Beta1Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - $hesk_statuses = executeQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_statuses` ORDER BY `order`"); - - $next_status_id_rs = executeQuery("SELECT MAX(`ID`) AS `last_id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`"); - $next_status_id_row = hesk_dbFetchAssoc($next_status_id_rs); - $next_status_id = intval($next_status_id_row['last_id']) + 1; - - $next_sort_rs = executeQuery("SELECT MAX(`sort`) AS `last_sort` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`"); - $next_sort_row = hesk_dbFetchAssoc($next_sort_rs); - $next_sort = intval($next_sort_row['last_sort']) + 10; - - while ($row = hesk_dbFetchAssoc($hesk_statuses)) { - $closable = $row['can_customers_change'] == '1' ? 'yes' : 'sonly'; - - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` (`ID`, - `TextColor`, - `IsNewTicketStatus`, - `IsClosed`, - `IsClosedByClient`, - `IsCustomerReplyStatus`, - `IsStaffClosedOption`, - `IsStaffReopenedStatus`, - `IsDefaultStaffReplyStatus`, - `LockedTicketStatus`, - `IsAutocloseOption`, - `Closable`, - `Key`, - `sort`) - VALUES (" . $next_status_id . ", - '#" . $row['color'] . "', - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - '" . $closable . "', - 'STORED IN XREF TABLE', - " . $next_sort . ")"); - - $languages = json_decode($row['name']); - foreach ($languages as $language => $text) { - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref` (`language`, `text`, `status_id`) - VALUES ('" . $language . "', '" . $text . "', " . $next_status_id . ")"); - } - - // Increment the next ID and sort - $next_status_id++; - $next_sort += 10; - } - - // Migrate user's autorefresh columns to the new autoreload column - // Mods for HESK is in millis; HESK is in seconds. - executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `autoreload` = `autorefresh` / 10"); - - // Add the admin_color_scheme setting - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('admin_color_scheme', 'skin-blue')"); - - updateVersion('3.0.0 beta 1'); -} - -function execute300RC1Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `autorefresh`"); - - updateVersion('3.0.0 RC 1'); -} - -function execute300Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - updateVersion('3.0.0'); -} - -function execute301Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - updateVersion('3.0.1'); -} - -function execute302Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` - ADD COLUMN `custom21` MEDIUMTEXT, - ADD COLUMN `custom22` MEDIUMTEXT, - ADD COLUMN `custom23` MEDIUMTEXT, - ADD COLUMN `custom24` MEDIUMTEXT, - ADD COLUMN `custom25` MEDIUMTEXT, - ADD COLUMN `custom26` MEDIUMTEXT, - ADD COLUMN `custom27` MEDIUMTEXT, - ADD COLUMN `custom28` MEDIUMTEXT, - ADD COLUMN `custom29` MEDIUMTEXT, - ADD COLUMN `custom30` MEDIUMTEXT, - ADD COLUMN `custom31` MEDIUMTEXT, - ADD COLUMN `custom32` MEDIUMTEXT, - ADD COLUMN `custom33` MEDIUMTEXT, - ADD COLUMN `custom34` MEDIUMTEXT, - ADD COLUMN `custom35` MEDIUMTEXT, - ADD COLUMN `custom36` MEDIUMTEXT, - ADD COLUMN `custom37` MEDIUMTEXT, - ADD COLUMN `custom38` MEDIUMTEXT, - ADD COLUMN `custom39` MEDIUMTEXT, - ADD COLUMN `custom40` MEDIUMTEXT, - ADD COLUMN `custom41` MEDIUMTEXT, - ADD COLUMN `custom42` MEDIUMTEXT, - ADD COLUMN `custom43` MEDIUMTEXT, - ADD COLUMN `custom44` MEDIUMTEXT, - ADD COLUMN `custom45` MEDIUMTEXT, - ADD COLUMN `custom46` MEDIUMTEXT, - ADD COLUMN `custom47` MEDIUMTEXT, - ADD COLUMN `custom48` MEDIUMTEXT, - ADD COLUMN `custom49` MEDIUMTEXT, - ADD COLUMN `custom50` MEDIUMTEXT"); - - updateVersion('3.0.2'); -} - -function execute303Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - updateVersion('3.0.3'); -} - -function execute304Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - updateVersion('3.0.4'); -} - -function execute305Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - updateVersion('3.0.5'); -} - -function execute306Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - updateVersion('3.0.6'); -} - -function execute307Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - updateVersion('3.0.7'); -} - -function execute310Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging` ADD COLUMN `stack_trace` TEXT"); - executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_nav_element` - (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - image_url TEXT, - font_icon VARCHAR(200), - place INT NOT NULL, - url VARCHAR(500) NOT NULL, - sort INT NOT NULL)"); - executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_nav_element_to_text` - (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - nav_element_id INT NOT NULL, - language VARCHAR(200) NOT NULL, - text VARCHAR(200) NOT NULL, - subtext VARCHAR(200))"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `foreground_color` VARCHAR(7) NOT NULL DEFAULT 'AUTO'"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `display_border_outline` ENUM('0','1') NOT NULL DEFAULT '0'"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` CHANGE `color` `background_color` VARCHAR(7) NOT NULL DEFAULT '#FFFFFF'"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_background_type', 'color')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_background', '#d2d6de')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_box_header', 'helpdesk-title')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_box_header_image', '')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('api_url_rewrite', '0')"); - - // Copy over color presets to the custom values - $theme_preset_rs = executeQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'admin_color_scheme'"); - if (hesk_dbNumRows($theme_preset_rs) === 0) { - $theme = 'skin-blue'; - } else { - $theme_preset_row = hesk_dbFetchAssoc($theme_preset_rs); - $theme = $theme_preset_row['Value']; - } - - $light_theme = preg_match('/.*-light/g', $theme); - $navbar = array( - 'background' => '', - 'text' => '#fff', - 'text_hover' => '#fff', - 'background_hover' => '' - ); - $navbar_brand = array( - 'background' => '', - 'text' => '#fff', - 'text_hover' => '#fff', - 'background_hover' => '' - ); - $sidebar = array( - 'background' => $light_theme ? '#f9fafc' : '#222d32', - 'text' => $light_theme ? '#444' : '#b8c7ce', - 'text_hover' => $light_theme ? '#444' : '#fff', - 'background_hover' => $light_theme ? '#f4f4f5' : '#1e282c', - 'font_weight' => $light_theme ? 'bold' : 'normal' - ); - $sidebar_header = array( - 'background' => $light_theme ? '#f9fafc' : '#1a2226', - 'text' => $light_theme ? '#848484' : '#4b646f', - ); - if (preg_match('/skin-blue.*/', $theme)) { - $navbar['background'] = '#3c8dbc'; - $navbar['background_hover'] = '#367fa9'; - - $navbar_brand['background'] = $light_theme ? '#3c8dbc' : '#367fa9'; - $navbar_brand['background_hover'] = $light_theme ? '#3b8ab8' : '#357ca5'; - } elseif (preg_match('/skin-yellow.*/', $theme)) { - $navbar['background'] = '#f39c12'; - $navbar['background_hover'] = '#da8c10'; - - $navbar_brand['background'] = $light_theme ? '#f39c12' : '#e08e0b'; - $navbar_brand['background_hover'] = $light_theme ? '#f39a0d' : '#db8b0b'; - } elseif (preg_match('/skin-green.*/', $theme)) { - $navbar['background'] = '#00a65a'; - $navbar['background_hover'] = '#009551'; - - $navbar_brand['background'] = $light_theme ? '#00a65a' : '#008d4c'; - $navbar_brand['background_hover'] = $light_theme ? '#00a157' : '#008749'; - } elseif (preg_match('/skin-purple.*/', $theme)) { - $navbar['background'] = '#605ca8'; - $navbar['background_hover'] = '#565397'; - - $navbar_brand['background'] = $light_theme ? '#605ca8' : '#555299'; - $navbar_brand['background_hover'] = $light_theme ? '#5d59a6' : '#545096'; - } elseif (preg_match('/skin-red.*/', $theme)) { - $navbar['background'] = '#dd4b39'; - $navbar['background_hover'] = '#c64333'; - - $navbar_brand['background'] = $light_theme ? '#dd4b39' : '#d73925'; - $navbar_brand['background_hover'] = $light_theme ? '#dc4735' : '#d33724'; - } else { - $navbar['background'] = '#fff'; - $navbar['background_hover'] = '#eee'; - $navbar['text_color'] = '#333'; - $navbar['text_hover'] = '#333'; - - $navbar_brand['background'] = '#fff'; - $navbar_brand['background_hover'] = '#fcfcfc'; - $navbar_brand['text'] = '#333'; - $navbar_brand['text_hover'] = '#333'; - } - - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_background', '{$navbar['background']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_background_hover', '{$navbar['background_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_text', '{$navbar['text']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_text_hover', '{$navbar['text_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_brand_background', '{$navbar_brand['background']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_brand_background_hover', '{$navbar_brand['background_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_brand_text', '{$navbar_brand['text']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_brand_text_hover', '{$navbar_brand['text_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_background', '{$sidebar['background']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_background_hover', '{$sidebar['background_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_text', '{$sidebar['text']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_text_hover', '{$sidebar['text_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_font_weight', '{$sidebar['font_weight']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_header_background', '{$sidebar_header['background']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_header_text', '{$sidebar_header['text']}')"); - executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` IN ('rtl', 'admin_color_scheme')"); - - updateVersion('3.1.0'); -} - -function execute311Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - updateVersion('3.1.1'); -} - -function execute320Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` - ADD COLUMN `mfh_description` TEXT"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_fields` - ADD COLUMN `mfh_description` TEXT"); - - // Purge the custom field caches as we're adding a new field - foreach ($hesk_settings['languages'] as $key => $value) { - $language_hash = sha1($key); - hesk_unlink(HESK_PATH . "cache/cf_{$language_hash}.cache.php"); - } - - executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail` ( - `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `entity_id` INT NOT NULL, - `entity_type` VARCHAR(50) NOT NULL, - `language_key` VARCHAR(100) NOT NULL, - `date` TIMESTAMP NOT NULL)"); - executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail_to_replacement_values` ( - `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `audit_trail_id` INT NOT NULL, - `replacement_index` INT NOT NULL, - `replacement_value` TEXT NOT NULL)"); - - updateVersion('3.2.0'); -} \ No newline at end of file diff --git a/install/mods-for-hesk/sql/uninstallSql.php b/install/mods-for-hesk/sql/uninstallSql.php deleted file mode 100644 index 6d12cda5..00000000 --- a/install/mods-for-hesk/sql/uninstallSql.php +++ /dev/null @@ -1,110 +0,0 @@ -'; - echo '' . $text . ''; - echo ' Waiting...'; - echo ''; -} - -?> - - - Uninstalling Mods for HESK - - - - - - - - - - - - - -
Uninstalling Mods for HESK
-
- -
-
-
-
Uninstallation Progress
-
- - - - -
-
-
-
-
-
-
-
-
Console
-
- - - - - - - - -
SeverityMessage
-
-
-
-
-
- - - \ No newline at end of file diff --git a/install/uninstall.php b/install/uninstall.php new file mode 100644 index 00000000..ca26414b --- /dev/null +++ b/install/uninstall.php @@ -0,0 +1,160 @@ + 0) { + // They have installed at LEAST to version 1.6.0. Just pull the version number OR migration number + $migrationNumberSql = hesk_dbQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'migrationNumber'"); + if ($migrationRow = hesk_dbFetchAssoc($migrationNumberSql)) { + $startingMigrationNumber = intval($migrationRow['Value']); + } else { + $versionSql = hesk_dbQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'modsForHeskVersion'"); + $versionRow = hesk_dbFetchAssoc($versionSql); + + $migration_map = array( + // Pre-1.4.0 to 1.5.0 did not have a settings table + '1.6.0' => 15, '1.6.1' => 16, '1.7.0' => 20, '2.0.0' => 26, '2.0.1' => 27, '2.1.0' => 28, '2.1.1' => 30, + '2.2.0' => 33, '2.2.1' => 34, '2.3.0' => 40, '2.3.1' => 41, '2.3.2' => 42, '2.4.0' => 47, '2.4.1' => 48, + '2.4.2' => 49, '2.5.0' => 53, '2.5.1' => 54, '2.5.2' => 55, '2.5.3' => 56, '2.5.4' => 57, '2.5.5' => 58, + '2.6.0' => 65, '2.6.1' => 66, '2.6.2' => 68, '2.6.3' => 69, '2.6.4' => 70, '3.0.0' => 74, '3.0.1' => 75, + '3.0.2' => 77, '3.0.3' => 78, '3.0.4' => 79, '3.0.5' => 80, '3.0.6' => 81, '3.0.7' => 82, '3.1.0' => 89, + '3.1.1' => 90 + ); + $startingMigrationNumber = $migration_map[$versionRow['Value']]; + } +} else { + // migration # => sql for checking + $versionChecks = array( + // 1.5.0 -> users.active + 8 => "SHOW COLUMNS FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` LIKE 'active'", + // 1.4.1 -> denied_emails + 5 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails'", + // 1.4.0 -> denied ips + 3 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips'", + // Pre-1.4.0 but still something -> statuses + 1 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses'" + ); + + foreach ($versionChecks as $migrationNumber => $sql) { + $rs = hesk_dbQuery($sql); + if (hesk_dbNumRows($rs) > 0) { + $startingMigrationNumber = $migrationNumber; + break; + } + } +} +?> + + + Mods for HESK <?php echo MODS_FOR_HESK_NEW_VERSION; ?> Install / Upgrade + + + + + + + + + + + +
+
+ + +
+
+ + + \ No newline at end of file