mirror of
https://github.com/getgrav/grav.git
synced 2025-12-05 15:29:57 +01:00
Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08cbd9553f | ||
|
|
dcaa9a35c3 | ||
|
|
4a80691e07 | ||
|
|
425831a7ae | ||
|
|
984e0455b1 | ||
|
|
00ecfb30f3 | ||
|
|
c18f20e483 | ||
|
|
71c5ff8c51 | ||
|
|
1996dd7de8 | ||
|
|
e87daa2361 | ||
|
|
987feb1385 | ||
|
|
8d048c689f | ||
|
|
139ef04e0a | ||
|
|
4c01e6c93e | ||
|
|
27744ba747 | ||
|
|
3d3c6f4eba | ||
|
|
fb4abc5f5f | ||
|
|
f29b141d69 | ||
|
|
1cecd09423 | ||
|
|
0142e76270 | ||
|
|
5f8c7f41ec | ||
|
|
451baff26e | ||
|
|
0e8e27877e | ||
|
|
d8a993bc86 | ||
|
|
ec7dbbdc8b | ||
|
|
e152cfd10f | ||
|
|
747daa46f1 | ||
|
|
17a0590ee4 | ||
|
|
653edb064b | ||
|
|
40f5d57737 | ||
|
|
566c5cb38f | ||
|
|
7e3058e3f0 | ||
|
|
053d8a3fd5 | ||
|
|
0e810c15e2 | ||
|
|
6b9154d1f3 | ||
|
|
4a5a400b89 | ||
|
|
2d7a3232cc | ||
|
|
96d7c4790f | ||
|
|
c0b9ada21c | ||
|
|
7b116b41ae | ||
|
|
fcdd0bc0e9 | ||
|
|
0619f7c656 | ||
|
|
f7696b61d3 | ||
|
|
48083b203a | ||
|
|
f8aa9fed91 | ||
|
|
c55521ac4a | ||
|
|
cdcb76cc55 |
@@ -40,8 +40,10 @@ env:
|
||||
- TRAVIS_TAG=$(curl --fail --user ${GH_API_USER} -s https://api.github.com/repos/getgrav/grav/releases/latest | grep tag_name | head -n 1 | cut -d '"' -f 4)
|
||||
|
||||
before_install:
|
||||
- export TZ=Pacific/Honolulu
|
||||
- composer self-update
|
||||
- go get github.com/aktau/github-release
|
||||
- echo "Travis Date: `date`"
|
||||
- git clone --quiet --depth=50 --branch=master https://${BB_TOKEN}bitbucket.org/rockettheme/grav-devtools.git $RT_DEVTOOLS &>/dev/null;
|
||||
- if [ ! -z "$TRAVIS_TAG" ]; then
|
||||
cd "${RT_DEVTOOLS}";
|
||||
|
||||
36
CHANGELOG.md
36
CHANGELOG.md
@@ -1,3 +1,39 @@
|
||||
# v1.0.5
|
||||
## 12/18/2015
|
||||
|
||||
1. [](#new)
|
||||
* Add ability to extend markdown with plugins
|
||||
* Added support for plugins to have individual language files
|
||||
* Added `7z` to media formats
|
||||
* Use Grav's fork of Parsedown until PR is merged
|
||||
* New function to persist plugin configuration to disk
|
||||
* GPM `selfupgrade` will now check PHP version requirements
|
||||
1. [](#improved)
|
||||
* If the field allows multiple files, return array
|
||||
* Handle non-array values in file validation
|
||||
1. [](#bugfix)
|
||||
* Fix when looping `fields` param in a `list` field
|
||||
* Properly convert commas to spaces for media attributes
|
||||
* Forcing Travis VM to HI timezone to address future files in zip file
|
||||
|
||||
# v1.0.4
|
||||
## 12/12/2015
|
||||
|
||||
1. [](#bugfix)
|
||||
* Needed to put default image folder permissions for YAML compatibility
|
||||
|
||||
# v1.0.3
|
||||
## 12/11/2015
|
||||
|
||||
1. [](#bugfix)
|
||||
* Fixed issue when saving config causing incorrect image cache folder perms
|
||||
|
||||
# v1.0.2
|
||||
## 12/11/2015
|
||||
|
||||
1. [](#bugfix)
|
||||
* Fix for timing display in debugbar
|
||||
|
||||
# v1.0.1
|
||||
## 12/11/2015
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"twig/twig": "~1.23",
|
||||
"erusev/parsedown": "dev-master as 1.6.0",
|
||||
"erusev/parsedown-extra": "~0.7",
|
||||
"symfony/yaml": "~2.8",
|
||||
"symfony/console": "~2.8",
|
||||
@@ -25,6 +26,12 @@
|
||||
"rockettheme/toolbox": "~1.2",
|
||||
"maximebf/debugbar": "~1.10"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/getgrav/parsedown"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Grav\\": "system/src/Grav"
|
||||
|
||||
33
composer.lock
generated
33
composer.lock
generated
@@ -4,8 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "09fcc6b4528be7d9c8af68a66e85f0b2",
|
||||
"content-hash": "69bee250cbc5160401d50cc47c8d6aba",
|
||||
"hash": "82d333365d7424d73da22f99a2daa42c",
|
||||
"content-hash": "6d876da7dbe11934a98374e67d15550c",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
@@ -130,16 +130,16 @@
|
||||
},
|
||||
{
|
||||
"name": "erusev/parsedown",
|
||||
"version": "1.6.0",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/erusev/parsedown.git",
|
||||
"reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7"
|
||||
"url": "https://github.com/getgrav/parsedown.git",
|
||||
"reference": "10a7ff776c3f16b1b3aa41c176c48150fc091065"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/erusev/parsedown/zipball/3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7",
|
||||
"reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7",
|
||||
"url": "https://api.github.com/repos/getgrav/parsedown/zipball/10a7ff776c3f16b1b3aa41c176c48150fc091065",
|
||||
"reference": "10a7ff776c3f16b1b3aa41c176c48150fc091065",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
@@ -148,7 +148,6 @@
|
||||
"Parsedown": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@@ -165,7 +164,10 @@
|
||||
"markdown",
|
||||
"parser"
|
||||
],
|
||||
"time": "2015-10-04 16:44:32"
|
||||
"support": {
|
||||
"source": "https://github.com/getgrav/parsedown/tree/master"
|
||||
},
|
||||
"time": "2015-12-17 17:48:21"
|
||||
},
|
||||
{
|
||||
"name": "erusev/parsedown-extra",
|
||||
@@ -1125,9 +1127,18 @@
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"aliases": [
|
||||
{
|
||||
"alias": "1.6.0",
|
||||
"alias_normalized": "1.6.0.0",
|
||||
"version": "9999999-dev",
|
||||
"package": "erusev/parsedown"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {
|
||||
"erusev/parsedown": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
|
||||
@@ -706,8 +706,8 @@ form:
|
||||
help: PLUGIN_ADMIN.CACHE_PERMS_HELP
|
||||
highlight: '0755'
|
||||
options:
|
||||
1: '0755'
|
||||
0: '0775'
|
||||
'0755': '0755'
|
||||
'0775': '0775'
|
||||
|
||||
|
||||
images.debug:
|
||||
|
||||
@@ -168,6 +168,10 @@ zip:
|
||||
type: file
|
||||
thumb: media/thumb-zip.png
|
||||
mime: application/zip
|
||||
7z:
|
||||
type: file
|
||||
thumb: media/thumb-7zip.png
|
||||
mime: application/x-7z-compressed
|
||||
gz:
|
||||
type: file
|
||||
thumb: media/thumb-gz.png
|
||||
|
||||
@@ -97,7 +97,7 @@ debugger:
|
||||
images:
|
||||
default_image_quality: 85 # Default image quality to use when resampling images (85%)
|
||||
cache_all: false # Cache all image by default
|
||||
cache_perms: 0755 # Default cache folder perms. Usually 0755 or 0775 depending on setup
|
||||
cache_perms: '0755' # MUST BE IN QUOTES!! Default cache folder perms. Usually '0755' or '0775'
|
||||
debug: false # Show an overlay over images indicating the pixel depth of the image when working with retina for example
|
||||
|
||||
media:
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
// Some standard defines
|
||||
define('GRAV', true);
|
||||
define('GRAV_VERSION', '1.0.1');
|
||||
define('GRAV_VERSION', '1.0.5');
|
||||
define('DS', '/');
|
||||
define('GRAV_PHP_MIN', '5.5.9');
|
||||
|
||||
// Directories and Paths
|
||||
if (!defined('GRAV_ROOT')) {
|
||||
|
||||
@@ -186,7 +186,7 @@ class Assets
|
||||
$this->base_url = $base_url . '/';
|
||||
|
||||
// Register any preconfigured collections
|
||||
foreach ($config->get('system.assets.collections') as $name => $collection) {
|
||||
foreach ($config->get('system.assets.collections', []) as $name => $collection) {
|
||||
$this->registerCollection($name, (array)$collection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,8 +338,10 @@ class Blueprint implements \ArrayAccess, ExportInterface
|
||||
|
||||
if ($field['type'] === 'list') {
|
||||
// we loop through list to get the actual field
|
||||
foreach($field['fields'] as $subName => &$subField) {
|
||||
$this->parseFormField($subField);
|
||||
if (isset($field['fields']) && $field['fields']) {
|
||||
foreach($field['fields'] as $subName => &$subField) {
|
||||
$this->parseFormField($subField);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->parseFormField($field);
|
||||
|
||||
@@ -283,7 +283,15 @@ class Validation
|
||||
|
||||
protected static function filterFile($value, array $params, array $field)
|
||||
{
|
||||
return (array) $value;
|
||||
if ($field['multiple'] == true) {
|
||||
return (array) $value;
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
return reset($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,7 +107,7 @@ class Debugger
|
||||
|
||||
public function stopTimer($name)
|
||||
{
|
||||
if (isset($this->timers[$name]) && ($name[0] == '_' || $this->grav['config']->get('system.debugger.enabled'))) {
|
||||
if (in_array($name, $this->timers) && ($name[0] == '_' || $this->grav['config']->get('system.debugger.enabled'))) {
|
||||
$this->debugbar['time']->stopMeasure($name);
|
||||
}
|
||||
|
||||
|
||||
@@ -281,6 +281,10 @@ class Installer
|
||||
{
|
||||
$msg = 'Unknown Error';
|
||||
|
||||
if (is_string(self::$error)) {
|
||||
return self::$error;
|
||||
}
|
||||
|
||||
switch (self::$error) {
|
||||
case 0:
|
||||
$msg = 'No Error';
|
||||
@@ -333,7 +337,7 @@ class Installer
|
||||
|
||||
/**
|
||||
* Allows to manually set an error
|
||||
* @param $error the Error code
|
||||
* @param int|string $error the Error code
|
||||
*/
|
||||
|
||||
public static function setError($error)
|
||||
|
||||
@@ -1,22 +1,32 @@
|
||||
<?php
|
||||
namespace Grav\Common\GPM;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
|
||||
/**
|
||||
* Class Upgrader
|
||||
*
|
||||
* @package Grav\Common\GPM
|
||||
*/
|
||||
class Upgrader
|
||||
{
|
||||
/**
|
||||
* Remote details about latest Grav version
|
||||
*
|
||||
* @var Packages
|
||||
*/
|
||||
private $remote;
|
||||
|
||||
/**
|
||||
* Internal cache
|
||||
*
|
||||
* @var Iterator
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* Creates a new GPM instance with Local and Remote packages available
|
||||
*
|
||||
* @param boolean $refresh Applies to Remote Packages only and forces a refetch of data
|
||||
* @param callable $callback Either a function or callback in array notation
|
||||
*/
|
||||
@@ -27,6 +37,7 @@ class Upgrader
|
||||
|
||||
/**
|
||||
* Returns the release date of the latest version of Grav
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getReleaseDate()
|
||||
@@ -36,6 +47,7 @@ class Upgrader
|
||||
|
||||
/**
|
||||
* Returns the version of the installed Grav
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLocalVersion()
|
||||
@@ -45,6 +57,7 @@ class Upgrader
|
||||
|
||||
/**
|
||||
* Returns the version of the remotely available Grav
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRemoteVersion()
|
||||
@@ -54,6 +67,7 @@ class Upgrader
|
||||
|
||||
/**
|
||||
* Returns an array of assets available to download remotely
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAssets()
|
||||
@@ -63,6 +77,7 @@ class Upgrader
|
||||
|
||||
/**
|
||||
* Returns the changelog list for each version of Grav
|
||||
*
|
||||
* @param string $diff the version number to start the diff from
|
||||
*
|
||||
* @return array return the changelog list for each version
|
||||
@@ -72,8 +87,21 @@ class Upgrader
|
||||
return $this->remote->getChangelog($diff);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function meetsRequirements()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, GRAV_PHP_MIN, '<')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the currently installed Grav is upgradable to a newer version
|
||||
*
|
||||
* @return boolean True if it's upgradable, False otherwise.
|
||||
*/
|
||||
public function isUpgradable()
|
||||
@@ -83,6 +111,7 @@ class Upgrader
|
||||
|
||||
/**
|
||||
* Checks if Grav is currently symbolically linked
|
||||
*
|
||||
* @return boolean True if Grav is symlinked, False otherwise.
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace Grav\Common\Markdown;
|
||||
|
||||
use Grav\Common\GravTrait;
|
||||
use Grav\Common\Uri;
|
||||
use RocketTheme\Toolbox\Event\Event;
|
||||
|
||||
/**
|
||||
* A trait to add some custom processing to the identifyLink() method in Parsedown and ParsedownExtra
|
||||
@@ -15,9 +16,11 @@ trait ParsedownGravTrait
|
||||
protected $base_url;
|
||||
protected $pages_dir;
|
||||
protected $special_chars;
|
||||
|
||||
protected $twig_link_regex = '/\!*\[(?:.*)\]\((\{([\{%#])\s*(.*?)\s*(?:\2|\})\})\)/';
|
||||
|
||||
public $completeable_blocks = [];
|
||||
public $continueable_blocks = [];
|
||||
|
||||
/**
|
||||
* Initialization function to setup key variables needed by the MarkdownGravLinkTrait
|
||||
*
|
||||
@@ -26,8 +29,10 @@ trait ParsedownGravTrait
|
||||
*/
|
||||
protected function init($page, $defaults)
|
||||
{
|
||||
$grav = self::getGrav();
|
||||
|
||||
$this->page = $page;
|
||||
$this->pages = self::getGrav()['pages'];
|
||||
$this->pages = $grav['pages'];
|
||||
$this->BlockTypes['{'] [] = "TwigTag";
|
||||
$this->base_url = rtrim(self::getGrav()['base_url'] . self::getGrav()['pages']->base(), '/');
|
||||
$this->pages_dir = self::getGrav()['locator']->findResource('page://');
|
||||
@@ -41,8 +46,67 @@ trait ParsedownGravTrait
|
||||
$this->setUrlsLinked($defaults['auto_url_links']);
|
||||
$this->setMarkupEscaped($defaults['escape_markup']);
|
||||
$this->setSpecialChars($defaults['special_chars']);
|
||||
|
||||
$grav->fireEvent('onMarkdownInitialized', new Event(['markdown' => $this]));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Be able to define a new Block type or override an existing one
|
||||
*
|
||||
* @param $type
|
||||
* @param $tag
|
||||
*/
|
||||
public function addBlockType($type, $tag, $continueable = false, $completeable = false)
|
||||
{
|
||||
$this->BlockTypes[$type] []= $tag;
|
||||
|
||||
if ($continueable) {
|
||||
$this->continueable_blocks[] = $tag;
|
||||
}
|
||||
|
||||
if ($completeable) {
|
||||
$this->completeable_blocks[] = $tag;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Be able to define a new Inline type or override an existing one
|
||||
*
|
||||
* @param $type
|
||||
* @param $tag
|
||||
*/
|
||||
public function addInlineType($type, $tag)
|
||||
{
|
||||
$this->InlineTypes[$type] []= $tag;
|
||||
$this->inlineMarkerList .= $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the default behavior to allow for plugin-provided blocks to be continueable
|
||||
*
|
||||
* @param $Type
|
||||
* @return bool
|
||||
*/
|
||||
protected function isBlockContinueable($Type)
|
||||
{
|
||||
$continueable = in_array($Type, $this->continueable_blocks) || method_exists($this, 'block'.$Type.'Continue');
|
||||
return $continueable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the default behavior to allow for plugin-provided blocks to be completeable
|
||||
*
|
||||
* @param $Type
|
||||
* @return bool
|
||||
*/
|
||||
protected function isBlockCompleteable($Type)
|
||||
{
|
||||
$completeable = in_array($Type, $this->completeable_blocks) || method_exists($this, 'block'.$Type.'Complete');
|
||||
return $completeable;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make the element function publicly accessible, Medium uses this to render from Twig
|
||||
*
|
||||
@@ -73,7 +137,7 @@ trait ParsedownGravTrait
|
||||
*/
|
||||
protected function blockTwigTag($Line)
|
||||
{
|
||||
if (preg_match('/[{%|{{|{#].*[#}|}}|%}]/', $Line['body'], $matches)) {
|
||||
if (preg_match('/(?:{{|{%|{#)(.*)(?:}}|%}|#})/', $Line['body'], $matches)) {
|
||||
$Block = array(
|
||||
'markup' => $Line['body'],
|
||||
);
|
||||
@@ -230,7 +294,7 @@ trait ParsedownGravTrait
|
||||
if ($attrib == 'classes') {
|
||||
$attrib = 'class';
|
||||
}
|
||||
$excerpt['element']['attributes'][$attrib] = $value;
|
||||
$excerpt['element']['attributes'][$attrib] = str_replace(',', ' ', $value);
|
||||
unset($actions[$key]);
|
||||
}
|
||||
}
|
||||
@@ -255,4 +319,16 @@ trait ParsedownGravTrait
|
||||
|
||||
return $excerpt;
|
||||
}
|
||||
|
||||
// For extending this class via plugins
|
||||
public function __call($method, $args)
|
||||
{
|
||||
if (isset($this->$method) === true) {
|
||||
$func = $this->$method;
|
||||
return call_user_func_array($func, $args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@ class ImageFile extends Image
|
||||
|
||||
// Asking the cache for the cacheFile
|
||||
try {
|
||||
$perms = octdec(self::getGrav()['config']->get('system.images.cache_perms', '0755'));
|
||||
$perms = self::getGrav()['config']->get('system.images.cache_perms', '0755');
|
||||
$perms = octdec($perms);
|
||||
$file = $this->cache->setDirectoryMode($perms)->getOrCreateFile($cacheFile, $conditions, $generate, $actual);
|
||||
} catch (GenerationError $e) {
|
||||
$file = $e->getNewFile();
|
||||
|
||||
@@ -6,6 +6,7 @@ use Grav\Common\Page\Page;
|
||||
use Grav\Common\Config\Config;
|
||||
use RocketTheme\Toolbox\Event\EventDispatcher;
|
||||
use RocketTheme\Toolbox\Event\EventSubscriberInterface;
|
||||
use RocketTheme\Toolbox\File\YamlFile;
|
||||
|
||||
/**
|
||||
* The Plugin object just holds the id and path to a plugin.
|
||||
@@ -182,4 +183,26 @@ class Plugin implements EventSubscriberInterface
|
||||
// Return configurations as a new data config class
|
||||
return new Data($header);
|
||||
}
|
||||
|
||||
/**
|
||||
* Persists to disk the plugin parameters currently stored in the Grav Config object
|
||||
*
|
||||
* @param string $plugin_name The name of the plugin whose config it should store.
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
public static function saveConfig($plugin_name) {
|
||||
if (!$plugin_name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$locator = Grav::instance()['locator'];
|
||||
$filename = 'config://plugins/' . $plugin_name . '.yaml';
|
||||
$file = YamlFile::instance($locator->findResource($filename, true, true));
|
||||
$content = Grav::instance()['config']->get('plugins.' . $plugin_name);
|
||||
$file->save($content);
|
||||
$file->free();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,10 +108,45 @@ class ConfigServiceProvider implements ServiceProviderInterface
|
||||
$files += (new ConfigFileFinder)->locateFiles($paths);
|
||||
$paths = $locator->findResources('plugins://');
|
||||
$files += (new ConfigFileFinder)->setBase('plugins')->locateInFolders($paths, 'languages');
|
||||
$paths = static::pluginFolderPaths($paths, 'languages');
|
||||
$files += (new ConfigFileFinder)->locateFiles($paths);
|
||||
}
|
||||
|
||||
$languages = new CompiledLanguages($cache, $files, GRAV_ROOT);
|
||||
|
||||
return $languages->name("master-{$setup->environment}")->load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find specific paths in plugins
|
||||
*
|
||||
* @param $plugins
|
||||
* @param $folder_path
|
||||
* @return array
|
||||
*/
|
||||
private static function pluginFolderPaths($plugins, $folder_path)
|
||||
{
|
||||
$paths = [];
|
||||
|
||||
foreach ($plugins as $path) {
|
||||
$iterator = new \DirectoryIterator($path);
|
||||
|
||||
/** @var \DirectoryIterator $directory */
|
||||
foreach ($iterator as $directory) {
|
||||
if (!$directory->isDir() || $directory->isDot()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Path to the languages folder
|
||||
$lang_path = $directory->getPathName() . '/' . $folder_path;
|
||||
|
||||
// If this folder exists, add it to the list of paths
|
||||
if (file_exists($lang_path)) {
|
||||
$paths []= $lang_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@ trait WriteCacheFileTrait
|
||||
*/
|
||||
protected function writeCacheFile($file, $content)
|
||||
{
|
||||
if (empty($file)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset(self::$umask)) {
|
||||
self::$umask = self::getGrav()['config']->get('system.twig.umask_fix', false);
|
||||
}
|
||||
|
||||
@@ -2,14 +2,24 @@
|
||||
namespace Grav\Console\Cli;
|
||||
|
||||
use Grav\Common\Filesystem\Folder;
|
||||
use Grav\Console\ConsoleCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
|
||||
/**
|
||||
* Class CleanCommand
|
||||
* @package Grav\Console\Cli
|
||||
*/
|
||||
class CleanCommand extends ConsoleCommand
|
||||
class CleanCommand extends Command
|
||||
{
|
||||
/* @var InputInterface $output */
|
||||
protected $input;
|
||||
|
||||
/* @var OutputInterface $output */
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
@@ -83,7 +93,7 @@ class CleanCommand extends ConsoleCommand
|
||||
'vendor/maximebf/debugbar/bower.json',
|
||||
'vendor/maximebf/debugbar/composer.json',
|
||||
'vendor/maximebf/debugbar/.bowerrc',
|
||||
'vendor/maximebf/debugbar/src/Debugbar/Resources/vendor',
|
||||
'vendor/maximebf/debugbar/src/DebugBar/Resources/vendor',
|
||||
'vendor/maximebf/debugbar/demo',
|
||||
'vendor/maximebf/debugbar/docs',
|
||||
'vendor/maximebf/debugbar/tests',
|
||||
@@ -174,8 +184,10 @@ class CleanCommand extends ConsoleCommand
|
||||
/**
|
||||
* @return int|null|void
|
||||
*/
|
||||
protected function serve()
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->setupConsole($input, $output);
|
||||
|
||||
$this->cleanPaths();
|
||||
}
|
||||
|
||||
@@ -183,12 +195,9 @@ class CleanCommand extends ConsoleCommand
|
||||
{
|
||||
$this->output->writeln('');
|
||||
$this->output->writeln('<red>DELETING</red>');
|
||||
|
||||
$anything = false;
|
||||
|
||||
foreach ($this->paths_to_remove as $path) {
|
||||
$path = ROOT_DIR . $path;
|
||||
|
||||
if (is_dir($path) && @Folder::delete($path)) {
|
||||
$anything = true;
|
||||
$this->output->writeln('<red>dir: </red>' . $path);
|
||||
@@ -197,12 +206,30 @@ class CleanCommand extends ConsoleCommand
|
||||
$this->output->writeln('<red>file: </red>' . $path);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$anything) {
|
||||
$this->output->writeln('');
|
||||
$this->output->writeln('<green>Nothing to clean...</green>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set colors style definition for the formatter.
|
||||
*
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
*/
|
||||
public function setupConsole(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->input = $input;
|
||||
$this->output = $output;
|
||||
|
||||
$this->output->getFormatter()->setStyle('normal', new OutputFormatterStyle('white'));
|
||||
$this->output->getFormatter()->setStyle('yellow', new OutputFormatterStyle('yellow', null, array('bold')));
|
||||
$this->output->getFormatter()->setStyle('red', new OutputFormatterStyle('red', null, array('bold')));
|
||||
$this->output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan', null, array('bold')));
|
||||
$this->output->getFormatter()->setStyle('green', new OutputFormatterStyle('green', null, array('bold')));
|
||||
$this->output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta', null, array('bold')));
|
||||
$this->output->getFormatter()->setStyle('white', new OutputFormatterStyle('white', null, array('bold')));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ class SandboxCommand extends ConsoleCommand
|
||||
$to = $this->destination . $target;
|
||||
|
||||
$this->output->writeln(' <cyan>' . $source . '</cyan> <comment>-></comment> ' . $to);
|
||||
Folder::rcopy($from, $to);
|
||||
@Folder::rcopy($from, $to);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,18 @@ class SelfupgradeCommand extends ConsoleCommand
|
||||
$remote = $this->upgrader->getRemoteVersion();
|
||||
$release = strftime('%c', strtotime($this->upgrader->getReleaseDate()));
|
||||
|
||||
if (!$this->upgrader->meetsRequirements()) {
|
||||
$this->output->writeln("");
|
||||
$this->output->writeln("<red>ATTENTION:</red>");
|
||||
$this->output->writeln(" Grav has increased the minimum PHP requirement.");
|
||||
$this->output->writeln(" You are currently running PHP <red>" . PHP_VERSION . "</red>, but PHP <green>" . GRAV_PHP_MIN . "</green> is required.");
|
||||
$this->output->writeln(" Additional information: <white>http://getgrav.org/blog/changing-php-requirements-to-5.5</white>");
|
||||
$this->output->writeln("");
|
||||
$this->output->writeln("Selfupgrade aborted.");
|
||||
$this->output->writeln("");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!$this->upgrader->isUpgradable()) {
|
||||
$this->output->writeln("You are already running the latest version of Grav (v" . $local . ") released on " . $release);
|
||||
exit;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
namespace Grav;
|
||||
|
||||
|
||||
class TestCase extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
date_default_timezone_set(@date_default_timezone_get());
|
||||
require_once __DIR__.'/../../vendor/autoload.php';
|
||||
require_once __DIR__.'/Grav/TestCase.php';
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
bootstrap="./bootstrap.php"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Full Grav Test Suite">
|
||||
<directory>./Grav/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
Reference in New Issue
Block a user