Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2015-12-10 00:50:07 +0300
committerThomas Steur <thomas.steur@gmail.com>2015-12-10 00:50:07 +0300
commitebced800c0184f5ce93663afab6b0337c3755cbb (patch)
treefb26c2506d37586ff0d38fb902d63d17701bd883 /plugins/CoreConsole
parent3d26af780d8fe0e4f7c5824a88b95c4a0d0d25d7 (diff)
parentdb36ca384809ea36457a465a3b6d1ecf951b0e26 (diff)
Merge master into "3.0"
Conflicts: .travis.yml CHANGELOG.md core/Plugin/ControllerAdmin.php core/Version.php core/testMinimumPhpVersion.php plugins/API/API.php plugins/Actions/Reports/GetPageUrls.php plugins/AnonymousPiwikUsageMeasurement plugins/CoreHome/CoreHome.php plugins/CoreHome/templates/_menu.twig plugins/CoreVisualizations/javascripts/jqplotEvolutionGraph.js plugins/CustomVariables/tests/System/expected/test_CustomVariablesSystemTest__CustomVariables.getCustomVariables_day.xml plugins/Goals/Controller.php tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php tests/PHPUnit/Integration/Plugin/ManagerTest.php tests/PHPUnit/System/expected/test_FlattenReports__CustomVariables.getCustomVariables_day.xml tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getSegmentsMetadata.xml tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__CustomVariables.getCustomVariables_range.xml tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__CustomVariables.getCustomVariables_range.xml tests/PHPUnit/System/expected/test_reportLimiting__CustomVariables.getCustomVariables_day.xml tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__CustomVariables.getCustomVariables_day.xml tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_day.xml tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_week.xml tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_day.xml tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_week.xml tests/UI/expected-ui-screenshots tests/UI/specs/Overlay_spec.js tests/UI/specs/UIIntegration_spec.js
Diffstat (limited to 'plugins/CoreConsole')
-rw-r--r--plugins/CoreConsole/Commands/GenerateArchiver.php2
-rw-r--r--plugins/CoreConsole/Commands/GeneratePlugin.php16
-rw-r--r--plugins/CoreConsole/Commands/GeneratePluginBase.php4
3 files changed, 13 insertions, 9 deletions
diff --git a/plugins/CoreConsole/Commands/GenerateArchiver.php b/plugins/CoreConsole/Commands/GenerateArchiver.php
index bbbdb85dfc..29bcee7bb6 100644
--- a/plugins/CoreConsole/Commands/GenerateArchiver.php
+++ b/plugins/CoreConsole/Commands/GenerateArchiver.php
@@ -30,7 +30,7 @@ class GenerateArchiver extends GeneratePluginBase
$this->checkAndUpdateRequiredPiwikVersion($pluginName, $output);
$exampleFolder = PIWIK_INCLUDE_PATH . '/plugins/ExamplePlugin';
- $replace = array('ExamplePlugin' => ucfirst($pluginName), 'EXAMPLEPLUGIN' => strtoupper($pluginName));
+ $replace = array('ExamplePlugin' => $pluginName, 'EXAMPLEPLUGIN' => strtoupper($pluginName));
$whitelistFiles = array('/Archiver.php');
$this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
diff --git a/plugins/CoreConsole/Commands/GeneratePlugin.php b/plugins/CoreConsole/Commands/GeneratePlugin.php
index c42d7a619b..bf83889305 100644
--- a/plugins/CoreConsole/Commands/GeneratePlugin.php
+++ b/plugins/CoreConsole/Commands/GeneratePlugin.php
@@ -12,6 +12,7 @@ namespace Piwik\Plugins\CoreConsole\Commands;
use Piwik\Filesystem;
use Piwik\Plugins\ExamplePlugin\ExamplePlugin;
use Piwik\Version;
+use Piwik\Plugin;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -28,7 +29,8 @@ class GeneratePlugin extends GeneratePluginBase
->setDescription('Generates a new plugin/theme including all needed files')
->addOption('name', null, InputOption::VALUE_REQUIRED, 'Plugin name ([a-Z0-9_-])')
->addOption('description', null, InputOption::VALUE_REQUIRED, 'Plugin description, max 150 characters')
- ->addOption('pluginversion', null, InputOption::VALUE_OPTIONAL, 'Plugin version');
+ ->addOption('pluginversion', null, InputOption::VALUE_OPTIONAL, 'Plugin version')
+ ->addOption('overwrite', null, InputOption::VALUE_NONE, 'Generate even if plugin directory already exists.');
}
protected function execute(InputInterface $input, OutputInterface $output)
@@ -115,20 +117,24 @@ class GeneratePlugin extends GeneratePluginBase
*/
protected function getPluginName(InputInterface $input, OutputInterface $output)
{
+ $overwrite = $input->getOption('overwrite');
+
$self = $this;
- $validate = function ($pluginName) use ($self) {
+ $validate = function ($pluginName) use ($self, $overwrite) {
if (empty($pluginName)) {
throw new \RuntimeException('You have to enter a plugin name');
}
- if (!Filesystem::isValidFilename($pluginName)) {
- throw new \RuntimeException(sprintf('The plugin name %s is not valid', $pluginName));
+ if (!Plugin\Manager::getInstance()->isValidPluginName($pluginName)) {
+ throw new \RuntimeException(sprintf('The plugin name %s is not valid. The name must start with a letter and is only allowed to contain numbers and letters.', $pluginName));
}
$pluginPath = $self->getPluginPath($pluginName);
- if (file_exists($pluginPath)) {
+ if (file_exists($pluginPath)
+ && !$overwrite
+ ) {
throw new \RuntimeException('A plugin with this name already exists');
}
diff --git a/plugins/CoreConsole/Commands/GeneratePluginBase.php b/plugins/CoreConsole/Commands/GeneratePluginBase.php
index c3fce493dc..9012839943 100644
--- a/plugins/CoreConsole/Commands/GeneratePluginBase.php
+++ b/plugins/CoreConsole/Commands/GeneratePluginBase.php
@@ -31,7 +31,7 @@ abstract class GeneratePluginBase extends ConsoleCommand
private function getRelativePluginPath($pluginName)
{
- return '/plugins/' . ucfirst($pluginName);
+ return '/plugins/' . $pluginName;
}
private function createFolderWithinPluginIfNotExists($pluginNameOrCore, $folder)
@@ -325,8 +325,6 @@ abstract class GeneratePluginBase extends ConsoleCommand
$validate($pluginName);
}
- $pluginName = ucfirst($pluginName);
-
return $pluginName;
}