本文整理汇总了PHP中Varien_Pear类的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Pear类的具体用法?PHP Varien_Pear怎么用?PHP Varien_Pear使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Varien_Pear类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: checkDownloads
public function checkDownloads()
{
$pear = new Varien_Pear();
$pkg = new PEAR_PackageFile($pear->getConfig(), false);
$result = true;
foreach ($this->getPackages() as $package) {
$obj = $pkg->fromAnyFile($package, PEAR_VALIDATE_NORMAL);
if (PEAR::isError($obj)) {
$uinfo = $obj->getUserInfo();
if (is_array($uinfo)) {
foreach ($uinfo as $message) {
if (is_array($message)) {
$message = $message['message'];
}
Mage::getSingleton('Mage_Install_Model_Session')->addError($message);
}
} else {
print_r($obj->getUserInfo());
#Mage::getSingleton('Mage_Install_Model_Session')->addError($message);
}
$result = false;
}
}
return $result;
}
开发者ID:relue,项目名称:magento2,代码行数:25,代码来源:Pear.php
示例2: outputAction
public function outputAction()
{
$pear = Varien_Pear::getInstance();
$input = $this->getRequest()->getParam('argv');
$argv = preg_split('#\\s+#', $input);
$command = false;
$options = array();
$params = array();
foreach ($argv as $arg) {
if ($arg[0] === '-') {
$opt = '';
if ($arg[1] === '-') {
$opt = substr($arg, 2);
}
if ($opt) {
$options[$opt] = 1;
}
} elseif (empty($command)) {
$command = $arg;
} else {
$params[] = $arg;
}
}
$run = new Varien_Object();
if ($command) {
$run->setComment(Mage::helper('adminhtml')->__('Running:') . ' "' . $input . '"' . "\r\n\r\n");
$run->setCommand($command);
$run->setOptions($options);
$run->setParams($params);
} else {
$run->setComment(Mage::helper('adminhtml')->__('Invalid input:') . ' "' . $input . '"' . "\r\n\r\n");
}
$pear->runHtmlConsole($run);
}
开发者ID:arslbbt,项目名称:mangentovies,代码行数:34,代码来源:ConsoleController.php
示例3: initForm
public function initForm()
{
$pear = Varien_Pear::getInstance();
$form = new Varien_Data_Form();
$fieldset = $form->addFieldset('cache_enable', array('legend' => AO::helper('adminhtml')->__('PEAR config')));
$fieldset->addField('preferred_state', 'select', array('name' => 'preferred_state', 'label' => AO::helper('adminhtml')->__('Preferred state'), 'value' => $pear->getConfig()->get('preferred_state'), 'options' => AO::getModel('adminhtml/extension')->getStabilityOptions()));
$this->setForm($form);
return $this;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:9,代码来源:Extensions_Config_Form.php
示例4: upgradeAllAction
public function upgradeAllAction()
{
$params = array('comment' => Mage::helper('adminhtml')->__("Upgrading all packages, please wait...") . "\r\n\r\n");
if ($this->getRequest()->getParam('do')) {
$params['command'] = 'upgrade';
$params['options'] = array();
$params['params'] = array($pkg);
}
$result = Varien_Pear::getInstance()->runHtmlConsole($params);
if (!$result instanceof PEAR_Error) {
Mage::app()->cleanCache();
}
}
开发者ID:arslbbt,项目名称:mangentovies,代码行数:13,代码来源:FileController.php
示例5: _fetchPackages
protected function _fetchPackages()
{
// fetch installed packages
$pear = Varien_Pear::getInstance();
$channels = Mage::getModel('adminhtml/extension')->getKnownChannels();
#$channels = array('var-dev.varien.com'=>1);#, 'pear.php.net'=>1);
$channelData = array();
foreach ($channels as $channel => $name) {
$data = array();
if (Mage::app()->useCache('pear')) {
$channelKey = 'PEAR_channel_packages_' . preg_replace('#[^a-z0-9]+#', '_', $channel);
$data = unserialize(Mage::app()->loadCache($channelKey));
}
if (empty($data)) {
$pear->getFrontend()->clear();
$pear->run('list-all', array('channel' => $channel));
$output = $pear->getOutput();
if (empty($output)) {
continue;
}
$data = $output[0]['output'];
if (Mage::app()->useCache('pear')) {
Mage::app()->saveCache(serialize($data), $channelKey, array('pear'), 3600);
}
}
$channelData[$channel] = $data;
}
// load available packages into array
$packages = array();
foreach ($channelData as $channel) {
if (!isset($channel['headline'])) {
continue;
}
if (!empty($channel['data'])) {
foreach ($channel['data'] as $category => $pkglist) {
foreach ($pkglist as $pkg) {
$pkgNameArr = explode('/', $pkg[0]);
$pkgName = isset($pkgNameArr[1]) ? $pkgNameArr[1] : $pkgNameArr[0];
$packages[] = array('id' => $channel['channel'] . '|' . $pkgName, 'category' => $category, 'channel' => $channel['channel'], 'name' => $pkgName, 'remote_version' => isset($pkg[1]) ? $pkg[1] : '', 'local_version' => isset($pkg[2]) ? $pkg[2] : '', 'summary' => isset($pkg[3]) ? $pkg[3] : '');
}
}
}
}
return $packages;
}
开发者ID:arslbbt,项目名称:mangentovies,代码行数:45,代码来源:Collection.php
示例6: saveAction
public function saveAction()
{
$pear = Varien_Pear::getInstance();
$error = Mage::helper('adminhtml')->__("Unknown error");
$state = $this->getRequest()->getPost('preferred_state');
if (!empty($state)) {
$session = Mage::getSingleton('adminhtml/session');
$result = $pear->run('config-set', array(), array('preferred_state', $state));
if ($result instanceof PEAR_Error) {
$error = $result->getMessage();
} else {
$error = false;
}
}
if ($error) {
$session->addError($result->getMessage());
} else {
$session->addSuccess(Mage::helper('adminhtml')->__("PEAR Configuration was successfully saved"));
}
$this->_redirect('*/*');
}
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:21,代码来源:ConfigController.php
示例7: createPackage
public function createPackage()
{
$pear = Varien_Pear::getInstance();
$dir = Mage::getBaseDir('var') . DS . 'pear';
if (!Mage::getConfig()->createDirIfNotExists($dir)) {
return false;
}
$curDir = getcwd();
chdir($dir);
$result = $pear->run('mage-package', array(), array('package.xml'));
chdir($curDir);
if ($result instanceof PEAR_Error) {
return $result;
}
return true;
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:16,代码来源:Extension.php
示例8: __construct
public function __construct()
{
$this->_pear = Varien_Pear::getInstance();
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:4,代码来源:Package.php
示例9: massInstallRunAction
public function massInstallRunAction()
{
$params = array('comment' => Mage::helper('adminhtml')->__("Installing selected packages, please wait...") . "\r\n\r\n");
if ($this->getRequest()->getParam('do')) {
$params['command'] = 'install';
$params['options'] = array();
$packages = array();
foreach ($this->getRequest()->getPost('package') as $package) {
$packages[] = str_replace('|', '/', $package);
}
$params['params'] = $packages;
}
$result = Varien_Pear::getInstance()->runHtmlConsole($params);
if (!$result instanceof PEAR_Error) {
Mage::app()->cleanCache();
}
Mage::app()->getFrontController()->getResponse()->clearAllHeaders();
}
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:18,代码来源:RemoteController.php
示例10: installAction
public function installAction()
{
$pear = Varien_Pear::getInstance();
$params = array('comment' => Mage::helper('install')->__("Downloading and installing Magento, please wait...") . "\r\n\r\n");
if ($this->getRequest()->getParam('do')) {
if ($state = $this->getRequest()->getParam('state', 'beta')) {
$result = $pear->runHtmlConsole(array('comment' => Mage::helper('install')->__("Setting preferred state to: %s", $state) . "\r\n\r\n", 'command' => 'config-set', 'params' => array('preferred_state', $state)));
if ($result instanceof PEAR_Error) {
$this->installFailureCallback();
exit;
}
}
$params['command'] = 'install';
$params['options'] = array('onlyreqdeps' => 1);
$params['params'] = Mage::getModel('install/installer_pear')->getPackages();
$params['success_callback'] = array($this, 'installSuccessCallback');
$params['failure_callback'] = array($this, 'installFailureCallback');
}
$pear->runHtmlConsole($params);
Mage::app()->getFrontController()->getResponse()->clearAllHeaders();
}
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:21,代码来源:WizardController.php
示例11: releaseAction
public function releaseAction()
{
#Varien_Pear::getInstance()->runHtmlConsole(array('command'=>'list-channels'));
if (empty($_POST)) {
$serFiles = @glob(Mage::getBaseDir('var') . DS . 'pear' . DS . '*.ser');
if (!$serFiles) {
return;
}
$pkg = new Varien_Object();
echo '<html><head><style type="text/css">* { font:normal 12px Arial }</style></head>
<body><form method="post"><table border="1" cellpadding="3" cellspacing="0"><thead>
<tr><th>Update/Package</th><th>Version</th><th>State</th></tr>
</thead><tbody>';
foreach ($serFiles as $i => $file) {
$serialized = file_get_contents($file);
$pkg->setData(unserialize($serialized));
$n = $pkg->getName();
echo '<tr><td><input type="checkbox" name="pkgs[' . $i . '][name]" id="pkg_' . $i . '" value="' . $n . '"/>
<label for="pkg_' . $i . '">' . $n . '</label>
<input type="hidden" name="pkgs[' . $i . '][file]" value="' . $file . '"/>
</td>
<td><input name="pkgs[' . $i . '][release_version]" value="' . $pkg->getData('release_version') . '"/></td>
<td><input name="pkgs[' . $i . '][release_stability]" value="' . $pkg->getData('release_stability') . '"/></td>
</tr>';
#echo "<pre>"; print_r($pkg->getData()); echo "</pre>"; exit;
}
echo '</tbody></table><button type="submit">Save and Generate Packages</button></form></body></html>';
} else {
@set_time_limit(0);
ob_implicit_flush();
foreach ($_POST['pkgs'] as $r) {
if (empty($r['name'])) {
continue;
}
echo "<hr/><h4>" . $r['name'] . "</h4>";
$ext = Mage::getModel('adminhtml/extension');
$ext->setData(unserialize(file_get_contents($r['file'])));
$ext->setData('release_version', $r['release_version']);
$ext->setData('release_stability', $r['release_stability']);
#echo "<pre>"; print_r($ext->getData()); echo "</pre>";
$result = $ext->savePackage();
if (!$result) {
echo "ERROR while creating the package";
continue;
} else {
echo "Package created; ";
}
$result = $ext->createPackage();
$pear = Varien_Pear::getInstance();
if ($result) {
$data = $pear->getOutput();
print_r($data[0]['output']);
} else {
echo "ERROR:";
print_r($result->getMessage());
}
}
echo '<hr/><a href="' . $_SERVER['REQUEST_URI'] . '">Refresh</a>';
}
exit;
}
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:61,代码来源:CustomController.php
示例12: createPackage
public function createPackage()
{
$pear = Varien_Pear::getInstance();
$dir = Mage::getBaseDir('var') . DS . 'pear';
$result = $pear->run('mage-package', array('targetdir' => $dir), array($dir . '/package.xml'));
if ($result instanceof PEAR_Error) {
return $result;
}
return true;
}
开发者ID:arslbbt,项目名称:mangentovies,代码行数:10,代码来源:Extension.php
示例13: testAction
public function testAction()
{
Varien_Pear::getInstance()->runHtmlConsole(array('command' => 'list-channels'));
}
开发者ID:arslbbt,项目名称:mangentovies,代码行数:4,代码来源:CustomController.php
示例14: getInstance
public function getInstance()
{
if (!self::$_instance) {
self::$_instance = new self();
}
return self::$_instance;
}
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:7,代码来源:Pear.php
注:本文中的Varien_Pear类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论