예제 #1
0
 /**
  * @param string $fileType  File type indicator
  * @return array  Returns an array of matching filenames.
  */
 private function _getAvailableImportFilenames($fileType)
 {
     $filespec = self::_getFileSpecForFileType($fileType);
     $result = $this->_pushd($this->aFtpConfig['fetch_path']);
     $result = $result && FALSE !== ($ls = $this->_oSftp->ls());
     $this->_popd();
     // only look for the file if $result is not already FALSE (i.e. if no errors have occurred)
     if (FALSE !== $result) {
         $aFiles = array();
         array_walk($ls, function ($aElement) use($filespec, &$aFiles) {
             if (strpos($aElement['text'], $filespec['prefix']) === 0 && strpos($aElement['text'], $filespec['suffix']) === strlen($aElement['text']) - strlen($filespec['suffix'])) {
                 return $aFiles[] = $aElement['text'];
             }
         });
         return $aFiles;
     }
     return array();
 }
예제 #2
0
 public function filteredLs()
 {
     $result = parent::ls();
     return Mage::getSingleton('udbatch/io')->filterLs($result, $this);
 }