protected function _refreshLocal($myrole, $drivers) { $job = $this->_out->jobStart("traversing file system starting at {$this->_baseDir}"); /* @var $compare Compare_Sqlite */ $compare = $drivers[Core_Engine::ROLE_COMPARE]; $stat = $this->_fileStat; $it = new RecursiveDirectoryIterator($this->_baseDir); $it->setFlags(RecursiveDirectoryIterator::SKIP_DOTS); //$it = new DirnameFilter($it, "/informa/i"); if (isset($this->_options['filter'])) { $this->_out->logNotice(">>>applying filter " . $this->_options['filterType']); $filterConf = $this->_options['filter'][$this->_options['filterType']]; /** @var $filter Filter_Interface */ $filter = new $filterConf['class']($filterConf); $filter->setIterator($it); $it = $filter->applyFilters(); } $itemCount = 0; $this->_trimFromBegin = strlen($this->_baseDir); $compare->updateFromLocalStart(); foreach (new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST) as $file) { /** @var $file SplFileObject */ //we don't need make entry for not empty folder if ($file->isDir() && !Storage_Filesystem_FileStat::isEmptyDir((string) $file)) { continue; } $file = (string) $file; $obj = Core_FsObject::factoryFromStat($this->_makePath($file), $stat->getStat($file)); $compare->updateFromLocal($obj); $itemCount++; } $compare->updateFromLocalEnd(); $this->_out->jobEnd($job, "updated info about {$itemCount} files"); }
/** * Constructor * * @param array $options configuration options */ public function __construct($options) { // merge options with default options $options = Core_Engine::array_merge_recursive_distinct(static::getConfigOptions(CfgPart::DEFAULTS), $options); // remember configuration options $this->_options = $options; $this->_verbosity = Output_Stack::verbosityToConst($options['verbosity']); // make copy for faster access if (false === $this->_verbosity) { throw new Core_StopException("Value of option verbosity is '{$options['verbosity']}' which is not allowed.", "cliConstruct"); } // make sure that all output is directly sent to console ob_implicit_flush(); }
public function getMd5($path) { $v = null; $retries = 3; do { try { $v = $this->_s3->get_object_headers($this->getBucket(), $path); $retries = 0; } catch (Exception $e) { $this->_out->logWarning("retry S3::getMd5() for {$path}"); usleep(200); $retries--; } } while ($retries !== 0); if ($v === null || !array_key_exists('etag', $v->header)) { return false; } $md5 = str_replace('"', '', (string) $v->header['etag']); return $md5; }
public function tst($value) { $this->_exec("CREATE TABLE IF NOT EXISTS PathTest " . "(path TEXT)"); $this->_out->logDebug(">>>VALUE must be inserted {$value}"); $this->_exec("INSERT INTO PathTest VALUES (\"{$value}\")"); }