Beispiel #1
0
 /**
  * @param string[] $hooks
  * @param string $path
  * @param bool $post
  * @return bool
  */
 private function runHooks($hooks, $path, $post = false)
 {
     $path = $this->getHookPath($path);
     $prefix = $post ? 'post_' : '';
     $run = true;
     if ($this->shouldEmitHooks($path)) {
         foreach ($hooks as $hook) {
             // manually triger updater hooks to ensure they are called first
             if ($post) {
                 if ($hook == 'write') {
                     Updater::writeHook(array('path' => $path));
                 } elseif ($hook == 'touch') {
                     Updater::touchHook(array('path' => $path));
                 } else {
                     if ($hook == 'delete') {
                         Updater::deleteHook(array('path' => $path));
                     }
                 }
             }
             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;
 }