当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Connect_Ftp::delete方法代码示例

本文整理汇总了PHP中Mage_Connect_Ftp::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Connect_Ftp::delete方法的具体用法?PHP Mage_Connect_Ftp::delete怎么用?PHP Mage_Connect_Ftp::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Connect_Ftp的用法示例。


在下文中一共展示了Mage_Connect_Ftp::delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cleanCache

 protected function cleanCache()
 {
     $result = true;
     $message = '';
     try {
         if ($this->isInstalled()) {
             if (!empty($_REQUEST['clean_sessions'])) {
                 Mage::app()->cleanAllSessions();
                 $message .= 'Session cleaned successfully. ';
             }
             Mage::app()->cleanCache();
             // reinit config and apply all updates
             Mage::app()->getConfig()->reinit();
             Mage_Core_Model_Resource_Setup::applyAllUpdates();
             Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
             $message .= 'Cache cleaned successfully';
         } else {
             $result = true;
         }
     } catch (Exception $e) {
         $result = false;
         $message = "Exception during cache and session cleaning: " . $e->getMessage();
         $this->session()->addMessage('error', $message);
     }
     if ($result && $this->_getMaintenanceFlag()) {
         $maintenance_filename = 'maintenance.flag';
         $config = $this->config();
         if (!$this->isWritable() && strlen($config->__get('remote_config')) > 0) {
             $ftpObj = new Mage_Connect_Ftp();
             $ftpObj->connect($config->__get('remote_config'));
             $ftpObj->delete($maintenance_filename);
             $ftpObj->close();
         } else {
             @unlink($this->_getMaintenanceFilePath());
         }
     }
     return array('result' => $result, 'message' => $message);
 }
开发者ID:lightyoruichi,项目名称:Magento-Pre-Patched-Files,代码行数:38,代码来源:Controller.php

