From 4393e972b104c628613b9caf62675d1b015bc9fa Mon Sep 17 00:00:00 2001 From: DariusIII Date: Tue, 13 Oct 2015 11:16:45 +0200 Subject: [PATCH] Add buid/NewPatches.php to branch. --- CHANGELOG | 2 -- Changelog | 5 ++++- build/NewPatches.php | 51 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) delete mode 100644 CHANGELOG create mode 100644 build/NewPatches.php diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 1e9c4c44a..000000000 --- a/CHANGELOG +++ /dev/null @@ -1,2 +0,0 @@ -2015-09-24 DariusIII -- Add failed downloads count to releases. \ No newline at end of file diff --git a/Changelog b/Changelog index 974aedc8e..cb7cba27c 100755 --- a/Changelog +++ b/Changelog @@ -1 +1,4 @@ -Change permissions on files +2015-10-13 DariusIII + Add: add build/NewPatches.php +2015-10-13 DariusIII + Change permissions on files diff --git a/build/NewPatches.php b/build/NewPatches.php new file mode 100644 index 000000000..9453939c7 --- /dev/null +++ b/build/NewPatches.php @@ -0,0 +1,51 @@ +. + * @author niel + * @copyright 2015 nZEDb + */ + +require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'indexer.php'; + +use nzedb\db\DbUpdate; +use nzedb\utility\Git; +use nzedb\utility\Misc; + +if (!Misc::isCLI()) { + exit; +} + +$error = false; +$git = new Git(); +$branch = $git->active_branch(); + +if (in_array($branch, $git->mainBranches())) { + // Only update patches, etc. on specific branches to lessen conflicts + try { + // Run DbUpdates to make sure we're up to date. + $DbUpdater = new DbUpdate(['git' => $git]); + $DbUpdater->newPatches(['safe' => false]); + } catch (\Exception $e) { + $error = 1; + echo "Error while checking patches!\n"; + echo $e->getMessage() . "\n"; + } +} + +exit($error); + +?>