本文整理汇总了PHP中Mage_Connect_Package::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Connect_Package::save方法的具体用法?PHP Mage_Connect_Package::save怎么用?PHP Mage_Connect_Package::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Connect_Package
的用法示例。
在下文中一共展示了Mage_Connect_Package::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->stepHook('pre');
//Load Magento core
$mageFile = realpath(getcwd() . '/../../app/Mage.php');
if (!@(include_once $mageFile)) {
throw new \Exception('Can\'t find Mage.php. Are you running this from your `.modman` directory?');
} else {
require_once $mageFile;
}
//Boilerplate
umask(0);
\Mage::app();
$output->write('Generating XML... ');
// Generate a package XML file from our template and modman file
$packageXmlFile = $this->_generatePackageXmlFile($input->getOption('package-template-xml-file'), $input->getOption('modman-file'));
$packageXmlFile = getcwd() . '/' . $packageXmlFile;
$output->writeln('<info>Done.</info>');
//Build package
$output->write('Building package... ');
chdir('../../');
$package = new \Mage_Connect_Package($packageXmlFile);
$package->save($input->getOption('output-directory'));
$output->writeln('<info>Done.</info>');
$this->stepHook('post');
}
示例2: doPackage
/**
* Package command callback
* @param string $command
* @param array $options
* @param array $params
* @return void
*/
public function doPackage($command, $options, $params)
{
$this->cleanupParams($params);
if (count($params) < 1) {
return $this->doError($command, "Parameters count should be >= 1");
}
$file = strtolower($params[0]);
$file = realpath($file);
if (!file_exists($file)) {
return $this->doError($command, "File {$params[0]} doesn't exist");
}
try {
$packager = new Mage_Connect_Package($file);
$res = $packager->validate();
if (!$res) {
$this->doError($command, implode("\n", $packager->getErrors()));
return;
}
$packager->save(dirname($file));
$this->ui()->output('Done building package');
} catch (Exception $e) {
$this->doError($command, $e->getMessage());
}
}