HOR-3663
This commit is contained in:
committed by
David Callizaya
parent
43b59af8f1
commit
1ea440e2df
@@ -491,7 +491,8 @@ function addTarFolder($tar, $pathBase, $pluginHome) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_pack_plugin($task, $args) {
|
function run_pack_plugin($task, $args)
|
||||||
|
{
|
||||||
ini_set('display_errors', 'on');
|
ini_set('display_errors', 'on');
|
||||||
ini_set('error_reporting', E_ERROR);
|
ini_set('error_reporting', E_ERROR);
|
||||||
|
|
||||||
@@ -499,29 +500,33 @@ function run_pack_plugin($task, $args) {
|
|||||||
define('G_ENVIRONMENT', G_DEV_ENV);
|
define('G_ENVIRONMENT', G_DEV_ENV);
|
||||||
|
|
||||||
//the plugin name in the first argument
|
//the plugin name in the first argument
|
||||||
if( ! isset($args[0]) ) {
|
if (!isset($args[0])) {
|
||||||
printf("Error: %s\n", pakeColor::colorize('you must specify a valid name for the plugin', 'ERROR'));
|
printf("Error: %s\n", pakeColor::colorize('you must specify a valid name for the plugin', 'ERROR'));
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
$pluginName = $args[0];
|
$pluginName = $args[0];
|
||||||
|
|
||||||
$pluginDirectory = PATH_PLUGINS . $pluginName;
|
|
||||||
$pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
|
|
||||||
$pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
|
$pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
|
||||||
|
|
||||||
//verify if plugin exists,
|
//verify if plugin exists,
|
||||||
$pluginClassFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'class.' . $pluginName . '.php';
|
$pluginClassFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'class.' . $pluginName . '.php';
|
||||||
$pluginFilename = PATH_PLUGINS . $pluginName . '.php';
|
$pluginFilename = PATH_PLUGINS . $pluginName . '.php';
|
||||||
if( ! is_file($pluginClassFilename) ) {
|
if (!is_file($pluginClassFilename)) {
|
||||||
printf("The plugin %s does not exist in this file %s \n", pakeColor::colorize($pluginName, 'ERROR'), pakeColor::colorize($pluginClassFilename, 'INFO'));
|
printf("The plugin %s does not exist in this file %s \n", pakeColor::colorize($pluginName, 'ERROR'), pakeColor::colorize($pluginClassFilename, 'INFO'));
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once ($pluginFilename);
|
if (!file_exists($pluginFilename)) {
|
||||||
|
printf("Error: %s\n", pakeColor::colorize('you must specify a valid name for the plugin', 'ERROR'));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
if (preg_match_all('/->iVersion(.*)=(.*);/i', file_get_contents($pluginFilename), $result)) {
|
||||||
$pluginDetail = $oPluginRegistry->getPluginDetails($pluginName . '.php');
|
$version = trim($result[2][0], ' "');
|
||||||
$fileTar = $pluginHome . PATH_SEP . $pluginName . '-' . $pluginDetail->iVersion . '.tar';
|
} else {
|
||||||
|
$version = 1;
|
||||||
|
}
|
||||||
|
$fileTar = $pluginHome . PATH_SEP . $pluginName . '-' . $version . '.tar';
|
||||||
|
|
||||||
$tar = new Archive_Tar($fileTar);
|
$tar = new Archive_Tar($fileTar);
|
||||||
$tar->_compress = false;
|
$tar->_compress = false;
|
||||||
@@ -531,7 +536,7 @@ function run_pack_plugin($task, $args) {
|
|||||||
addTarFolder($tar, $pathBase, $pluginHome);
|
addTarFolder($tar, $pathBase, $pluginHome);
|
||||||
$aFiles = $tar->listContent();
|
$aFiles = $tar->listContent();
|
||||||
|
|
||||||
foreach( $aFiles as $key => $val ) {
|
foreach ($aFiles as $key => $val) {
|
||||||
printf(" %6d %s \n", $val['size'], pakeColor::colorize($val['filename'], 'INFO'));
|
printf(" %6d %s \n", $val['size'], pakeColor::colorize($val['filename'], 'INFO'));
|
||||||
}
|
}
|
||||||
printf("File created in %s \n", pakeColor::colorize($fileTar, 'INFO'));
|
printf("File created in %s \n", pakeColor::colorize($fileTar, 'INFO'));
|
||||||
|
|||||||
Reference in New Issue
Block a user