Example #1
0
 private function shouldEmitHooks($path = '')
 {
     if ($path && Cache\Scanner::isPartialFile($path)) {
         return false;
     }
     if (!Filesystem::$loaded) {
         return false;
     }
     $defaultRoot = Filesystem::getRoot();
     if ($this->fakeRoot === $defaultRoot) {
         return true;
     }
     return strlen($this->fakeRoot) > strlen($defaultRoot) && substr($this->fakeRoot, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/';
 }
Example #2
0
 private function runHooks($hooks, $path, $post = false)
 {
     $prefix = $post ? 'post_' : '';
     $run = true;
     if (Filesystem::$loaded and $this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path)) {
         foreach ($hooks as $hook) {
             if ($hook != 'read') {
                 \OC_Hook::emit(Filesystem::CLASSNAME, $prefix . $hook, array(Filesystem::signal_param_run => &$run, Filesystem::signal_param_path => $path));
             } elseif (!$post) {
                 \OC_Hook::emit(Filesystem::CLASSNAME, $prefix . $hook, array(Filesystem::signal_param_path => $path));
             }
         }
     }
     return $run;
 }