From 1125b51f27db83d6b6430d7d2083ae67f4a01881 Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Tue, 13 Dec 2016 18:43:46 -0800 Subject: [PATCH 01/14] Fixed case where extracting a package would cause an error during rename --- CHANGELOG.md | 6 ++++++ system/src/Grav/Common/GPM/Installer.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdea66039..c4156530f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.1.10 +## XX/XX/2016 + +1. [](#bugfix) + * Fixed case where extracting a package would cause an error during rename + # v1.1.9 ## 12/13/2016 diff --git a/system/src/Grav/Common/GPM/Installer.php b/system/src/Grav/Common/GPM/Installer.php index add625167..0e6352147 100644 --- a/system/src/Grav/Common/GPM/Installer.php +++ b/system/src/Grav/Common/GPM/Installer.php @@ -181,7 +181,7 @@ class Installer return false; } - $package_folder_name = $zip->getNameIndex(0); + $package_folder_name = preg_replace('#\./$#', '', $zip->getNameIndex(0)); $zip->close(); $extracted_folder = $destination . '/' . $package_folder_name; From d61d260ef1c606cf8f058a9fb6b3a00169e68dea Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Wed, 14 Dec 2016 22:40:42 +0100 Subject: [PATCH 02/14] Fix #635 use mv instead of rename as that does not support cross volume operations --- CHANGELOG.md | 1 + system/src/Grav/Common/Filesystem/Folder.php | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4156530f..71fba1f8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 1. [](#bugfix) * Fixed case where extracting a package would cause an error during rename + * Fixed [#635](https://github.com/getgrav/grav/issues/635) use mv instead of rename as that does not support cross volume operations # v1.1.9 ## 12/13/2016 diff --git a/system/src/Grav/Common/Filesystem/Folder.php b/system/src/Grav/Common/Filesystem/Folder.php index a1bcc0883..1b2bd1c40 100644 --- a/system/src/Grav/Common/Filesystem/Folder.php +++ b/system/src/Grav/Common/Filesystem/Folder.php @@ -340,11 +340,13 @@ abstract class Folder // Make sure that path to the target exists before moving. self::create(dirname($target)); - // Just rename the directory. - $success = @rename($source, $target); + error_clear_last(); - if (!$success) { - $error = error_get_last(); + // Just rename the directory. + exec("mv $source $target"); + + $error = error_get_last(); + if ($error) { throw new \RuntimeException($error['message']); } From 5b6452d89eb4c3f21904c6242af796d439b694b6 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Wed, 14 Dec 2016 23:17:02 +0100 Subject: [PATCH 03/14] Revert "Fix #635 use mv instead of rename as that does not support cross volume operations" This reverts commit d61d260ef1c606cf8f058a9fb6b3a00169e68dea. --- CHANGELOG.md | 1 - system/src/Grav/Common/Filesystem/Folder.php | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71fba1f8a..c4156530f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,6 @@ 1. [](#bugfix) * Fixed case where extracting a package would cause an error during rename - * Fixed [#635](https://github.com/getgrav/grav/issues/635) use mv instead of rename as that does not support cross volume operations # v1.1.9 ## 12/13/2016 diff --git a/system/src/Grav/Common/Filesystem/Folder.php b/system/src/Grav/Common/Filesystem/Folder.php index 1b2bd1c40..a1bcc0883 100644 --- a/system/src/Grav/Common/Filesystem/Folder.php +++ b/system/src/Grav/Common/Filesystem/Folder.php @@ -340,13 +340,11 @@ abstract class Folder // Make sure that path to the target exists before moving. self::create(dirname($target)); - error_clear_last(); - // Just rename the directory. - exec("mv $source $target"); + $success = @rename($source, $target); - $error = error_get_last(); - if ($error) { + if (!$success) { + $error = error_get_last(); throw new \RuntimeException($error['message']); } From 0ccc34d8607e4f0e9e438c0d024863ae4b928cdb Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Fri, 16 Dec 2016 19:10:00 +0100 Subject: [PATCH 04/14] Improve detection of home path. Also allow ~/.grav on Windows, drop ConsoleTrait::isWindows() method, used just for that. (#1204) * Improve detection of home path. Also allow ~/.grav on Windows, drop ConsoleTrait::isWindows() method, used just for that. * Extract loadLocalConfig method to ConsoleTrait * Fix issue with using Yaml::parse direcly on a filename, now deprecated * Changelog --- CHANGELOG.md | 3 +++ .../src/Grav/Console/Cli/InstallCommand.php | 13 ++++------- system/src/Grav/Console/ConsoleTrait.php | 22 ++++++++++--------- .../src/Grav/Console/Gpm/InstallCommand.php | 9 +------- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4156530f..c49db82b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,11 @@ # v1.1.10 ## XX/XX/2016 +1. [](#improved) + * Improve detection of home path. Also allow ~/.grav on Windows, drop ConsoleTrait::isWindows() method, used only for that [#1204](https://github.com/getgrav/grav/pull/1204) 1. [](#bugfix) * Fixed case where extracting a package would cause an error during rename + * Fix issue with using Yaml::parse direcly on a filename, now deprecated # v1.1.9 ## 12/13/2016 diff --git a/system/src/Grav/Console/Cli/InstallCommand.php b/system/src/Grav/Console/Cli/InstallCommand.php index a3768ba4e..49b66a097 100644 --- a/system/src/Grav/Console/Cli/InstallCommand.php +++ b/system/src/Grav/Console/Cli/InstallCommand.php @@ -65,20 +65,15 @@ class InstallCommand extends ConsoleCommand // fix trailing slash $this->destination = rtrim($this->destination, DS) . DS; $this->user_path = $this->destination . USER_PATH; - - if (false === $this->isWindows()) { - $local_config_file = exec('eval echo ~/.grav/config'); - if (file_exists($local_config_file)) { - $this->local_config = Yaml::parse($local_config_file); - $this->output->writeln('Read local config from ' . $local_config_file . ''); - } + if ($local_config_file = $this->loadLocalConfig()) { + $this->output->writeln('Read local config from ' . $local_config_file . ''); } // Look for dependencies file in ROOT and USER dir if (file_exists($this->user_path . $dependencies_file)) { - $this->config = Yaml::parse($this->user_path . $dependencies_file); + $this->config = Yaml::parse(file_get_contents($this->user_path . $dependencies_file)); } elseif (file_exists($this->destination . $dependencies_file)) { - $this->config = Yaml::parse($this->destination . $dependencies_file); + $this->config = Yaml::parse(file_get_contents($this->destination . $dependencies_file)); } else { $this->output->writeln('ERROR Missing .dependencies file in user/ folder'); } diff --git a/system/src/Grav/Console/ConsoleTrait.php b/system/src/Grav/Console/ConsoleTrait.php index 66ecd07fd..e03789102 100644 --- a/system/src/Grav/Console/ConsoleTrait.php +++ b/system/src/Grav/Console/ConsoleTrait.php @@ -16,6 +16,7 @@ use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Yaml\Yaml; trait ConsoleTrait { @@ -113,19 +114,20 @@ trait ConsoleTrait } /** - * Validate if the system is based on windows or not. + * Load the local config file * - * @return bool + * @return mixed string the local config file name. false if local config does not exist */ - public function isWindows() + public function loadLocalConfig() { - $keys = [ - 'CYGWIN_NT-5.1', - 'WIN32', - 'WINNT', - 'Windows' - ]; + $home_folder = getenv('HOME') ?: getenv('HOMEDRIVE') . getenv('HOMEPATH'); + $local_config_file = $home_folder . '/.grav/config'; - return array_key_exists(PHP_OS, $keys); + if (file_exists($local_config_file)) { + $this->local_config = Yaml::parse(file_get_contents($local_config_file)); + return $local_config_file; + } + + return false; } } diff --git a/system/src/Grav/Console/Gpm/InstallCommand.php b/system/src/Grav/Console/Gpm/InstallCommand.php index f8103e2c2..bae3dd30a 100644 --- a/system/src/Grav/Console/Gpm/InstallCommand.php +++ b/system/src/Grav/Console/Gpm/InstallCommand.php @@ -20,7 +20,6 @@ use Grav\Console\ConsoleCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Question\ConfirmationQuestion; -use Symfony\Component\Yaml\Yaml; define('GIT_REGEX', '/http[s]?:\/\/(?:.*@)?(github|bitbucket)(?:.org|.com)\/.*\/(.*)/'); @@ -112,13 +111,7 @@ class InstallCommand extends ConsoleCommand $packages = array_map('strtolower', $this->input->getArgument('package')); $this->data = $this->gpm->findPackages($packages); - - if (false === $this->isWindows() && @is_file(getenv("HOME") . '/.grav/config')) { - $local_config_file = exec('eval echo ~/.grav/config'); - if (file_exists($local_config_file)) { - $this->local_config = Yaml::parse($local_config_file); - } - } + $this->loadLocalConfig(); if ( !Installer::isGravInstance($this->destination) || From 8450f77443b897ca857b324d6d07fc43a03d0032 Mon Sep 17 00:00:00 2001 From: ChrisGitIt Date: Fri, 16 Dec 2016 20:09:23 +0100 Subject: [PATCH 05/14] fixed array handling (#1208) if the input array looks like this: array('valA','valB') (not a keyed array) The return result before my change was: array(array('valA'),array('valB')) The return result after my change is: array('valA','valB') --- system/src/Grav/Common/Data/Validation.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Common/Data/Validation.php b/system/src/Grav/Common/Data/Validation.php index 7dbf34838..b597cd642 100644 --- a/system/src/Grav/Common/Data/Validation.php +++ b/system/src/Grav/Common/Data/Validation.php @@ -582,9 +582,10 @@ class Validation foreach ($values as $key => $value) { if (is_array($value)) { $value = implode(',', $value); - } - - $values[$key] = array_map('trim', explode(',', $value)); + $values[$key] = array_map('trim', explode(',', $value)); + } else { + $values[$key] = trim($value); + } } } From 81fc0d47ac7f50574d74e47580ca40d7f8c59aab Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Sat, 17 Dec 2016 07:07:40 -0700 Subject: [PATCH 06/14] Reworked PHP CLI router PR #1218 (#1219) --- index.php | 6 ++++++ system/router.php | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 system/router.php diff --git a/index.php b/index.php index 77725b92a..8d8d2b62f 100644 --- a/index.php +++ b/index.php @@ -14,6 +14,12 @@ if (!is_file($autoload)) { die("Please run: bin/grav install"); } +if (PHP_SAPI == 'cli-server') { + if (!isset($_SERVER['PHP_CLI_ROUTER'])) { + die("PHP webserver requires a router to run Grav, please use:
php -S {$_SERVER["SERVER_NAME"]}:{$_SERVER["SERVER_PORT"]} system/router.php
"); + } +} + use Grav\Common\Grav; use RocketTheme\Toolbox\Event\Event; diff --git a/system/router.php b/system/router.php new file mode 100644 index 000000000..53e0126cf --- /dev/null +++ b/system/router.php @@ -0,0 +1,26 @@ + Date: Sat, 17 Dec 2016 15:09:58 +0100 Subject: [PATCH 07/14] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c49db82b5..3caf1cd7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 1. [](#improved) * Improve detection of home path. Also allow ~/.grav on Windows, drop ConsoleTrait::isWindows() method, used only for that [#1204](https://github.com/getgrav/grav/pull/1204) + * Reworked PHP CLI router [#1219](https://github.com/getgrav/grav/pull/1219) 1. [](#bugfix) * Fixed case where extracting a package would cause an error during rename * Fix issue with using Yaml::parse direcly on a filename, now deprecated From 8b8d8bcc5bebe3796d62bb6fe6e050f255cea832 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Sat, 17 Dec 2016 18:10:19 +0100 Subject: [PATCH 08/14] Fix https://github.com/getgrav/grav-plugin-admin/issues/891 Add pattern for frontend validation of folder slugs --- CHANGELOG.md | 1 + system/blueprints/pages/default.yaml | 1 + system/blueprints/pages/modular_new.yaml | 1 + system/blueprints/pages/modular_raw.yaml | 1 + system/blueprints/pages/new.yaml | 1 + system/blueprints/pages/new_folder.yaml | 1 + system/blueprints/pages/raw.yaml | 1 + 7 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3caf1cd7b..51377e0d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ 1. [](#bugfix) * Fixed case where extracting a package would cause an error during rename * Fix issue with using Yaml::parse direcly on a filename, now deprecated + * Fix [#891](https://github.com/getgrav/grav-plugin-admin/issues/891) Add pattern for frontend validation of folder slugs # v1.1.9 ## 12/13/2016 diff --git a/system/blueprints/pages/default.yaml b/system/blueprints/pages/default.yaml index f38957ccf..f42971c3b 100644 --- a/system/blueprints/pages/default.yaml +++ b/system/blueprints/pages/default.yaml @@ -133,6 +133,7 @@ form: label: PLUGIN_ADMIN.FOLDER_NAME validate: type: slug + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select diff --git a/system/blueprints/pages/modular_new.yaml b/system/blueprints/pages/modular_new.yaml index 273292363..44cf23131 100644 --- a/system/blueprints/pages/modular_new.yaml +++ b/system/blueprints/pages/modular_new.yaml @@ -24,6 +24,7 @@ form: validate: type: slug required: true + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select diff --git a/system/blueprints/pages/modular_raw.yaml b/system/blueprints/pages/modular_raw.yaml index ed25992a3..730809d5c 100644 --- a/system/blueprints/pages/modular_raw.yaml +++ b/system/blueprints/pages/modular_raw.yaml @@ -73,6 +73,7 @@ form: validate: type: slug required: true + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select diff --git a/system/blueprints/pages/new.yaml b/system/blueprints/pages/new.yaml index 49b85b729..df7b0f693 100644 --- a/system/blueprints/pages/new.yaml +++ b/system/blueprints/pages/new.yaml @@ -26,6 +26,7 @@ form: validate: type: slug required: true + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select diff --git a/system/blueprints/pages/new_folder.yaml b/system/blueprints/pages/new_folder.yaml index 16024b749..458fa7498 100644 --- a/system/blueprints/pages/new_folder.yaml +++ b/system/blueprints/pages/new_folder.yaml @@ -19,6 +19,7 @@ form: validate: type: slug required: true + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select diff --git a/system/blueprints/pages/raw.yaml b/system/blueprints/pages/raw.yaml index 60870eaf7..8781c2c31 100644 --- a/system/blueprints/pages/raw.yaml +++ b/system/blueprints/pages/raw.yaml @@ -73,6 +73,7 @@ form: validate: type: slug required: true + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select From 442249c3a193220cf6578b07b537212dc9c8096c Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Mon, 19 Dec 2016 21:07:43 +0100 Subject: [PATCH 09/14] Fix issue with Inflector when translation is disabled [https://github.com/getgrav/grav-plugin-simplesearch/issues/87](https://github.com/getgrav/grav-plugin-simplesearch/issues/87) --- CHANGELOG.md | 1 + system/src/Grav/Common/Inflector.php | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51377e0d6..382499730 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Fixed case where extracting a package would cause an error during rename * Fix issue with using Yaml::parse direcly on a filename, now deprecated * Fix [#891](https://github.com/getgrav/grav-plugin-admin/issues/891) Add pattern for frontend validation of folder slugs + * Fix issue with Inflector when translation is disabled [https://github.com/getgrav/grav-plugin-simplesearch/issues/87](https://github.com/getgrav/grav-plugin-simplesearch/issues/87) # v1.1.9 ## 12/13/2016 diff --git a/system/src/Grav/Common/Inflector.php b/system/src/Grav/Common/Inflector.php index 17a11e0c4..8fe551214 100644 --- a/system/src/Grav/Common/Inflector.php +++ b/system/src/Grav/Common/Inflector.php @@ -26,11 +26,11 @@ class Inflector { if (empty($this->plural)) { $language = Grav::instance()['language']; - $this->plural = $language->translate('INFLECTOR_PLURALS', null, true); - $this->singular = $language->translate('INFLECTOR_SINGULAR', null, true); - $this->uncountable = $language->translate('INFLECTOR_UNCOUNTABLE', null, true); - $this->irregular = $language->translate('INFLECTOR_IRREGULAR', null, true); - $this->ordinals = $language->translate('INFLECTOR_ORDINALS', null, true); + $this->plural = $language->translate('INFLECTOR_PLURALS', null, true) ?: []; + $this->singular = $language->translate('INFLECTOR_SINGULAR', null, true) ?: []; + $this->uncountable = $language->translate('INFLECTOR_UNCOUNTABLE', null, true) ?: []; + $this->irregular = $language->translate('INFLECTOR_IRREGULAR', null, true) ?: []; + $this->ordinals = $language->translate('INFLECTOR_ORDINALS', null, true) ?: []; } } From e40bed5be203d710c73f3fede9ca3a23bae69788 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Tue, 20 Dec 2016 17:37:32 +0100 Subject: [PATCH 10/14] Explicitly expose `array_unique` Twig filter --- CHANGELOG.md | 1 + system/src/Grav/Common/Twig/TwigExtension.php | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 382499730..e1a6074bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Fix issue with using Yaml::parse direcly on a filename, now deprecated * Fix [#891](https://github.com/getgrav/grav-plugin-admin/issues/891) Add pattern for frontend validation of folder slugs * Fix issue with Inflector when translation is disabled [https://github.com/getgrav/grav-plugin-simplesearch/issues/87](https://github.com/getgrav/grav-plugin-simplesearch/issues/87) + * Explicitly expose `array_unique` Twig filter # v1.1.9 ## 12/13/2016 diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index aa9f1de04..fff032e9c 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -87,6 +87,7 @@ class TwigExtension extends \Twig_Extension new \Twig_SimpleFilter('truncate', ['\Grav\Common\Utils', 'truncate']), new \Twig_SimpleFilter('truncate_html', ['\Grav\Common\Utils', 'truncateHTML']), new \Twig_SimpleFilter('json_decode', [$this, 'jsonDecodeFilter']), + new \Twig_SimpleFilter('array_unique', 'array_unique'), ]; } From 9571e992d99a9f127c6fd32aec3d8755012a1ba0 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Tue, 20 Dec 2016 18:05:04 +0100 Subject: [PATCH 11/14] Improve changelog line --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1a6074bd..d19ce9c49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ * Fix issue with using Yaml::parse direcly on a filename, now deprecated * Fix [#891](https://github.com/getgrav/grav-plugin-admin/issues/891) Add pattern for frontend validation of folder slugs * Fix issue with Inflector when translation is disabled [https://github.com/getgrav/grav-plugin-simplesearch/issues/87](https://github.com/getgrav/grav-plugin-simplesearch/issues/87) - * Explicitly expose `array_unique` Twig filter + * Explicitly expose `array_unique` Twig filter [https://github.com/getgrav/grav-plugin-admin/issues/897](https://github.com/getgrav/grav-plugin-admin/issues/897) # v1.1.9 ## 12/13/2016 From befaf5d3871906e94f48d2a83b46ff9c9bef2c6f Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 21 Dec 2016 12:35:58 -0700 Subject: [PATCH 12/14] Improved theme/plugin detect logic --- CHANGELOG.md | 1 + system/src/Grav/Console/Gpm/DirectInstallCommand.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d19ce9c49..f07a26054 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ 1. [](#improved) * Improve detection of home path. Also allow ~/.grav on Windows, drop ConsoleTrait::isWindows() method, used only for that [#1204](https://github.com/getgrav/grav/pull/1204) * Reworked PHP CLI router [#1219](https://github.com/getgrav/grav/pull/1219) + * More robust theme/plugin logic in `bin/gpm direct-install` 1. [](#bugfix) * Fixed case where extracting a package would cause an error during rename * Fix issue with using Yaml::parse direcly on a filename, now deprecated diff --git a/system/src/Grav/Console/Gpm/DirectInstallCommand.php b/system/src/Grav/Console/Gpm/DirectInstallCommand.php index 54b98d552..49ad97bb7 100644 --- a/system/src/Grav/Console/Gpm/DirectInstallCommand.php +++ b/system/src/Grav/Console/Gpm/DirectInstallCommand.php @@ -84,6 +84,7 @@ class DirectInstallCommand extends ConsoleCommand $this->output->write("\x0D"); $this->output->writeln(" |- Extracting package... ok"); + $type = $this->getPackageType($extracted); if (!$type) { @@ -238,6 +239,9 @@ class DirectInstallCommand extends ConsoleCommand */ protected function getPackageType($source) { + $plugin_regex = '/^class\\s{1,}[a-zA-Z0-9]{1,}\\s{1,}extends.+Plugin/m'; + $theme_regex = '/^class\\s{1,}[a-zA-Z0-9]{1,}\\s{1,}extends.+Theme/m'; + if ( file_exists($source . 'system/defines.php') && file_exists($source . 'system/config/system.yaml') @@ -258,9 +262,9 @@ class DirectInstallCommand extends ConsoleCommand } foreach (glob($source . "*.php") as $filename) { $contents = file_get_contents($filename); - if (Utils::contains($contents, 'Grav\Common\Theme')) { + if (preg_match($theme_regex, $contents)) { return 'theme'; - } elseif (Utils::contains($contents, 'Grav\Common\Plugin')) { + } elseif (preg_match($plugin_regex, $contents)) { return 'plugin'; } } From fa27856bc0f63ad499389b211a7da0bb450d1c77 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 21 Dec 2016 12:50:01 -0700 Subject: [PATCH 13/14] Reworked changelog --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f07a26054..c65b5c4bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,13 @@ ## XX/XX/2016 1. [](#improved) - * Improve detection of home path. Also allow ~/.grav on Windows, drop ConsoleTrait::isWindows() method, used only for that [#1204](https://github.com/getgrav/grav/pull/1204) + * Improve detection of home path. Also allow `~/.grav` on Windows, drop `ConsoleTrait::isWindows()` method, used only for that [#1204](https://github.com/getgrav/grav/pull/1204) * Reworked PHP CLI router [#1219](https://github.com/getgrav/grav/pull/1219) * More robust theme/plugin logic in `bin/gpm direct-install` 1. [](#bugfix) * Fixed case where extracting a package would cause an error during rename - * Fix issue with using Yaml::parse direcly on a filename, now deprecated - * Fix [#891](https://github.com/getgrav/grav-plugin-admin/issues/891) Add pattern for frontend validation of folder slugs + * Fix issue with using `Yaml::parse` direcly on a filename, now deprecated + * Add pattern for frontend validation of folder slugs [#891](https://github.com/getgrav/grav-plugin-admin/issues/891) * Fix issue with Inflector when translation is disabled [https://github.com/getgrav/grav-plugin-simplesearch/issues/87](https://github.com/getgrav/grav-plugin-simplesearch/issues/87) * Explicitly expose `array_unique` Twig filter [https://github.com/getgrav/grav-plugin-admin/issues/897](https://github.com/getgrav/grav-plugin-admin/issues/897) From e0f17a48d5fef75d11e139ddb3fbbbb0b3bd6438 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 21 Dec 2016 13:06:42 -0700 Subject: [PATCH 14/14] Prepare for release --- CHANGELOG.md | 2 +- system/defines.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c65b5c4bd..59659ec6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # v1.1.10 -## XX/XX/2016 +## 12/21/2016 1. [](#improved) * Improve detection of home path. Also allow `~/.grav` on Windows, drop `ConsoleTrait::isWindows()` method, used only for that [#1204](https://github.com/getgrav/grav/pull/1204) diff --git a/system/defines.php b/system/defines.php index 956dd1b1d..a704963de 100644 --- a/system/defines.php +++ b/system/defines.php @@ -8,7 +8,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.1.9'); +define('GRAV_VERSION', '1.1.10'); define('GRAV_TESTING', false); define('DS', '/'); define('GRAV_PHP_MIN', '5.5.9');