示例2: processUninstallPackageFtp

 /**
  *
  * @param $chanName
  * @param $package
  * @param Mage_Connect_Singleconfig $cacheObj
  * @param Mage_Connect_Ftp $ftp
  * @return unknown_type
  */
 public function processUninstallPackageFtp($chanName, $package, $cacheObj, $ftp)
 {
     $ftpDir = $ftp->getcwd();
     $package = $cacheObj->getPackageObject($chanName, $package);
     $contents = $package->getContents();
     foreach ($contents as $file) {
         $res = $ftp->delete($file);
         $this->removeEmptyDirectory(dirname($file), $ftp);
     }
     $remoteXml = Mage_Connect_Package::PACKAGE_XML_DIR . DS . $package->getReleaseFilename() . '.xml';
     $ftp->delete($remoteXml);
     $ftp->chdir($ftpDir);
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:21,代码来源:Packager.php

示例3: validateConfigPost

 /**
  * Validate settings post data.
  *
  * @param array $p
  */
 public function validateConfigPost($p)
 {
     $errors = array();
     $configTestFile = 'connect.cfgt';
     $configObj = $this->connect()->getConfig();
     if ('ftp' == $p['deployment_type'] || '1' == $p['inst_protocol']) {
         /*check ftp*/
         $confFile = $configObj->downloader_path . DIRECTORY_SEPARATOR . $configTestFile;
         try {
             $ftpObj = new Mage_Connect_Ftp();
             $ftpObj->connect($p['ftp']);
             $tempFile = tempnam(sys_get_temp_dir(), 'config');
             $serial = md5('config test file');
             $f = @fopen($tempFile, "w+");
             @fwrite($f, $serial);
             @fclose($f);
             $ret = $ftpObj->upload($confFile, $tempFile);
             //read file
             if (!$errors && is_file($configTestFile)) {
                 $size = filesize($configTestFile);
                 if (!$size) {
                     $errors[] = 'Unable to read saved settings. Please check Installation Path of FTP Connection.';
                 }
                 if (!$errors) {
                     $f = @fopen($configTestFile, "r");
                     @fseek($f, 0, SEEK_SET);
                     $contents = @fread($f, strlen($serial));
                     if ($serial != $contents) {
                         $errors[] = 'Wrong Installation Path of FTP Connection.';
                     }
                     fclose($f);
                 }
             } else {
                 $errors[] = 'Unable to read saved settings. Please check Installation Path of FTP Connection.';
             }
             $ftpObj->delete($confFile);
             $ftpObj->close();
         } catch (Exception $e) {
             $errors[] = 'Deployment FTP Error. ' . $e->getMessage();
         }
     } else {
         $p['ftp'] = '';
     }
     if ('1' == $p['use_custom_permissions_mode']) {
         /*check permissions*/
         if (octdec(intval($p['mkdir_mode'])) < 73 || octdec(intval($p['mkdir_mode'])) > 511) {
             $errors[] = 'Folders permissions not valid. ';
         }
         if (octdec(intval($p['chmod_file_mode'])) < 73 || octdec(intval($p['chmod_file_mode'])) > 511) {
             $errors[] = 'Files permissions not valid. ';
         }
     }
     //$this->controller()->session()->addMessage('success', 'Settings has been successfully saved');
     return $errors;
 }
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:60,代码来源:Connect.php

示例4: processUninstallPackageFtp

 /**
  *
  * @param $chanName
  * @param $package
  * @param Mage_Connect_Singleconfig $cacheObj
  * @param Mage_Connect_Ftp $ftp
  * @return unknown_type
  */
 public function processUninstallPackageFtp($chanName, $package, $cacheObj, $ftp)
 {
     $ftpDir = $ftp->getcwd();
     $package = $cacheObj->getPackageObject($chanName, $package);
     $contents = $package->getContents();
     foreach ($contents as $file) {
         $res = $ftp->delete($file);
     }
     $ftp->chdir($ftpDir);
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:18,代码来源:Packager.php

示例5: processUninstallPackageFtp

 /**
  * Uninstall Package over FTP
  *
  * @param $chanName
  * @param $package
  * @param Mage_Connect_Singleconfig $cacheObj
  * @param Mage_Connect_Ftp $ftp
  * @throws RuntimeException
  */
 public function processUninstallPackageFtp($chanName, $package, $cacheObj, $ftp)
 {
     $ftpDir = $ftp->getcwd();
     $package = $cacheObj->getPackageObject($chanName, $package);
     $contents = $package->getContents();
     $failedFiles = array();
     foreach ($contents as $file) {
         $ftp->delete($file);
         if ($ftp->fileExists($file)) {
             $failedFiles[] = $file;
             continue;
         }
         $this->removeEmptyDirectory(dirname($file), $ftp);
     }
     if (!empty($failedFiles)) {
         $msg = sprintf("Failed to delete files: %s \r\n Check permissions", implode("\r\n", $failedFiles));
         throw new RuntimeException($msg);
     }
     $remoteXml = Mage_Connect_Package::PACKAGE_XML_DIR . DS . $package->getReleaseFilename() . '.xml';
     $ftp->delete($remoteXml);
     $ftp->chdir($ftpDir);
 }
开发者ID:okite11,项目名称:frames21,代码行数:31,代码来源:Packager.php

示例6: endInstall

 /**
  * End install package(s)
  *
  */
 public function endInstall()
 {
     if ($this->isInstalled()) {
         try {
             if (!empty($_GET['clean_sessions'])) {
                 Mage::app()->cleanAllSessions();
             }
             Mage::app()->cleanCache();
         } catch (Exception $e) {
             $this->session()->addMessage('error', "Exception during cache and session cleaning: " . $e->getMessage());
         }
         // reinit config and apply all updates
         Mage::app()->getConfig()->reinit();
         Mage_Core_Model_Resource_Setup::applyAllUpdates();
         Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
     }
     if ($this->_getMaintenanceFlag()) {
         $maintenance_filename = 'maintenance.flag';
         $config = $this->config();
         if (!$this->isWritable() && strlen($config->__get('remote_config')) > 0) {
             $ftpObj = new Mage_Connect_Ftp();
             $ftpObj->connect($config->__get('remote_config'));
             $ftpObj->delete($maintenance_filename);
             $ftpObj->close();
         } else {
             @unlink($this->_getMaintenanceFilePath());
         }
     }
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:33,代码来源:Controller.php


注:本文中的Mage_Connect_Ftp::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。