diff --git a/build/NewPatches.php b/build/NewPatches.php new file mode 100644 index 000000000..d25cd85a7 --- /dev/null +++ b/build/NewPatches.php @@ -0,0 +1,51 @@ +. + * @author niel + * @copyright 2015 nZEDb + */ + +require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'config.php'; + +use newznab\db\DbUpdate; +use newznab\utility\Git; +use newznab\utility\Utility; + +if (!Utility::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); + +?> diff --git a/commit b/commit new file mode 100644 index 000000000..3b065dd24 --- /dev/null +++ b/commit @@ -0,0 +1,24 @@ +#!/bin/sh + +EXIT_STATUS=0 + +# Add changes. +git add -i + +# Edit changelog. +nano Changelog + +# Add changes to changelog. +git add Changelog + +php build/NewPatches.php + +EXIT_STATUS="$?" +if [ ${EXIT_STATUS} -gt 0 ] +then + echo "\nProblem while converting SQL patch files!\n"; + exit ${EXIT_STATUS} +fi + +# Commit changes. +git commit