mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-06 04:37:08 +02:00
Lint
This commit is contained in:
@@ -24,6 +24,7 @@ class Gpm
|
||||
if (!static::$GPM) {
|
||||
static::$GPM = new GravGPM();
|
||||
}
|
||||
|
||||
return static::$GPM;
|
||||
}
|
||||
|
||||
@@ -42,7 +43,8 @@ class Gpm
|
||||
|
||||
/**
|
||||
* @param Package[]|string[]|string $packages
|
||||
* @param array $options
|
||||
* @param array $options
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function install($packages, array $options)
|
||||
@@ -56,7 +58,7 @@ class Gpm
|
||||
return false;
|
||||
}
|
||||
|
||||
$packages = is_array($packages) ? $packages : [ $packages ];
|
||||
$packages = is_array($packages) ? $packages : [$packages];
|
||||
$count = count($packages);
|
||||
|
||||
$packages = array_filter(array_map(function ($p) {
|
||||
@@ -91,7 +93,8 @@ class Gpm
|
||||
|
||||
$local = static::download($package);
|
||||
|
||||
Installer::install($local, $options['destination'], ['install_path' => $package->install_path, 'theme' => $options['theme']]);
|
||||
Installer::install($local, $options['destination'],
|
||||
['install_path' => $package->install_path, 'theme' => $options['theme']]);
|
||||
Folder::delete(dirname($local));
|
||||
|
||||
$errorCode = Installer::lastErrorCode();
|
||||
@@ -115,7 +118,8 @@ class Gpm
|
||||
|
||||
/**
|
||||
* @param Package[]|string[]|string $packages
|
||||
* @param array $options
|
||||
* @param array $options
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update($packages, array $options)
|
||||
@@ -127,14 +131,15 @@ class Gpm
|
||||
|
||||
/**
|
||||
* @param Package[]|string[]|string $packages
|
||||
* @param array $options
|
||||
* @param array $options
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function uninstall($packages, array $options)
|
||||
{
|
||||
$options = array_merge(self::$options, $options);
|
||||
|
||||
$packages = is_array($packages) ? $packages : [ $packages ];
|
||||
$packages = is_array($packages) ? $packages : [$packages];
|
||||
$count = count($packages);
|
||||
|
||||
$packages = array_filter(array_map(function ($p) {
|
||||
@@ -185,6 +190,7 @@ class Gpm
|
||||
|
||||
/**
|
||||
* @param Package $package
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function download(Package $package)
|
||||
@@ -203,8 +209,9 @@ class Gpm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $package
|
||||
* @param array $package
|
||||
* @param string $tmp
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function _downloadSelfupgrade(array $package, $tmp)
|
||||
@@ -212,6 +219,7 @@ class Gpm
|
||||
$output = Response::get($package['download'], []);
|
||||
Folder::mkdir($tmp);
|
||||
file_put_contents($tmp . DS . $package['name'], $output);
|
||||
|
||||
return $tmp . DS . $package['name'];
|
||||
}
|
||||
|
||||
@@ -228,17 +236,19 @@ class Gpm
|
||||
|
||||
if (is_link(GRAV_ROOT . DS . 'index.php')) {
|
||||
Installer::setError(Installer::IS_LINK);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (method_exists($upgrader, 'meetsRequirements') && !$upgrader->meetsRequirements()) {
|
||||
$error = [];
|
||||
$error[] = '<p>Grav has increased the minimum PHP requirement.<br />';
|
||||
$error[] = 'You are currently running PHP <strong>' . PHP_VERSION .'</strong>';
|
||||
$error[] = ', but PHP <strong>' . GRAV_PHP_MIN .'</strong> is required.</p>';
|
||||
$error[] = 'You are currently running PHP <strong>' . PHP_VERSION . '</strong>';
|
||||
$error[] = ', but PHP <strong>' . GRAV_PHP_MIN . '</strong> is required.</p>';
|
||||
$error[] = '<p><a href="http://getgrav.org/blog/changing-php-requirements-to-5.5" class="button button-small secondary">Additional information</a></p>';
|
||||
|
||||
Installer::setError(implode("\n", $error));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user