Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marketplace improvements #10737

Merged
merged 29 commits into from
Oct 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
01911a3
Marketplace updates
tsteur Oct 13, 2016
67624e4
fix some tests
tsteur Oct 13, 2016
f5432b9
fix typo
tsteur Oct 13, 2016
702bd3c
fix some more ui tests
tsteur Oct 13, 2016
a497b37
fix some tests
tsteur Oct 13, 2016
94783d8
Updated submodules to latest 2.x-dev tip
mattab Oct 20, 2016
c1e7010
Marketplace improvements will be in 2.17.0-b2
mattab Oct 20, 2016
68eafc1
UI tests: no link on Gpl license
mattab Oct 20, 2016
2073fe0
Merge branch 'updated_submodules' into pluginsmarketplace
mattab Oct 20, 2016
2fd58f7
license key, and link on premium plugins
mattab Oct 21, 2016
f1aa6b8
Show button on premium plugins not activated yet
mattab Oct 21, 2016
2cc2e14
Minor tweaks to some labels in the UI
mattab Oct 21, 2016
5e01fd5
make sure plugin updates are shown in menu
tsteur Oct 20, 2016
611fc6d
we do not count anonymous user as a user when assessing number of aut…
mattab Oct 21, 2016
2583fdb
integration tests expected strings
mattab Oct 21, 2016
8897611
integration tests expected strings
mattab Oct 21, 2016
da063f9
Delete this file as it fails the test for some unknown reasons ping @…
mattab Oct 21, 2016
01dc76d
UI screenshots after marketplace tweaks & one fix
mattab Oct 21, 2016
b0a4724
consistent bold in CTA link
mattab Oct 21, 2016
7bb192e
Merge remote-tracking branch 'origin/2.x-dev' into pluginsmarketplace
mattab Oct 21, 2016
cb68955
UI tests
mattab Oct 22, 2016
218f3d7
unused string
mattab Oct 22, 2016
407f76b
gst -> tax
mattab Oct 22, 2016
ea2b709
minor tweak
mattab Oct 22, 2016
efe842a
do not show example link so SU don't delete license in one click by m…
mattab Oct 22, 2016
0e9dd01
api description
mattab Oct 22, 2016
598ec31
minor tweaks
mattab Oct 22, 2016
eaa948a
add link to FAQ in footer
mattab Oct 22, 2016
333fb48
italic is not allowed ;-)
mattab Oct 22, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ The folder containing expected screenshots was renamed from `expected-ui-screens
* Tracking API: by default, when tracking a Page URL, Piwik will now remove the URL query string parameter `sid` if it is found.
* In the JavaScript tracker, the function `setDomains` will not anymore attempt to set a cookie path. Learn more about [configuring the tracker correctly](http://developer.piwik.org/guides/tracking-javascript-guide#tracking-one-domain) when tracking one or several domains and/or paths.

## Piwik 2.16.1

### Internal change
* The setting `[General]enable_marketplace=0/1` was removed, instead the new plugin Marketplace can be disabled/enabled. The updater should automatically migrate an existing setting.

## Piwik 2.16.0

### New features
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"piwik/referrer-spam-blacklist": "~1.0",
"piwik/searchengine-and-social-list": "~1.0",
"tecnickcom/tcpdf": "~6.0",
"piwik/piwik-php-tracker": "^1.0"
"piwik/piwik-php-tracker": "^1.0",
"composer/semver": "~1.3.0"
},
"require-dev": {
"aws/aws-sdk-php": "2.7.1",
Expand Down
68 changes: 65 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions config/global.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,12 @@
; set the HTTPS environment variable.
assume_secure_protocol = 0

; Set to 1 if you're using more than one server for your Piwik installation. For example if you are using Piwik in a
; load balanced environment, if you have configured failover or if you're just using multiple servers in general.
; By enabling this flag we will for example not allow the installation of a plugin via the UI as a plugin would be only
; installed on one server or a config one change would be only made on one server instead of all servers.
multi_server_environment = 0

; List of proxy headers for client IP addresses
;
; CloudFlare (CF-Connecting-IP)
Expand Down Expand Up @@ -526,14 +532,9 @@
; This may for example be useful when doing Mysql AWS replication
enable_load_data_infile = 1

; By setting this option to 0, you can disable the Piwik marketplace. This is useful to prevent giving the Super user
; the access to disk and install custom PHP code (Piwik plugins).
enable_marketplace = 1

; By setting this option to 0:
; - links to Enable/Disable/Uninstall plugins will be hidden and disabled
; - links to Uninstall themes will be disabled (but user can still enable/disable themes)
; - as well as disabling plugins admin actions (such as "Upload new plugin"), setting this to 1 will have same effect as setting enable_marketplace=1
enable_plugins_admin = 1

; By setting this option to 0, you can prevent Super User from editing the Geolocation settings.
Expand Down Expand Up @@ -805,6 +806,7 @@
Plugins[] = DevicePlugins
Plugins[] = Heartbeat
Plugins[] = Intl
Plugins[] = Marketplace
Plugins[] = ProfessionalServices
Plugins[] = UserId
Plugins[] = CustomPiwikJs
Expand Down
2 changes: 2 additions & 0 deletions core/API/DocumentationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ public function getExampleUrl($class, $methodName, $parametersToSet = array())
'addGoal',
'updateGoal',
'deleteGoal',
//Marketplace
'deleteLicenseKey'
);

if (in_array($methodName, $doNotPrintExampleForTheseMethods)) {
Expand Down
15 changes: 11 additions & 4 deletions core/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,24 @@ public static function sendHttpRequest($aUrl,
$httpPassword = null)
{
// create output file
$file = null;
$file = self::ensureDestinationDirectoryExists($destinationPath);

$acceptLanguage = $acceptLanguage ? 'Accept-Language: ' . $acceptLanguage : '';
return self::sendHttpRequestBy(self::getTransportMethod(), $aUrl, $timeout, $userAgent, $destinationPath, $file, $followDepth, $acceptLanguage, $acceptInvalidSslCertificate = false, $byteRange, $getExtendedInfo, $httpMethod, $httpUsername, $httpPassword);
}

public static function ensureDestinationDirectoryExists($destinationPath)
{
if ($destinationPath) {
// Ensure destination directory exists
Filesystem::mkdir(dirname($destinationPath));
if (($file = @fopen($destinationPath, 'wb')) === false || !is_resource($file)) {
throw new Exception('Error while creating the file: ' . $destinationPath);
}

return $file;
}

$acceptLanguage = $acceptLanguage ? 'Accept-Language: ' . $acceptLanguage : '';
return self::sendHttpRequestBy(self::getTransportMethod(), $aUrl, $timeout, $userAgent, $destinationPath, $file, $followDepth, $acceptLanguage, $acceptInvalidSslCertificate = false, $byteRange, $getExtendedInfo, $httpMethod, $httpUsername, $httpPassword);
return null;
}

/**
Expand Down
7 changes: 7 additions & 0 deletions core/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ class Notification
*/
const FLAG_NO_CLEAR = 1;

/**
* If this flag is applied, a close icon will be displayed.
*
* See {@link $flags}.
*/
const FLAG_CLEAR = 0;

/**
* Notifications of this type will be displayed for a few seconds and then faded out.
*/
Expand Down
2 changes: 1 addition & 1 deletion core/Notification/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private static function removeOldestNotificationsIfThereAreTooMany()
if (!self::isSessionEnabled()) {
return;
}

$maxNotificationsInSession = 30;

$session = static::getSession();
Expand Down
47 changes: 47 additions & 0 deletions core/Plugin/ControllerAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@

use Piwik\Config as PiwikConfig;
use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\Development;
use Piwik\Menu\MenuAdmin;
use Piwik\Menu\MenuTop;
use Piwik\Menu\MenuUser;
use Piwik\Notification;
use Piwik\Notification\Manager as NotificationManager;
use Piwik\Piwik;
use Piwik\Plugins\Marketplace\Marketplace;
use Piwik\Tracker\TrackerConfig;
use Piwik\Url;
use Piwik\Version;
Expand All @@ -41,6 +43,50 @@ private static function notifyWhenTrackingStatisticsDisabled()
}
}

private static function notifyAnyInvalidLicense()
{
if (!Marketplace::isMarketplaceEnabled()) {
return;
}

if (Piwik::isUserIsAnonymous()) {
return;
}

if (!Piwik::isUserHasSomeAdminAccess()) {
return;
}

$expired = StaticContainer::get('Piwik\Plugins\Marketplace\Plugins\InvalidLicenses');

$messageLicenseMissing = $expired->getMessageNoLicense();
if (!empty($messageLicenseMissing)) {
$notification = new Notification($messageLicenseMissing);
$notification->raw = true;
$notification->context = Notification::CONTEXT_ERROR;
$notification->title = Piwik::translate('Marketplace_LicenseMissing');
Notification\Manager::notify('ControllerAdmin_LicenseMissingWarning', $notification);
}

$messageExceeded = $expired->getMessageExceededLicenses();
if (!empty($messageExceeded)) {
$notification = new Notification($messageExceeded);
$notification->raw = true;
$notification->context = Notification::CONTEXT_WARNING;
$notification->title = Piwik::translate('Marketplace_LicenseExceeded');
Notification\Manager::notify('ControllerAdmin_LicenseExceededWarning', $notification);
}

$messageExpired = $expired->getMessageExpiredLicenses();
if (!empty($messageExpired)) {
$notification = new Notification($messageExpired);
$notification->raw = true;
$notification->context = Notification::CONTEXT_WARNING;
$notification->title = Piwik::translate('Marketplace_LicenseExpired');
Notification\Manager::notify('ControllerAdmin_LicenseExpiredWarning', $notification);
}
}

private static function notifyAnyInvalidPlugin()
{
$missingPlugins = \Piwik\Plugin\Manager::getInstance()->getMissingPlugins();
Expand Down Expand Up @@ -276,6 +322,7 @@ public static function setBasicVariablesAdminView(View $view)

$view->isSuperUser = Piwik::hasUserSuperUserAccess();

self::notifyAnyInvalidLicense();
self::notifyAnyInvalidPlugin();
self::notifyWhenPhpVersionIsEOL();
self::notifyWhenPhpVersionIsNotCompatibleWithNextMajorPiwik();
Expand Down